diff --git a/Projects/GimDB/GimDB.sqlproj b/Projects/GimDB/GimDB.sqlproj
new file mode 100644
index 0000000..a5ffe2a
--- /dev/null
+++ b/Projects/GimDB/GimDB.sqlproj
@@ -0,0 +1,668 @@
+
+
+
+
+ Debug
+ AnyCPU
+ GimDB
+ 2.0
+ 4.1
+ {a3141577-5116-4ffb-8c3e-557644ca98e0}
+ Microsoft.Data.Tools.Schema.Sql.Sql110DatabaseSchemaProvider
+ Database
+
+
+ GimDB
+ GimDB
+ 1033,CI
+ BySchemaAndSchemaType
+ True
+ v4.5
+ CS
+ Properties
+ False
+ True
+ True
+ Latin1_General_CI_AS
+ False
+ False
+ None
+ True
+ False
+ 2049
+ OFF
+ 0
+ SECONDS
+ False
+ True
+ 2
+ Days
+ False
+ False
+ False
+ False
+ CHECKSUM
+ DisableBroker
+ False
+ SIMPLE
+ False
+ False
+ True
+ False
+ 90
+ False
+ False
+ False
+ False
+ False
+ False
+ False
+ False
+ ONLINE
+ False
+ GLOBAL
+ False
+ True
+ False
+ True
+ False
+ MULTI_USER
+ SIMPLE
+ False
+ PRIMARY
+ True
+
+
+ bin\Release\
+ $(MSBuildProjectName).sql
+ False
+ pdbonly
+ true
+ false
+ true
+ prompt
+ 4
+
+
+ bin\Debug\
+ $(MSBuildProjectName).sql
+ false
+ true
+ full
+ false
+ true
+ true
+ prompt
+ 4
+
+
+ 11.0
+
+ True
+ 11.0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+ On
+ On
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Projects/GimDB/GimDB.sqlproj.user b/Projects/GimDB/GimDB.sqlproj.user
new file mode 100644
index 0000000..9fcb30c
--- /dev/null
+++ b/Projects/GimDB/GimDB.sqlproj.user
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/Projects/GimDB/Import Schema Logs/GimDB_20151119110615.log b/Projects/GimDB/Import Schema Logs/GimDB_20151119110615.log
new file mode 100644
index 0000000..edc56b8
--- /dev/null
+++ b/Projects/GimDB/Import Schema Logs/GimDB_20151119110615.log
@@ -0,0 +1,76 @@
+19/11/2015 12:06:15 This log contains information about the import schema operation into project 'GimDB' on computer 'W10-DESK-SAM' by user 'samuele'.
+19/11/2015 12:06:16 Import of database schema has started.
+19/11/2015 12:06:27 Gathering database options
+19/11/2015 12:06:27 Gathering users
+19/11/2015 12:06:27 Gathering roles
+19/11/2015 12:06:27 Gathering application roles
+19/11/2015 12:06:27 Gathering role memberships
+19/11/2015 12:06:27 Gathering filegroups
+19/11/2015 12:06:27 Gathering full-text catalogs
+19/11/2015 12:06:27 Gathering assemblies
+19/11/2015 12:06:27 Gathering certificates
+19/11/2015 12:06:27 Gathering asymmetric keys
+19/11/2015 12:06:27 Gathering symmetric keys
+19/11/2015 12:06:27 Gathering encrypted symmetric keys
+19/11/2015 12:06:27 Gathering schemas
+19/11/2015 12:06:27 Gathering XML schema collections
+19/11/2015 12:06:27 Gathering user-defined data types
+19/11/2015 12:06:27 Gathering user-defined types
+19/11/2015 12:06:27 Gathering table types
+19/11/2015 12:06:27 Gathering unique keys for table types
+19/11/2015 12:06:27 Gathering primary keys for table types
+19/11/2015 12:06:27 Gathering check constraints for table types
+19/11/2015 12:06:27 Gathering default constraints for table types
+19/11/2015 12:06:27 Gathering partition functions
+19/11/2015 12:06:27 Gathering partition schemes
+19/11/2015 12:06:27 Gathering functions
+19/11/2015 12:06:27 Gathering encrypted functions
+19/11/2015 12:06:27 Gathering aggregates
+19/11/2015 12:06:27 Gathering procedures
+19/11/2015 12:06:27 Gathering encrypted procedures
+19/11/2015 12:06:27 Gathering tables
+19/11/2015 12:06:27 Gathering primary keys
+19/11/2015 12:06:27 Gathering unique constraints
+19/11/2015 12:06:27 Gathering foreign keys
+19/11/2015 12:06:27 Gathering default constraints
+19/11/2015 12:06:27 Gathering check constraints
+19/11/2015 12:06:27 Gathering views
+19/11/2015 12:06:27 Gathering encrypted views
+19/11/2015 12:06:27 Gathering indexes
+19/11/2015 12:06:27 Gathering statistics
+19/11/2015 12:06:27 Gathering full-text index stoplists
+19/11/2015 12:06:27 Gathering search property lists
+19/11/2015 12:06:27 Gathering search properties
+19/11/2015 12:06:27 Gathering full-text indexes
+19/11/2015 12:06:27 Gathering column store indexes
+19/11/2015 12:06:27 Gathering spatial indexes
+19/11/2015 12:06:27 Gathering XML indexes
+19/11/2015 12:06:27 Gathering Selective XML indexes
+19/11/2015 12:06:27 Gathering encrypted triggers
+19/11/2015 12:06:27 Gathering triggers
+19/11/2015 12:06:27 Gathering encrypted and clr ddl triggers
+19/11/2015 12:06:27 Gathering ddl triggers
+19/11/2015 12:06:27 Gathering synonyms
+19/11/2015 12:06:27 Gathering defaults
+19/11/2015 12:06:27 Gathering data constraint uddt bindings
+19/11/2015 12:06:27 Gathering rules
+19/11/2015 12:06:27 Gathering data constraint uddt bindings
+19/11/2015 12:06:27 Gathering message types
+19/11/2015 12:06:27 Gathering queues
+19/11/2015 12:06:27 Gathering contracts
+19/11/2015 12:06:27 Gathering services
+19/11/2015 12:06:27 Gathering event notifications
+19/11/2015 12:06:27 Gathering remote service bindings
+19/11/2015 12:06:27 Gathering broker priorities
+19/11/2015 12:06:27 Gathering signatures
+19/11/2015 12:06:27 Gathering data compression options
+19/11/2015 12:06:27 Gathering sequence types
+19/11/2015 12:06:27 Gathering extended properties
+19/11/2015 12:06:27 Gathering credentials
+19/11/2015 12:06:27 Gathering logins
+19/11/2015 12:06:27 Gathering server audits
+19/11/2015 12:06:28 Scanning project for duplicate elements
+19/11/2015 12:06:29 Finished duplicate element processing
+19/11/2015 12:06:32 Finished importing database.
+19/11/2015 12:06:32 A summary of the import was saved to the following location: C:\Users\samuele.STEAMWAREWIN\Documents\Visual Studio 2015\Projects\WebGIM\Projects\GimDB\Import Schema Logs\GimDB_20151119110615.log
+19/11/2015 12:06:32 Click Finish to continue...
diff --git a/Projects/GimDB/Security/RoleMemberships.sql b/Projects/GimDB/Security/RoleMemberships.sql
new file mode 100644
index 0000000..f45efcf
--- /dev/null
+++ b/Projects/GimDB/Security/RoleMemberships.sql
@@ -0,0 +1,2 @@
+ALTER ROLE [db_owner] ADD MEMBER [steamware];
+
diff --git a/Projects/GimDB/Security/dwh.sql b/Projects/GimDB/Security/dwh.sql
new file mode 100644
index 0000000..ed915b1
--- /dev/null
+++ b/Projects/GimDB/Security/dwh.sql
@@ -0,0 +1,7 @@
+CREATE SCHEMA [dwh]
+ AUTHORIZATION [dbo];
+
+
+GO
+EXECUTE sp_addextendedproperty @name = N'Description', @value = N'Schema x data wharehouse', @level0type = N'SCHEMA', @level0name = N'dwh';
+
diff --git a/Projects/GimDB/Security/export.sql b/Projects/GimDB/Security/export.sql
new file mode 100644
index 0000000..9dfde35
--- /dev/null
+++ b/Projects/GimDB/Security/export.sql
@@ -0,0 +1,3 @@
+CREATE SCHEMA [export]
+ AUTHORIZATION [dbo];
+
diff --git a/Projects/GimDB/Security/steamware.sql b/Projects/GimDB/Security/steamware.sql
new file mode 100644
index 0000000..ccc0bcd
--- /dev/null
+++ b/Projects/GimDB/Security/steamware.sql
@@ -0,0 +1,2 @@
+CREATE USER [steamware];
+
diff --git a/Projects/GimDB/Security/voc.sql b/Projects/GimDB/Security/voc.sql
new file mode 100644
index 0000000..788a11d
--- /dev/null
+++ b/Projects/GimDB/Security/voc.sql
@@ -0,0 +1,3 @@
+CREATE SCHEMA [voc]
+ AUTHORIZATION [dbo];
+
diff --git a/Projects/GimDB/dbo/Functions/f_dateOnly.sql b/Projects/GimDB/dbo/Functions/f_dateOnly.sql
new file mode 100644
index 0000000..6fce43e
--- /dev/null
+++ b/Projects/GimDB/dbo/Functions/f_dateOnly.sql
@@ -0,0 +1,16 @@
+
+/***********************************************************************************
+* FUNCTION f_dateOnly
+*
+* restituisce solo la parte data di un campo datetime (ovvero a mezzanotte...)
+*
+***********************************************************************************/
+create FUNCTION f_dateOnly
+(
+ @dateIn DATETIME
+)
+RETURNS DATETIME
+AS
+ BEGIN
+ RETURN dateadd(dd, -datediff(dd, @dateIn, 1), 1)
+ END
diff --git a/Projects/GimDB/dbo/Functions/f_diffOreLavorative.sql b/Projects/GimDB/dbo/Functions/f_diffOreLavorative.sql
new file mode 100644
index 0000000..7f2f813
--- /dev/null
+++ b/Projects/GimDB/dbo/Functions/f_diffOreLavorative.sql
@@ -0,0 +1,64 @@
+
+/***********************************************************************************
+* FUNCTION f_diffOreLavorative
+*
+* calcola le effettive ore lavorative sottraendo chiusure x festività o aperture programmate
+*
+***********************************************************************************/
+create FUNCTION f_diffOreLavorative
+(
+ @dataFrom DATETIME,
+ @dataTo DATETIME,
+ @idxMacchina INT -- per ora non lo considero poiché non ci sono calendari diversi x macchina...
+)
+RETURNS FLOAT
+AS
+ BEGIN
+
+ -- dichiarazioni variabili
+ DECLARE @oreTot AS FLOAT
+ DECLARE @oreOff AS FLOAT
+ DECLARE @tmp_dates TABLE (DateValue DATETIME, h INT)
+ SET @oreTot = 0
+
+ -- controllo date coerenti
+ IF(@dataTo > @dataFrom)
+ BEGIN
+ -- calcolo totale "raw" delle ore
+ SET @oreTot = CAST(ISNULL(DATEDIFF(minute, @dataFrom, @dataTo), 0) AS float) / 60;
+ -- definisco tabella cte ricorsiva
+ WITH mycte AS
+ (
+ SELECT CAST(dbo.f_dateOnly(DATEADD(dd,1,@dataFROM)) AS DATETIME) DateValue
+ UNION ALL
+ SELECT DateValue + 1
+ FROM mycte
+ WHERE DateValue + 1 < dbo.f_dateOnly(@dataTo)
+ )
+ -- carico nella tab temporanea i sabati e le domeniche...
+ INSERT into @tmp_dates(DateValue, h)
+ SELECT *, CASE ((DATEPART(dw, DateValue) + @@DATEFIRST) % 7) WHEN 0 THEN 16 ELSE 24 END AS h
+ FROM mycte
+ WHERE ((DATEPART(dw, DateValue) + @@DATEFIRST) % 7) IN (0,1)
+ OPTION (MAXRECURSION 0)
+ -- carico le festività per le date NON ancora presenti
+ insert into @tmp_dates(DateValue, h)
+ select data as DateValue, 24 as h--, descrizione
+ from CalendFesteFerie
+ where data between @dataFrom and @dataTo and data not in (select distinct DateValue from @tmp_dates)
+ -- aggiorno sabati/domenica che fossero festivi (ipotesi che hfest > h sab/dom...
+ UPDATE @tmp_dates
+ SET h=24
+ WHERE DateValue in (SELECT data FROM CalendFesteFerie WHERE data between @dataFrom and @dataTo)
+
+ -- calcolo INFINE le ore off!
+ SET @oreOff = (SELECT ISNULL(SUM(h),0) FROM @tmp_dates)
+ END
+ -- setto le nuove ore totali... se ho un numero di ore > delle fermate le sottraggo per evitare ore engative...
+ IF(@oreTot > @oreOff)
+ BEGIN
+ SET @oreTot = @oreTot - @oreOff
+ END
+
+ RETURN @oreTot
+ END
diff --git a/Projects/GimDB/dbo/Functions/f_fixCR.sql b/Projects/GimDB/dbo/Functions/f_fixCR.sql
new file mode 100644
index 0000000..b48c6d8
--- /dev/null
+++ b/Projects/GimDB/dbo/Functions/f_fixCR.sql
@@ -0,0 +1,15 @@
+
+/***********************************************************************************
+* FUNCTION f_fixCR
+*
+* restituisce una stringa in cui ritorni/andate a capo sono sostituiti con "-"
+*
+***********************************************************************************/
+CREATE FUNCTION [dbo].[f_fixCR] (@string VARCHAR(MAX))
+RETURNS VARCHAR(MAX) AS
+BEGIN
+
+ RETURN REPLACE(REPLACE(REPLACE(@string, CHAR(13), '-'), CHAR(10), '-'), CHAR(9), '-')
+
+END
+
diff --git a/Projects/GimDB/dbo/Functions/f_padLeft.sql b/Projects/GimDB/dbo/Functions/f_padLeft.sql
new file mode 100644
index 0000000..39dae2c
--- /dev/null
+++ b/Projects/GimDB/dbo/Functions/f_padLeft.sql
@@ -0,0 +1,18 @@
+/***********************************************************************************
+* FUNCTION f_padLeft
+*
+* restituisce una stringa con padding del carattere desiderato per la lunghezza totale desiderata
+*
+***********************************************************************************/
+CREATE FUNCTION f_padLeft (@string VARCHAR(255), @desired_length INTEGER, @pad_character CHAR(1))
+RETURNS VARCHAR(255) AS
+BEGIN
+
+ -- Prefix the required number of spaces to bulk up the string and then replace the spaces with the desired character
+ RETURN CASE
+ WHEN LEN(@string) < @desired_length
+ THEN REPLACE(SPACE(@desired_length - LEN(@string)), ' ', @pad_character) + @string
+ ELSE @string
+ END
+
+END
diff --git a/Projects/GimDB/dbo/Functions/rightDivision.sql b/Projects/GimDB/dbo/Functions/rightDivision.sql
new file mode 100644
index 0000000..2db6168
--- /dev/null
+++ b/Projects/GimDB/dbo/Functions/rightDivision.sql
@@ -0,0 +1,29 @@
+/***********************************************************************************
+* FUNCTION rightDivision
+*
+* calcola la divisione altrimenti mostra errore -1 se dividendo/divisore < 0
+*
+***********************************************************************************/
+CREATE FUNCTION rightDivision
+(
+ @dividendo float,
+ @divisore float
+)
+RETURNS float
+AS
+ BEGIN
+
+ declare @errore as int
+ declare @risultato as float
+
+ set @errore =0
+
+ set @errore = case when (isnull(@dividendo,0))<=0 then 1 end
+
+ set @errore = case when (isnull(@divisore,0)) <=0 then 1 end
+
+ set @risultato= case when (@errore=1) then -1 else @dividendo/@divisore end
+
+ RETURN @risultato
+
+ END
diff --git a/Projects/GimDB/dbo/Stored Procedures/clonaDirittiUser.sql b/Projects/GimDB/dbo/Stored Procedures/clonaDirittiUser.sql
new file mode 100644
index 0000000..83aead0
--- /dev/null
+++ b/Projects/GimDB/dbo/Stored Procedures/clonaDirittiUser.sql
@@ -0,0 +1,14 @@
+create PROCEDURE clonaDirittiUser
+(
+ @userOrig varchar(20),
+ @userDest varchar(20)
+)
+AS
+
+ INSERT INTO DIRITTI
+ (USER_NAME, COD_CDC, COD_MODULO, COD_FUNZIONE)
+SELECT @userDest AS USER_NAME, COD_CDC, COD_MODULO, COD_FUNZIONE
+FROM DIRITTI AS DIRITTI_1
+WHERE (USER_NAME = @userOrig)
+
+RETURN
diff --git a/Projects/GimDB/dbo/Stored Procedures/clonaDirittiUserModulo.sql b/Projects/GimDB/dbo/Stored Procedures/clonaDirittiUserModulo.sql
new file mode 100644
index 0000000..b174069
--- /dev/null
+++ b/Projects/GimDB/dbo/Stored Procedures/clonaDirittiUserModulo.sql
@@ -0,0 +1,15 @@
+create PROCEDURE clonaDirittiUserModulo
+(
+ @userOrig varchar(20),
+ @userDest varchar(20),
+ @codModulo varchar(31)
+)
+AS
+
+ INSERT INTO DIRITTI
+ (USER_NAME, COD_CDC, COD_MODULO, COD_FUNZIONE)
+SELECT @userDest AS USER_NAME, COD_CDC, COD_MODULO, COD_FUNZIONE
+FROM DIRITTI AS DIRITTI_1
+WHERE (USER_NAME = @userOrig) AND (COD_MODULO=@codModulo)
+
+RETURN
diff --git a/Projects/GimDB/dbo/Stored Procedures/sp_IndiciAndShrink.sql b/Projects/GimDB/dbo/Stored Procedures/sp_IndiciAndShrink.sql
new file mode 100644
index 0000000..432e454
--- /dev/null
+++ b/Projects/GimDB/dbo/Stored Procedures/sp_IndiciAndShrink.sql
@@ -0,0 +1,48 @@
+-- =============================================
+-- Author: Marco Salvi
+-- Create date: 11/03/2009
+-- Description: Stored procedure per ricostruire gli indici e fare lo shrink su un db
+-- =============================================
+CREATE PROCEDURE [dbo].[sp_IndiciAndShrink]
+(
+ @databaseName sysname
+)
+AS
+BEGIN
+
+ -- elimino eventuale tab temporanea preesistente
+ IF (SELECT COUNT(*) FROM TEMPDB..SYSOBJECTS WHERE NAME = '##TMP_nomiTabelle') > 0
+ BEGIN
+ DROP TABLE ##TMP_nomiTabelle
+ END
+
+ -- enumero le tab del db in una tab temporanea
+ SELECT IDENT = IDENTITY (INT,1,1), name
+ INTO ##TMP_nomiTabelle
+ FROM sys.Tables
+
+ -- eseguo reindicizzazione
+ DECLARE @VAR1 INT
+ SET @VAR1 = 1
+ WHILE @VAR1 < = ( SELECT COUNT(*) FROM ##TMP_nomiTabelle)
+ BEGIN
+
+ DECLARE @OBJECTNAME VARCHAR(256)
+
+ -- carico il nome della tab i-esima
+ SELECT @OBJECTNAME = name
+ FROM ##TMP_nomiTabelle
+ WHERE [IDENT] = @VAR1
+
+ -- rebuild indice
+ DBCC DBREINDEX(@OBJECTNAME)
+
+ -- incremento
+ SET @VAR1 = @VAR1 + 1
+
+ END
+
+ --shrink del db
+ DBCC SHRINKDATABASE (@databaseName)
+
+END
diff --git a/Projects/GimDB/dbo/Stored Procedures/sp_caricaUpdateMAcchine.sql b/Projects/GimDB/dbo/Stored Procedures/sp_caricaUpdateMAcchine.sql
new file mode 100644
index 0000000..f83ae5b
--- /dev/null
+++ b/Projects/GimDB/dbo/Stored Procedures/sp_caricaUpdateMAcchine.sql
@@ -0,0 +1,79 @@
+/*************************************
+* STORED PROCEDURE sp_caricaUpdateMAcchine
+* carica impianti/macchien da tab temporanea
+*
+* modif.: S.E.L. - 2015.02.04
+**************************************/
+CREATE PROCEDURE sp_caricaUpdateMAcchine
+AS
+
+SET XACT_ABORT ON;
+
+DECLARE @Id AS INT = 0;
+
+BEGIN TRAN
+
+ -- reset idx tabelle
+ SELECT @Id = ISNULL(MAX(idxImpianto),0) FROM dbo.AnagImpianti
+ DBCC CHECKIDENT ('AnagImpianti', RESEED, @Id);
+
+ SELECT @Id = ISNULL(MAX(idxMacchina),0) FROM dbo.AnagMacchine
+ DBCC CHECKIDENT ('AnagMacchine', RESEED, @Id);
+
+ SELECT @Id = ISNULL(MAX(idxFamMacchine),0) FROM dbo.AnagFamMacchine
+ DBCC CHECKIDENT ('AnagFamMacchine', RESEED, @Id);
+
+ -- cerco se ci sono nuovi impianti e lo carico
+ INSERT INTO dbo.AnagImpianti(codImpianto, nomeImpianto, tipoImpianto, funzDal, funzAl)
+ SELECT 'IT' + dbo.f_padLeft(ROW_NUMBER() OVER (ORDER BY reparto), 2,'0') as codImpianto,
+ reparto as nomeImpianto,
+ 'Reparto' as tipoImpianto,
+ CONVERT(DATETIME, '01-01-'+CAST(MIN(anno) AS NVARCHAR(4)), 110) as funzDal, '9999-12-31' as funzAl
+ FROM tmp_importaMacchine tmp
+ LEFT OUTER JOIN AnagImpianti ai ON tmp.reparto = ai.nomeImpianto
+ WHERE ai.codImpianto IS NULL
+ GROUP BY reparto
+
+ -- carico famiglie nuove e le carico
+ INSERT INTO dbo.AnagFamMacchine
+ SELECT DISTINCT Gruppo FROM dbo.tmp_importaMacchine AS i
+ LEFT JOIN dbo.AnagFamMacchine AS f ON RTRIM(i.Gruppo) = RTRIM(f.nomeFamMacch)
+ WHERE f.nomeFamMacch IS NULL
+
+ -- cerco se ci sono nuove macchine e le carico
+ INSERT INTO dbo.AnagMacchine
+ (codMacchina, nomeMacchina, modello, funzDal, idxImpianto, funzAl, kgPeso, kwConsumo, anno, matricola)
+ SELECT ISNULL(i.idGest, N'--') AS codMacchina,
+ ISNULL(i.denominazione, N'nd') AS nomeMacchina,
+ ISNULL(i.costruttore, N'nd') AS modello,
+ CAST(CAST(ISNULL(i.anno, 1900) AS varchar) + '-01-01 12:00:00' AS datetime) AS funzDal,
+ AnagImpianti.idxImpianto,
+ CAST('9999-12-31' AS datetime) AS fine,
+ 1 AS kg,
+ 1 AS kw,
+ ISNULL(i.anno, 1900) AS anno,
+ i.matricola
+ FROM dbo.tmp_importaMacchine AS i
+ INNER JOIN AnagImpianti ON i.reparto = AnagImpianti.nomeImpianto
+ LEFT JOIN dbo.AnagMacchine AS am ON i.idGest = am.codMacchina
+ WHERE am.codMacchina IS NULL -- solo nuove
+
+ -- carico Macchine2FamMacchine - solo x macchine nuove ( NON faccio update )
+ INSERT INTO dbo.Macchine2FamMacchine
+ SELECT m.idxMacchina, f.idxFamMacchine FROM dbo.AnagMacchine AS m
+ INNER JOIN dbo.tmp_importaMacchine AS i ON m.codMacchina = i.idGest
+ INNER JOIN dbo.AnagFamMacchine AS f ON i.Gruppo = f.nomeFamMacch
+ LEFT JOIN dbo.Macchine2FamMacchine AS m2f ON m.idxMacchina = m2f.idxMacchina
+ WHERE m2f.idxMacchina IS NULL
+
+ /* Test
+ SELECT * FROM tmp_importaMacchine
+ SELECT * FROM AnagFamMacchine
+ SELECT * FROM AnagMacchine
+ SELECT * FROM AnagImpianti
+ SELECT * FROM dbo.Macchine2FamMacchine
+ */
+
+COMMIT
+
+RETURN
diff --git a/Projects/GimDB/dbo/Stored Procedures/sp_clonaImpianto.sql b/Projects/GimDB/dbo/Stored Procedures/sp_clonaImpianto.sql
new file mode 100644
index 0000000..f9f74e9
--- /dev/null
+++ b/Projects/GimDB/dbo/Stored Procedures/sp_clonaImpianto.sql
@@ -0,0 +1,23 @@
+/*************************************
+* STORED PROCEDURE sp_clonaImpianto
+* Clona i dati dell'impianto indicato
+*
+* modif.: S.E.L. - 2009.01.14
+**************************************/
+CREATE PROCEDURE dbo.sp_clonaImpianto
+(
+ @idxImpianto int
+)
+AS
+
+BEGIN tran
+
+ INSERT INTO AnagImpianti
+ (codImpianto, nomeImpianto, tipoImpianto, funzDal, funzAl)
+ SELECT codImpianto + '-clone' AS Expr1, nomeImpianto + '-clone' AS Expr2, tipoImpianto, funzDal, funzAl
+ FROM AnagImpianti AS AnagImpianti_1
+ WHERE (idxImpianto = @idxImpianto)
+
+COMMIT tran
+
+RETURN
diff --git a/Projects/GimDB/dbo/Stored Procedures/sp_clonaMacchina.sql b/Projects/GimDB/dbo/Stored Procedures/sp_clonaMacchina.sql
new file mode 100644
index 0000000..a6cc941
--- /dev/null
+++ b/Projects/GimDB/dbo/Stored Procedures/sp_clonaMacchina.sql
@@ -0,0 +1,23 @@
+/*************************************
+* STORED PROCEDURE sp_clonaMacchina
+* Clona i dati della macchina indicata
+*
+* modif.: S.E.L. - 2009.01.14
+**************************************/
+CREATE PROCEDURE dbo.sp_clonaMacchina
+(
+ @idxMacchina int
+)
+AS
+
+BEGIN tran
+
+ INSERT INTO AnagMacchine
+ (idxImpianto, codMacchina, nomeMacchina, modello, anno, kgPeso, kwConsumo, funzDal, funzAl)
+ SELECT idxImpianto, codMacchina + '-clone' AS Expr1, nomeMacchina + '-clone' AS Expr2, modello, anno, kgPeso, kwConsumo, funzDal, funzAl
+ FROM AnagMacchine AS AnagMacchine_1
+ WHERE (idxMacchina = @idxMacchina)
+
+COMMIT tran
+
+RETURN
diff --git a/Projects/GimDB/dbo/Stored Procedures/sp_elencoIntMTBF_MTTR.sql b/Projects/GimDB/dbo/Stored Procedures/sp_elencoIntMTBF_MTTR.sql
new file mode 100644
index 0000000..5b57b09
--- /dev/null
+++ b/Projects/GimDB/dbo/Stored Procedures/sp_elencoIntMTBF_MTTR.sql
@@ -0,0 +1,49 @@
+
+/*************************************
+* STORED PROCEDURE sp_elencoIntMTBF_MTTR
+* Restituisce elenco degli interventi x fare il calcolo MTBF/MTTR FILTRANDO per:
+* - idxStati
+* - idxImpianto
+* - idxMacchina
+*
+* modif.: S.E.L. - 2010.05.11
+**************************************/
+CREATE PROCEDURE sp_elencoIntMTBF_MTTR
+(
+ @inizio DATETIME,
+ @fine DATETIME,
+ @username VARCHAR(100)
+)
+AS
+
+ -- inizio con il creare la vista che mi serve x selezionare gli interventi filtrati dall'utente (per poterli escludere-includere)
+ WITH ElencoInt AS (SELECT v_elencoIntervFilt.*
+ FROM FiltroImpianti INNER JOIN
+ FiltroMacchine INNER JOIN
+ v_elencoIntervFilt INNER JOIN
+ FiltroStati ON v_elencoIntervFilt.idxStato = FiltroStati.idxStato ON FiltroMacchine.idxMacchina = v_elencoIntervFilt.idxMacchina ON
+ FiltroImpianti.idxImpianto = v_elencoIntervFilt.idxImpianto
+ WHERE (v_elencoIntervFilt.richiesta BETWEEN @inizio AND @fine) AND (FiltroStati.username = @username) AND (FiltroMacchine.username = @username) AND
+ (FiltroImpianti.username = @username))
+
+
+ -- seleziono gli interventi DAVVERO erogati
+ SELECT COUNT(ElencoInt.numIntMtz) AS numInterventi, SUM(ElencoInt.durataMtz) AS totOreMtz,
+ SUM(ElencoInt.durataOff) AS totOreOfficina, ElencoInt.codImpianto, ElencoInt.codMacchina,
+ ElencoInt.nomeImpianto, ElencoInt.nomeMacchina
+ FROM ElencoInt
+ GROUP BY ElencoInt.codImpianto, ElencoInt.codMacchina, ElencoInt.nomeImpianto, ElencoInt.nomeMacchina
+
+ UNION
+
+ -- seleziono gli impianti che NON hanno ricevuto interventi ma comunque scelti dall'utente...
+ SELECT 0 AS numInterventi, 0 AS totOreMtz, 0 AS totOreOfficina, AnagImpianti.codImpianto, AnagMacchine.codMacchina, AnagImpianti.nomeImpianto,
+ AnagMacchine.nomeMacchina
+ FROM FiltroMacchine INNER JOIN
+ AnagMacchine ON FiltroMacchine.idxMacchina = AnagMacchine.idxMacchina INNER JOIN
+ AnagImpianti ON AnagMacchine.idxImpianto = AnagImpianti.idxImpianto LEFT OUTER JOIN
+ ElencoInt ON FiltroMacchine.idxMacchina = ElencoInt.idxMacchina
+ WHERE (ElencoInt.numIntMtz IS NULL)
+ GROUP BY AnagImpianti.codImpianto, AnagMacchine.codMacchina, AnagImpianti.nomeImpianto, AnagMacchine.nomeMacchina
+
+RETURN
diff --git a/Projects/GimDB/dbo/Stored Procedures/sp_insRichiesta.sql b/Projects/GimDB/dbo/Stored Procedures/sp_insRichiesta.sql
new file mode 100644
index 0000000..a389ae5
--- /dev/null
+++ b/Projects/GimDB/dbo/Stored Procedures/sp_insRichiesta.sql
@@ -0,0 +1,42 @@
+
+/*************************************
+* STORED PROCEDURE sp_insRichiesta
+* Inserisce nuova richiesta di intervento
+*
+* modif.: S.E.L. - 2009.02.20
+**************************************/
+CREATE PROCEDURE sp_insRichiesta
+(
+ @richiesta datetime,
+ @dataLav datetime,
+ @turnoLav int,
+ @matr varchar(10),
+ @guasto datetime,
+ @idxAmbito int,
+ @idxPriorita int,
+ @isFermo bit,
+ @idxTipo int,
+ @idxImpianto int,
+ @idxMacchina int,
+ @descrizione varchar(2500),
+ @idxCausale int,
+ @scheduled bit,
+ @numIntMtz int output
+)
+AS
+
+BEGIN tran
+
+ INSERT INTO InterventiMtz
+ (richiesta, dataLav, turnoLav, matr, guasto, idxAmbito, idxPriorita, isFermo, idxTipo, idxImpianto, idxMacchina, descrizione, idxStato, idxCausale, scheduled)
+ VALUES (@richiesta,@dataLav,@turnoLav,@matr,@guasto,@idxAmbito,@idxPriorita,@isFermo,@idxTipo,@idxImpianto,@idxMacchina,@descrizione,
+ 1,@idxCausale,@scheduled)
+
+ /*************************************
+ * salvo idx del nuovo record
+ **************************************/
+ SET @numIntMtz = SCOPE_IDENTITY()
+
+COMMIT tran
+
+RETURN (@numIntMtz)
diff --git a/Projects/GimDB/dbo/Stored Procedures/sp_procStatEv.sql b/Projects/GimDB/dbo/Stored Procedures/sp_procStatEv.sql
new file mode 100644
index 0000000..7036d92
--- /dev/null
+++ b/Projects/GimDB/dbo/Stored Procedures/sp_procStatEv.sql
@@ -0,0 +1,47 @@
+/*************************************
+* STORED PROCEDURE sp_procStatEv
+* esegue la chiamata d processing x stati in base all'attuale stato ed all'evento associato
+*
+* modif.: S.E.L.
+* il: 2009.01.22
+**************************************/
+CREATE PROCEDURE sp_procStatEv
+(
+ @numIntMtz INT,
+ @idxEvento INT,
+ @idxStatoNew INT OUTPUT
+)
+
+AS
+ -- chiamo la query di update, che cerca una riga nella tab transizioni x lo stato e l'evento richiesti e se li trova esegue update del ciclo...
+
+ DECLARE @currIdxStato AS INT
+ DECLARE @procedere AS INT
+
+BEGIN TRAN
+ -- calcolo stato corrente del ciclo...
+ SET @currIdxStato = ISNULL((SELECT idxStato
+ FROM InterventiMtz
+ WHERE (numIntMtz = @numIntMtz)),0)
+
+ -- cerco transizione da stato ed evento associati...
+ SET @procedere = ISNULL((SELECT COUNT(*) FROM Tra_Ev2Stati WHERE idxEvento=@idxEvento AND idxStato=@currIdxStato),0)
+
+ -- se trovo eseguo transizione...
+ IF(@procedere >0)
+ BEGIN
+ UPDATE InterventiMtz
+ SET idxStato = Tra_Ev2Stati.nextIdxStato
+ FROM InterventiMtz INNER JOIN
+ Tra_Ev2Stati ON InterventiMtz.idxStato = Tra_Ev2Stati.idxStato
+ WHERE (InterventiMtz.numIntMtz = @numIntMtz) AND (Tra_Ev2Stati.idxEvento = @idxEvento)
+ END
+
+COMMIT TRAN
+
+ -- calcolo lo stato nuovo...
+ SET @idxStatoNew = ISNULL((SELECT idxStato
+ FROM InterventiMtz
+ WHERE (numIntMtz = @numIntMtz)),0)
+
+RETURN (@idxStatoNew)
diff --git a/Projects/GimDB/dbo/Stored Procedures/sp_setPresaInCarico.sql b/Projects/GimDB/dbo/Stored Procedures/sp_setPresaInCarico.sql
new file mode 100644
index 0000000..3ef9fc6
--- /dev/null
+++ b/Projects/GimDB/dbo/Stored Procedures/sp_setPresaInCarico.sql
@@ -0,0 +1,24 @@
+/*************************************
+* STORED PROCEDURE sp_setPresaInCarico
+* indica la richiesta come presa in carico con data/ora attuale del server
+*
+* modif.: S.E.L. - 2009.01.22
+**************************************/
+CREATE PROCEDURE dbo.sp_setPresaInCarico
+(
+ @numIntMtz INT,
+ @idxStatoNew INT OUTPUT
+)
+AS
+
+BEGIN tran
+ -- inserisco data presa in carico
+ UPDATE InterventiMtz
+ SET presaInCarico = GETDATE()
+ WHERE (numIntMtz = @numIntMtz)
+
+ -- aggiorno da machcian a stati...
+ exec sp_procStatEv @numIntMtz, 1, @idxStatoNew
+COMMIT tran
+
+RETURN (@idxStatoNew)
diff --git a/Projects/GimDB/dbo/Stored Procedures/sp_spostaMacchina.sql b/Projects/GimDB/dbo/Stored Procedures/sp_spostaMacchina.sql
new file mode 100644
index 0000000..fc50124
--- /dev/null
+++ b/Projects/GimDB/dbo/Stored Procedures/sp_spostaMacchina.sql
@@ -0,0 +1,18 @@
+/*************************************
+* STORED PROCEDURE sp_spostaMacchina
+* Sposta la macchina all'impianto indicato
+*
+* modif.: S.E.L. - 2009.01.14
+**************************************/
+CREATE PROCEDURE dbo.sp_spostaMacchina
+(
+ @idxMacchina int,
+ @idxImpiantoTo int
+)
+AS
+
+UPDATE AnagMacchine
+SET idxImpianto = @idxImpiantoTo
+WHERE (idxMacchina = @idxMacchina)
+
+RETURN
diff --git a/Projects/GimDB/dbo/Stored Procedures/sp_updateIntervento.sql b/Projects/GimDB/dbo/Stored Procedures/sp_updateIntervento.sql
new file mode 100644
index 0000000..6f5b33d
--- /dev/null
+++ b/Projects/GimDB/dbo/Stored Procedures/sp_updateIntervento.sql
@@ -0,0 +1,22 @@
+/*************************************
+* STORED PROCEDURE sp_updateIntervento
+* aggiorna i dati dell'intervento compilati dalla manutenzione
+*
+* modif.: S.E.L. - 2009.01.28
+**************************************/
+CREATE PROCEDURE dbo.sp_updateIntervento
+(
+ @Original_numIntMtz INT,
+ @idxStato INT,
+ @inizioIntervento DATETIME,
+ @fineIntervento DATETIME,
+ @isPreventivabile BIT,
+ @descrizioneIntervento NVARCHAR(2500)
+)
+AS
+
+UPDATE InterventiMtz
+SET inizioIntervento = @inizioIntervento, fineIntervento = @fineIntervento, descrizioneIntervento = @descrizioneIntervento, isPreventivabile = @isPreventivabile, idxStato = @idxStato
+WHERE (numIntMtz = @Original_numIntMtz)
+
+RETURN
diff --git a/Projects/GimDB/dbo/Stored Procedures/sp_updateInterventoFull.sql b/Projects/GimDB/dbo/Stored Procedures/sp_updateInterventoFull.sql
new file mode 100644
index 0000000..05c5064
--- /dev/null
+++ b/Projects/GimDB/dbo/Stored Procedures/sp_updateInterventoFull.sql
@@ -0,0 +1,35 @@
+/*************************************
+* STORED PROCEDURE sp_updateInterventoFull
+* aggiorna TUTTI i dati dell'intervento
+*
+* modif.: S.E.L. - 2009.02.20
+**************************************/
+CREATE PROCEDURE sp_updateInterventoFull
+(
+ @Original_numIntMtz INT,
+ @idxStato INT,
+ @inizioIntervento DATETIME,
+ @fineIntervento DATETIME,
+ @isPreventivabile BIT,
+ @descrizioneIntervento NVARCHAR(2500),
+ @matr NVARCHAR(50),
+ @guasto DATETIME,
+ @isFermo BIT,
+ @idxImpianto INT,
+ @idxMacchina INT,
+ @idxAmbito INT,
+ @idxPriorita INT,
+ @descrizione NVARCHAR(2500),
+ @idxTipo INT,
+ @idxCausale int,
+ @presaInCarico DATETIME
+)
+AS
+
+UPDATE InterventiMtz
+SET inizioIntervento = @inizioIntervento, fineIntervento = @fineIntervento, descrizioneIntervento = @descrizioneIntervento, isPreventivabile = @isPreventivabile,
+ idxStato = @idxStato, matr = @matr, guasto = @guasto, idxAmbito = @idxAmbito, idxPriorita = @idxPriorita, isFermo = @isFermo, idxTipo = @idxTipo,
+ idxImpianto = @idxImpianto, idxMacchina = @idxMacchina, descrizione = @descrizione, presaInCarico = @presaInCarico, idxCausale = @idxCausale
+WHERE (numIntMtz = @Original_numIntMtz)
+
+RETURN
diff --git a/Projects/GimDB/dbo/Stored Procedures/spt_AD_delete.sql b/Projects/GimDB/dbo/Stored Procedures/spt_AD_delete.sql
new file mode 100644
index 0000000..573e339
--- /dev/null
+++ b/Projects/GimDB/dbo/Stored Procedures/spt_AD_delete.sql
@@ -0,0 +1,40 @@
+/*************************************
+* STORED PROCEDURE spt_AD_delete
+* elimina la macchina (da famiglia macchina e anagMacchina) SE non ah record associati
+*
+* modif.: S.E.L. - 2013.12.06
+**************************************/
+CREATE PROCEDURE spt_AD_delete
+(
+ @Original_idxMacchina int
+)
+AS
+
+BEGIN tran
+
+
+ DECLARE @trovati INT = 0
+ -- controllo se ha eventi associati ...
+ SELECT @trovati = @trovati + ISNULL(COUNT(*),0) FROM InterventiMtz WHERE idxMacchina = @Original_idxMacchina
+ -- controllo se ha eventi schedulati ...
+ SELECT @trovati = @trovati + ISNULL(COUNT(*),0) FROM MtzProgPending WHERE idxMacchina = @Original_idxMacchina
+
+ -- elimino solo se ZERO elementia ssociati..
+
+ IF (@trovati = 0)
+ BEGIN
+
+ DELETE
+ FROM Macchine2FamMacchine
+ WHERE idxMacchina = @Original_idxMacchina
+
+ DELETE
+ FROM AnagMacchine
+ WHERE idxMacchina = @Original_idxMacchina
+
+ END
+
+
+COMMIT tran
+
+RETURN
diff --git a/Projects/GimDB/dbo/Stored Procedures/stp_ATR_delete.sql b/Projects/GimDB/dbo/Stored Procedures/stp_ATR_delete.sql
new file mode 100644
index 0000000..306beaa
--- /dev/null
+++ b/Projects/GimDB/dbo/Stored Procedures/stp_ATR_delete.sql
@@ -0,0 +1,19 @@
+/*************************************
+* STORED PROCEDURE stp_ATR_delete
+*
+* elimina record anagrafica tipo risorse
+*
+* mod : 17/03/2015
+* aut : S.E. Locatelli
+**************************************/
+CREATE PROCEDURE stp_ATR_delete
+(
+ @Original_CodRisorsa NVARCHAR(10)
+)
+AS
+
+DELETE
+FROM AnagTipoRisorsa
+WHERE CodRisorsa = @Original_CodRisorsa
+
+RETURN
diff --git a/Projects/GimDB/dbo/Stored Procedures/stp_ATR_insert.sql b/Projects/GimDB/dbo/Stored Procedures/stp_ATR_insert.sql
new file mode 100644
index 0000000..762c87d
--- /dev/null
+++ b/Projects/GimDB/dbo/Stored Procedures/stp_ATR_insert.sql
@@ -0,0 +1,22 @@
+/*************************************
+* STORED PROCEDURE stp_ATR_insert
+*
+* crea record anagrafica tipo risorse
+*
+* mod : 17/03/2015
+* aut : S.E. Locatelli
+**************************************/
+CREATE PROCEDURE stp_ATR_insert
+(
+ @CodRisorsa NVARCHAR(10),
+ @UM NVARCHAR(10),
+ @DescrRisorsa NVARCHAR(50),
+ @Valuta NVARCHAR(5)
+)
+AS
+
+INSERT INTO AnagTipoRisorsa (CodRisorsa, UM, DescrRisorsa, Valuta)
+VALUES (@CodRisorsa, @UM, @DescrRisorsa, @Valuta)
+
+
+RETURN
\ No newline at end of file
diff --git a/Projects/GimDB/dbo/Stored Procedures/stp_ATR_update.sql b/Projects/GimDB/dbo/Stored Procedures/stp_ATR_update.sql
new file mode 100644
index 0000000..6240dd6
--- /dev/null
+++ b/Projects/GimDB/dbo/Stored Procedures/stp_ATR_update.sql
@@ -0,0 +1,26 @@
+/*************************************
+* STORED PROCEDURE stp_ATR_update
+*
+* aggiorna record anagrafica tipo risorse
+*
+* mod : 17/03/2015
+* aut : S.E. Locatelli
+**************************************/
+CREATE PROCEDURE stp_ATR_update
+(
+ @Original_CodRisorsa NVARCHAR(10),
+ @CodRisorsa NVARCHAR(10),
+ @UM NVARCHAR(10),
+ @DescrRisorsa NVARCHAR(50),
+ @Valuta NVARCHAR(5)
+)
+AS
+
+UPDATE AnagTipoRisorsa
+ SET CodRisorsa = @CodRisorsa
+ , UM = @UM
+ , DescrRisorsa = @DescrRisorsa
+ , Valuta = @Valuta
+WHERE CodRisorsa = @Original_CodRisorsa
+
+RETURN
diff --git a/Projects/GimDB/dbo/Stored Procedures/stp_ImpRis_delete.sql b/Projects/GimDB/dbo/Stored Procedures/stp_ImpRis_delete.sql
new file mode 100644
index 0000000..8a11af7
--- /dev/null
+++ b/Projects/GimDB/dbo/Stored Procedures/stp_ImpRis_delete.sql
@@ -0,0 +1,19 @@
+/*************************************
+* STORED PROCEDURE stp_ImpRis_delete
+*
+* elimina record impiego risorse
+*
+* mod : 17/03/2015
+* aut : S.E. Locatelli
+**************************************/
+create PROCEDURE stp_ImpRis_delete
+(
+ @Original_idxImpiego INT
+)
+AS
+
+DELETE
+FROM ImpiegoRisorse
+WHERE idxImpiego = @Original_idxImpiego
+
+RETURN
diff --git a/Projects/GimDB/dbo/Stored Procedures/stp_ImpRis_getByNumMtz.sql b/Projects/GimDB/dbo/Stored Procedures/stp_ImpRis_getByNumMtz.sql
new file mode 100644
index 0000000..3d22957
--- /dev/null
+++ b/Projects/GimDB/dbo/Stored Procedures/stp_ImpRis_getByNumMtz.sql
@@ -0,0 +1,23 @@
+/*************************************
+* STORED PROCEDURE stp_ImpRis_getByNumMtz
+*
+* elenco record impiego risorse x intervento
+*
+* mod : 18/03/2015
+* aut : S.E. Locatelli
+**************************************/
+create PROCEDURE stp_ImpRis_getByNumMtz
+(
+ @numIntMtz INT
+)
+AS
+
+SELECT *
+FROM ImpiegoRisorse
+WHERE numIntMtz = @numIntMtz
+
+RETURN
+
+
+
+
diff --git a/Projects/GimDB/dbo/Stored Procedures/stp_ImpRis_insert.sql b/Projects/GimDB/dbo/Stored Procedures/stp_ImpRis_insert.sql
new file mode 100644
index 0000000..ee08b60
--- /dev/null
+++ b/Projects/GimDB/dbo/Stored Procedures/stp_ImpRis_insert.sql
@@ -0,0 +1,23 @@
+/*************************************
+* STORED PROCEDURE stp_ImpRis_insert
+*
+* insert record impiego risorse
+*
+* mod : 17/03/2015
+* aut : S.E. Locatelli
+**************************************/
+CREATE PROCEDURE stp_ImpRis_insert
+(
+ @CodRisorsa NVARCHAR(10)
+ , @numIntMtz INT
+ , @QtaRisorsa DECIMAL(18, 6)
+ , @CostoUnit DECIMAL(18, 6)
+ , @Note NVARCHAR(MAX)
+)
+AS
+
+INSERT INTO ImpiegoRisorse(CodRisorsa, numIntMtz, QtaRisorsa, CostoUnit, Note)
+VALUES (@CodRisorsa, @numIntMtz, @QtaRisorsa, @CostoUnit, @Note)
+
+
+RETURN
diff --git a/Projects/GimDB/dbo/Stored Procedures/stp_ImpRis_update.sql b/Projects/GimDB/dbo/Stored Procedures/stp_ImpRis_update.sql
new file mode 100644
index 0000000..a5d6445
--- /dev/null
+++ b/Projects/GimDB/dbo/Stored Procedures/stp_ImpRis_update.sql
@@ -0,0 +1,28 @@
+/*************************************
+* STORED PROCEDURE stp_ImpRis_update
+*
+* update record impiego risorse
+*
+* mod : 17/03/2015
+* aut : S.E. Locatelli
+**************************************/
+CREATE PROCEDURE stp_ImpRis_update
+(
+ @Original_idxImpiego INT
+ , @CodRisorsa NVARCHAR(10)
+ , @numIntMtz INT
+ , @QtaRisorsa DECIMAL(18, 6)
+ , @CostoUnit DECIMAL(18, 6)
+ , @Note NVARCHAR(MAX)
+)
+AS
+
+UPDATE ImpiegoRisorse
+ SET CodRisorsa = @CodRisorsa
+ , numIntMtz = @numIntMtz
+ , QtaRisorsa = @QtaRisorsa
+ , CostoUnit = @CostoUnit
+ , Note = @Note
+WHERE idxImpiego = @Original_idxImpiego
+
+RETURN
diff --git a/Projects/GimDB/dbo/Stored Procedures/stp_MtzProg_delete.sql b/Projects/GimDB/dbo/Stored Procedures/stp_MtzProg_delete.sql
new file mode 100644
index 0000000..0d447aa
--- /dev/null
+++ b/Projects/GimDB/dbo/Stored Procedures/stp_MtzProg_delete.sql
@@ -0,0 +1,17 @@
+/*********************************************************************************
+* STORED stp_MtzProg_delete
+*
+* delete riga MtzProg
+*
+**********************************************************************************/
+create PROCEDURE dbo.stp_MtzProg_delete
+(
+ @Original_idxIntPro INT
+)
+AS
+
+DELETE
+FROM MtzProgrammata
+WHERE idxIntPro = @Original_idxIntPro
+
+RETURN
\ No newline at end of file
diff --git a/Projects/GimDB/dbo/Stored Procedures/stp_MtzProg_duplica.sql b/Projects/GimDB/dbo/Stored Procedures/stp_MtzProg_duplica.sql
new file mode 100644
index 0000000..ab4940d
--- /dev/null
+++ b/Projects/GimDB/dbo/Stored Procedures/stp_MtzProg_duplica.sql
@@ -0,0 +1,31 @@
+-- =============================================
+-- Author: S.E.Locatelli
+-- Create date: 2012-08-24
+-- Description: duplicazione interventi Mtz programmata tra macchine, con possibilità CANCELLAZIONE vecchi
+-- =============================================
+create PROCEDURE [dbo].[stp_MtzProg_duplica]
+(
+ @idxMacchinaFrom INT = 0,
+ @idxMacchinaTo INT = 0,
+ @mantainOld BIT = 0
+)
+AS
+BEGIN
+ SET NOCOUNT ON;
+
+ BEGIN tran
+
+ -- in primis cancello vecchi interventi programmati SE @mantainOld = 0
+ IF (@mantainOld=0)
+ BEGIN
+ DELETE FROM MtzProgrammata WHERE idxMacchina = @idxMacchinaTo
+ END
+
+ -- poi inserisco nuovi interventi
+ INSERT INTO MtzProgrammata(idxMacchina, inizio, codFrequenza, cadenza, descrizione, idxPriorita, isFermo, idxTipo)
+ SELECT @idxMacchinaTo AS idxMacchina, inizio, codFrequenza, cadenza, descrizione, idxPriorita, isFermo, idxTipo
+ FROM MtzProgrammata
+ WHERE idxMacchina = @idxMacchinaFrom
+
+ COMMIT tran
+END
diff --git a/Projects/GimDB/dbo/Stored Procedures/stp_MtzProg_getByKey.sql b/Projects/GimDB/dbo/Stored Procedures/stp_MtzProg_getByKey.sql
new file mode 100644
index 0000000..22ba03d
--- /dev/null
+++ b/Projects/GimDB/dbo/Stored Procedures/stp_MtzProg_getByKey.sql
@@ -0,0 +1,17 @@
+/*********************************************************************************
+* STORED stp_MtzProg_getByKey
+*
+* restituisce riga MtzProg
+*
+**********************************************************************************/
+CREATE PROCEDURE dbo.stp_MtzProg_getByKey
+(
+ @idxIntPro INT
+)
+AS
+
+SELECT *
+FROM MtzProgrammata
+WHERE idxIntPro = @idxIntPro
+
+RETURN
\ No newline at end of file
diff --git a/Projects/GimDB/dbo/Stored Procedures/stp_MtzProg_insert.sql b/Projects/GimDB/dbo/Stored Procedures/stp_MtzProg_insert.sql
new file mode 100644
index 0000000..f1047cf
--- /dev/null
+++ b/Projects/GimDB/dbo/Stored Procedures/stp_MtzProg_insert.sql
@@ -0,0 +1,24 @@
+/*********************************************************************************
+* STORED stp_MtzProg_insert
+*
+* insert riga MtzProg
+*
+**********************************************************************************/
+create PROCEDURE dbo.stp_MtzProg_insert
+(
+ @idxMacchina INT,
+ @inizio DATETIME,
+ @codFrequenza NCHAR(2),
+ @cadenza INT,
+ @descrizione NVARCHAR(2500),
+ @idxPriorita INT,
+ @isFermo BIT,
+ @idxTipo INT
+)
+AS
+
+INSERT INTO MtzProgrammata
+ (idxMacchina, inizio, codFrequenza, cadenza, descrizione, idxPriorita, isFermo, idxTipo)
+VALUES (@idxMacchina,@inizio,@codFrequenza,@cadenza,@descrizione,@idxPriorita,@isFermo,@idxTipo)
+
+RETURN
\ No newline at end of file
diff --git a/Projects/GimDB/dbo/Stored Procedures/stp_MtzProg_update.sql b/Projects/GimDB/dbo/Stored Procedures/stp_MtzProg_update.sql
new file mode 100644
index 0000000..e910adf
--- /dev/null
+++ b/Projects/GimDB/dbo/Stored Procedures/stp_MtzProg_update.sql
@@ -0,0 +1,30 @@
+/*********************************************************************************
+* STORED stp_MtzProg_update
+*
+* aggiorna riga MtzProg
+*
+**********************************************************************************/
+CREATE PROCEDURE dbo.stp_MtzProg_update
+(
+ @idxIntPro INT,
+ @inizio DATETIME,
+ @codFrequenza NCHAR(2),
+ @cadenza INT,
+ @descrizione NVARCHAR(2500),
+ @idxPriorita INT,
+ @isFermo BIT,
+ @idxTipo INT
+)
+AS
+
+UPDATE MtzProgrammata
+SET inizio = @inizio,
+ codFrequenza= @codFrequenza,
+ cadenza = @cadenza,
+ descrizione = @descrizione,
+ idxPriorita = @idxPriorita,
+ isFermo = @isFermo,
+ idxTipo = @idxTipo
+WHERE idxIntPro = @idxIntPro
+
+RETURN
\ No newline at end of file
diff --git a/Projects/GimDB/dbo/Stored Procedures/stp_elencoIntByIntervDate.sql b/Projects/GimDB/dbo/Stored Procedures/stp_elencoIntByIntervDate.sql
new file mode 100644
index 0000000..58934c6
--- /dev/null
+++ b/Projects/GimDB/dbo/Stored Procedures/stp_elencoIntByIntervDate.sql
@@ -0,0 +1,20 @@
+
+/*************************************
+* STORED PROCEDURE stp_elencoIntByIntervDate
+* Recupera elenco interventi a partire dalle date inizio/fine di ricerca
+*
+* modif.: S.E.L. - 2010.01.25
+**************************************/
+create PROCEDURE stp_elencoIntByIntervDate
+(
+ @inizio DATETIME,
+ @fine DATETIME
+)
+AS
+
+ SELECT codImpianto, codMacchina, descrCausale, descrizione, descrizioneIntervento, durataMtz, durataOff, fineIntervento, guasto, idxImpianto, idxMacchina, idxStato,
+ inizioIntervento, minErogati, nomeImpianto, nomeMacchina, numIntMtz, richiesta, isFermo, scheduled
+ FROM v_elencoIntervFilt
+ WHERE (richiesta BETWEEN @inizio AND @fine)
+
+RETURN
diff --git a/Projects/GimDB/dbo/Stored Procedures/stp_elencoIntByIntervDateUserFilt.sql b/Projects/GimDB/dbo/Stored Procedures/stp_elencoIntByIntervDateUserFilt.sql
new file mode 100644
index 0000000..af86ece
--- /dev/null
+++ b/Projects/GimDB/dbo/Stored Procedures/stp_elencoIntByIntervDateUserFilt.sql
@@ -0,0 +1,29 @@
+
+/*************************************
+* STORED PROCEDURE stp_elencoIntByIntervDateUserFilt
+* Recupera elenco interventi a partire dalle date inizio/fine di ricerca e dall'username ed i relativi filtri di ricerca salvati
+*
+* modif.: S.E.L. - 2010.01.25
+**************************************/
+create PROCEDURE stp_elencoIntByIntervDateUserFilt
+(
+ @inizio DATETIME,
+ @fine DATETIME,
+ @username VARCHAR(50)
+)
+AS
+
+ SELECT v_elencoIntervFilt.codImpianto, v_elencoIntervFilt.codMacchina, v_elencoIntervFilt.descrCausale, v_elencoIntervFilt.descrizione,
+ v_elencoIntervFilt.descrizioneIntervento, v_elencoIntervFilt.durataMtz, v_elencoIntervFilt.durataOff, v_elencoIntervFilt.fineIntervento, v_elencoIntervFilt.guasto,
+ v_elencoIntervFilt.idxImpianto, v_elencoIntervFilt.idxMacchina, v_elencoIntervFilt.idxStato, v_elencoIntervFilt.inizioIntervento, v_elencoIntervFilt.minErogati,
+ v_elencoIntervFilt.nomeImpianto, v_elencoIntervFilt.nomeMacchina, v_elencoIntervFilt.numIntMtz, v_elencoIntervFilt.richiesta, v_elencoIntervFilt.isFermo,
+ v_elencoIntervFilt.scheduled
+ FROM v_elencoIntervFilt INNER JOIN
+ FiltroImpianti ON v_elencoIntervFilt.idxImpianto = FiltroImpianti.idxImpianto INNER JOIN
+ FiltroMacchine ON v_elencoIntervFilt.idxMacchina = FiltroMacchine.idxMacchina INNER JOIN
+ FiltroStati ON v_elencoIntervFilt.idxStato = FiltroStati.idxStato
+ WHERE (v_elencoIntervFilt.richiesta BETWEEN @inizio AND @fine) AND (FiltroStati.username = @username) AND (FiltroMacchine.username = @username) AND
+ (FiltroImpianti.username = @username)
+
+
+RETURN
diff --git a/Projects/GimDB/dbo/Stored Procedures/stp_elencoIntByIntervDateUserFiltExtended.sql b/Projects/GimDB/dbo/Stored Procedures/stp_elencoIntByIntervDateUserFiltExtended.sql
new file mode 100644
index 0000000..3fa3e66
--- /dev/null
+++ b/Projects/GimDB/dbo/Stored Procedures/stp_elencoIntByIntervDateUserFiltExtended.sql
@@ -0,0 +1,68 @@
+
+
+
+/*************************************
+* STORED PROCEDURE stp_elencoIntByIntervDateUserFiltExtended
+* Recupera elenco interventi a partire dalle date inizio/fine di ricerca e dall'username ed i relativi filtri di ricerca salvati
+*
+* Versione estesa x stampa con Totale Importo Materiali e Ore Operatori Esterni
+* NOTE : Le Ore Operatori Esterni sono TUTTE quelle con UM = MIN ( minuti )
+*
+* Steamware
+* modif. 2015.10.29
+**************************************/
+CREATE PROCEDURE [dbo].[stp_elencoIntByIntervDateUserFiltExtended]
+(
+ @inizio DATETIME
+ ,@fine DATETIME
+ ,@username VARCHAR(50)
+)
+AS
+
+SELECT
+ IntervFilt.codImpianto
+ ,IntervFilt.codMacchina
+ ,IntervFilt.descrCausale
+ ,IntervFilt.descrizione
+ ,IntervFilt.descrizioneIntervento
+ ,IntervFilt.durataMtz
+ ,IntervFilt.durataOff
+ ,IntervFilt.fineIntervento
+ ,IntervFilt.guasto
+ ,IntervFilt.idxImpianto
+ ,IntervFilt.idxMacchina
+ ,IntervFilt.idxStato
+ ,IntervFilt.inizioIntervento
+ ,IntervFilt.minErogati
+ ,IntervFilt.nomeImpianto
+ ,IntervFilt.nomeMacchina
+ ,IntervFilt.numIntMtz
+ ,IntervFilt.richiesta
+ ,IntervFilt.isFermo
+ ,IntervFilt.scheduled
+ -- estraggo TOTALE importo della Risorsa MAT ( Materiali )
+ ,( SELECT ISNULL(SUM(TotImport),0) FROM dbo.ImpiegoRisorse AS RisMAT
+ WHERE CodRisorsa = 'MAT' AND RisMAT.numIntMtz = IntervFilt.numIntMtz ) AS totImpMat
+
+ -- estraggo TOTALE Quantità della ORE operatori Esterni - presupposto che tutte causali con UM = ORE siano di opearori esterni
+ ,( SELECT ISNULL(SUM(QtaRisorsa),0) FROM dbo.ImpiegoRisorse AS RisMAT
+ INNER JOIN dbo.AnagTipoRisorsa AS AnagRis
+ ON RisMAT.CodRisorsa = AnagRis.CodRisorsa
+ WHERE AnagRis.UM = 'MIN' AND RisMAT.numIntMtz = IntervFilt.numIntMtz ) / 60 AS totQtaHR
+
+FROM v_elencoIntervFilt AS IntervFilt
+INNER JOIN FiltroImpianti
+ ON IntervFilt.idxImpianto = FiltroImpianti.idxImpianto
+INNER JOIN FiltroMacchine
+ ON IntervFilt.idxMacchina = FiltroMacchine.idxMacchina
+INNER JOIN FiltroStati
+ ON IntervFilt.idxStato = FiltroStati.idxStato
+
+WHERE (IntervFilt.richiesta BETWEEN @inizio AND @fine)
+ AND (FiltroStati.username = @username)
+ AND (FiltroMacchine.username = @username)
+ AND (FiltroImpianti.username = @username)
+
+RETURN
+
+
diff --git a/Projects/GimDB/dbo/Stored Procedures/stp_elencoIntByIntervDateUserFilt_fermaPrev.sql b/Projects/GimDB/dbo/Stored Procedures/stp_elencoIntByIntervDateUserFilt_fermaPrev.sql
new file mode 100644
index 0000000..a5a6f38
--- /dev/null
+++ b/Projects/GimDB/dbo/Stored Procedures/stp_elencoIntByIntervDateUserFilt_fermaPrev.sql
@@ -0,0 +1,33 @@
+
+/*************************************
+* STORED PROCEDURE stp_elencoIntByIntervDateUserFilt
+* Recupera elenco interventi a partire dalle date inizio/fine di ricerca e dall'username ed i relativi filtri di ricerca salvati
+* e con rispetto filtro x int a macchian ferma o di mtz preventiva
+*
+* modif.: S.E.L. - 2010.01.25
+**************************************/
+create PROCEDURE stp_elencoIntByIntervDateUserFilt_fermaPrev
+(
+ @inizio DATETIME,
+ @fine DATETIME,
+ @username VARCHAR(50),
+ @soloMaccFerma BIT,
+ @includiPreventiva BIT
+)
+AS
+
+ SELECT v_elencoIntervFilt.codImpianto, v_elencoIntervFilt.codMacchina, v_elencoIntervFilt.descrCausale, v_elencoIntervFilt.descrizione,
+ v_elencoIntervFilt.descrizioneIntervento, v_elencoIntervFilt.durataMtz, v_elencoIntervFilt.durataOff, v_elencoIntervFilt.fineIntervento,
+ v_elencoIntervFilt.guasto, v_elencoIntervFilt.idxImpianto, v_elencoIntervFilt.idxMacchina, v_elencoIntervFilt.idxStato,
+ v_elencoIntervFilt.inizioIntervento, v_elencoIntervFilt.minErogati, v_elencoIntervFilt.nomeImpianto, v_elencoIntervFilt.nomeMacchina,
+ v_elencoIntervFilt.numIntMtz, v_elencoIntervFilt.richiesta, v_elencoIntervFilt.isFermo, v_elencoIntervFilt.scheduled
+ FROM v_elencoIntervFilt INNER JOIN
+ FiltroImpianti ON v_elencoIntervFilt.idxImpianto = FiltroImpianti.idxImpianto INNER JOIN
+ FiltroMacchine ON v_elencoIntervFilt.idxMacchina = FiltroMacchine.idxMacchina INNER JOIN
+ FiltroStati ON v_elencoIntervFilt.idxStato = FiltroStati.idxStato
+ WHERE (v_elencoIntervFilt.richiesta BETWEEN @inizio AND @fine) AND (FiltroStati.username = @username)
+ AND (FiltroMacchine.username = @username) AND (FiltroImpianti.username = @username)
+ AND (v_elencoIntervFilt.isFermo = case @soloMaccFerma when 1 then 1 else v_elencoIntervFilt.isFermo end)
+ AND (v_elencoIntervFilt.scheduled = case @includiPreventiva when 0 then 0 else v_elencoIntervFilt.scheduled end)
+
+RETURN
diff --git a/Projects/GimDB/dbo/Stored Procedures/stp_elencoIntMTBF_MTTR_fermaPrev.sql b/Projects/GimDB/dbo/Stored Procedures/stp_elencoIntMTBF_MTTR_fermaPrev.sql
new file mode 100644
index 0000000..95a8490
--- /dev/null
+++ b/Projects/GimDB/dbo/Stored Procedures/stp_elencoIntMTBF_MTTR_fermaPrev.sql
@@ -0,0 +1,56 @@
+
+/*************************************
+* STORED PROCEDURE stp_elencoIntMTBF_MTTR_fermaPrev
+* Restituisce elenco degli interventi x fare il calcolo MTBF/MTTR FILTRANDO per:
+* - idxStati
+* - idxImpianto
+* - idxMacchina
+* - solo ferma
+* - inclusione preventiva
+*
+* modif.: S.E.L. - 2010.05.11
+**************************************/
+CREATE PROCEDURE stp_elencoIntMTBF_MTTR_fermaPrev
+(
+ @inizio DATETIME,
+ @fine DATETIME,
+ @username VARCHAR(100),
+ @soloMaccFerma BIT,
+ @includiPreventiva BIT
+)
+AS
+
+
+ -- inizio con il creare la vista che mi serve x selezionare gli interventi filtrati dall'utente (per poterli escludere-includere)
+ WITH ElencoInt AS (
+ SELECT v_elencoIntervFilt.*
+ FROM FiltroImpianti INNER JOIN FiltroMacchine INNER JOIN v_elencoIntervFilt INNER JOIN
+ FiltroStati ON v_elencoIntervFilt.idxStato = FiltroStati.idxStato ON FiltroMacchine.idxMacchina = v_elencoIntervFilt.idxMacchina
+ ON FiltroImpianti.idxImpianto = v_elencoIntervFilt.idxImpianto
+ WHERE (v_elencoIntervFilt.richiesta BETWEEN @inizio AND @fine) AND (FiltroStati.username = @username)
+ AND (FiltroMacchine.username = @username) AND (FiltroImpianti.username = @username)
+ AND (v_elencoIntervFilt.isFermo = CASE @soloMaccFerma WHEN 1 THEN 1 ELSE v_elencoIntervFilt.isFermo END)
+ AND (v_elencoIntervFilt.scheduled = CASE @includiPreventiva WHEN 0 THEN 0 ELSE v_elencoIntervFilt.scheduled END))
+
+
+ -- seleziono gli interventi DAVVERO erogati
+ SELECT COUNT(ElencoInt.numIntMtz) AS numInterventi, SUM(ElencoInt.durataMtz) AS totOreMtz,
+ SUM(ElencoInt.durataOff) AS totOreOfficina, ElencoInt.codImpianto, ElencoInt.codMacchina,
+ ElencoInt.nomeImpianto, ElencoInt.nomeMacchina
+ FROM ElencoInt
+ GROUP BY ElencoInt.codImpianto, ElencoInt.codMacchina, ElencoInt.nomeImpianto, ElencoInt.nomeMacchina
+
+ UNION
+
+ -- seleziono gli impianti che NON hanno ricevuto interventi ma comunque scelti dall'utente...
+ SELECT 0 AS numInterventi, 0 AS totOreMtz, 0 AS totOreOfficina, AnagImpianti.codImpianto, AnagMacchine.codMacchina, AnagImpianti.nomeImpianto,
+ AnagMacchine.nomeMacchina
+ FROM FiltroMacchine INNER JOIN
+ AnagMacchine ON FiltroMacchine.idxMacchina = AnagMacchine.idxMacchina INNER JOIN
+ AnagImpianti ON AnagMacchine.idxImpianto = AnagImpianti.idxImpianto LEFT OUTER JOIN
+ ElencoInt ON FiltroMacchine.idxMacchina = ElencoInt.idxMacchina
+ WHERE (ElencoInt.numIntMtz IS NULL)
+ GROUP BY AnagImpianti.codImpianto, AnagMacchine.codMacchina, AnagImpianti.nomeImpianto, AnagMacchine.nomeMacchina
+
+
+RETURN
diff --git a/Projects/GimDB/dbo/Stored Procedures/stp_insNewLemma.sql b/Projects/GimDB/dbo/Stored Procedures/stp_insNewLemma.sql
new file mode 100644
index 0000000..c83ac9b
--- /dev/null
+++ b/Projects/GimDB/dbo/Stored Procedures/stp_insNewLemma.sql
@@ -0,0 +1,30 @@
+/*************************************
+* STORED PROCEDURE stp_insNewLemma
+*
+* elimina record anagrafica classe prodotto
+*
+* mod : 14/05/2012
+* aut : S.E. Locatelli
+**************************************/
+create PROCEDURE stp_insNewLemma
+(
+ @lemma NVARCHAR(50),
+ @traduzione NVARCHAR(500)
+)
+AS
+
+-- elimino se c'era già...
+DELETE
+FROM Vocabolario
+WHERE lemma = @lemma
+
+-- inserisco x tutte le lingue attive...
+INSERT INTO Vocabolario
+SELECT lingua, @lemma, @traduzione
+FROM Lingue
+
+SELECT *
+FROM Vocabolario
+WHERE lemma = @lemma
+
+RETURN
diff --git a/Projects/GimDB/dbo/Stored Procedures/stp_listValues_getByTable.sql b/Projects/GimDB/dbo/Stored Procedures/stp_listValues_getByTable.sql
new file mode 100644
index 0000000..7682d44
--- /dev/null
+++ b/Projects/GimDB/dbo/Stored Procedures/stp_listValues_getByTable.sql
@@ -0,0 +1,22 @@
+
+/***************************************
+* STORED stp_listValues_getByTable
+*
+* ottiene elenco campi data Table
+*
+* Steamware, S.E.L.
+* mod: 2014.08.04
+*
+****************************************/
+CREATE PROCEDURE [dbo].[stp_listValues_getByTable]
+(
+ @TableName NVARCHAR(50)
+)
+AS
+
+ SELECT *
+ FROM ListValues
+ WHERE TableName = @TableName
+ ORDER BY FieldName, ordinal
+
+RETURN
diff --git a/Projects/GimDB/dbo/Stored Procedures/stp_listValues_getDistTable.sql b/Projects/GimDB/dbo/Stored Procedures/stp_listValues_getDistTable.sql
new file mode 100644
index 0000000..8f2fd3f
--- /dev/null
+++ b/Projects/GimDB/dbo/Stored Procedures/stp_listValues_getDistTable.sql
@@ -0,0 +1,24 @@
+
+/***************************************
+* STORED stp_listValues_getDistTable
+*
+* ottiene elenco TableName
+*
+* Steamware, S.E.L.
+* mod: 2015.02.25
+*
+****************************************/
+create PROCEDURE [dbo].[stp_listValues_getDistTable]
+
+AS
+
+ SELECT DISTINCT TableName
+ , '-' AS FieldName
+ , '-' AS value
+ , '-' AS label
+ , 0 AS ordinal
+ FROM ListValues
+ ORDER BY TableName
+
+
+RETURN
diff --git a/Projects/GimDB/dbo/Stored Procedures/stp_listValues_getValidValues.sql b/Projects/GimDB/dbo/Stored Procedures/stp_listValues_getValidValues.sql
new file mode 100644
index 0000000..b250adc
--- /dev/null
+++ b/Projects/GimDB/dbo/Stored Procedures/stp_listValues_getValidValues.sql
@@ -0,0 +1,23 @@
+
+-- =============================================
+-- STORED stp_getValidValues
+--
+-- Author: S.E.L.
+-- Create date: 2011.05.26
+-- Description: gestione selezione dati parametrici
+-- =============================================
+create PROCEDURE [dbo].[stp_listValues_getValidValues]
+(
+ @TableName NVARCHAR(50),
+ @FieldName NVARCHAR(50)
+)
+AS
+BEGIN
+ SET NOCOUNT ON;
+
+ SELECT value, label
+ FROM ListValues
+ WHERE TableName = @TableName
+ AND FieldName = @FieldName
+ ORDER BY ordinal
+END
diff --git a/Projects/GimDB/dbo/Stored Procedures/stp_listValues_getValidValuesFilt.sql b/Projects/GimDB/dbo/Stored Procedures/stp_listValues_getValidValuesFilt.sql
new file mode 100644
index 0000000..e09cd1e
--- /dev/null
+++ b/Projects/GimDB/dbo/Stored Procedures/stp_listValues_getValidValuesFilt.sql
@@ -0,0 +1,26 @@
+
+-- =============================================
+-- STORED stp_getValidValuesFilt
+--
+-- Author: S.E.L.
+-- Create date: 2011.05.26
+-- Description: gestione selezione dati parametrici
+-- con filtro su valore con LIKE
+-- =============================================
+create PROCEDURE [dbo].[stp_listValues_getValidValuesFilt]
+(
+ @TableName NVARCHAR(50),
+ @FieldName NVARCHAR(50),
+ @valueLike NVARCHAR(10)
+)
+AS
+BEGIN
+ SET NOCOUNT ON;
+
+ SELECT value, label
+ FROM ListValues
+ WHERE TableName = @TableName
+ AND FieldName = @FieldName
+ AND value LIKE @valueLike +'%'
+ ORDER BY ordinal
+END
diff --git a/Projects/GimDB/dbo/Stored Procedures/stp_listValues_getValidValuesTrad.sql b/Projects/GimDB/dbo/Stored Procedures/stp_listValues_getValidValuesTrad.sql
new file mode 100644
index 0000000..dc8a194
--- /dev/null
+++ b/Projects/GimDB/dbo/Stored Procedures/stp_listValues_getValidValuesTrad.sql
@@ -0,0 +1,26 @@
+
+-- =============================================
+-- STORED stp_getValidValues
+--
+-- Author: S.E.L.
+-- Create date: 2015.09.15
+-- Description: gestione selezione dati parametrici tradotti
+-- =============================================
+CREATE PROCEDURE [dbo].[stp_listValues_getValidValuesTrad]
+(
+ @TableName NVARCHAR(50),
+ @FieldName NVARCHAR(50),
+ @Lingua NVARCHAR(3)
+)
+AS
+BEGIN
+ SET NOCOUNT ON;
+
+ SELECT lv.value, ISNULL(v.Traduzione, lv.TableName+lv.FieldName+lv.value) AS label
+ FROM ListValues lv LEFT OUTER JOIN Vocabolario v
+ ON lv.TableName+lv.FieldName+lv.value = v.Lemma
+ AND v.Lingua = @Lingua
+ WHERE lv.TableName = @TableName
+ AND lv.FieldName = @FieldName
+ ORDER BY lv.ordinal
+END
diff --git a/Projects/GimDB/dbo/Stored Procedures/stp_oreEquivalenti.sql b/Projects/GimDB/dbo/Stored Procedures/stp_oreEquivalenti.sql
new file mode 100644
index 0000000..574ffef
--- /dev/null
+++ b/Projects/GimDB/dbo/Stored Procedures/stp_oreEquivalenti.sql
@@ -0,0 +1,18 @@
+
+/*************************************
+* STORED PROCEDURE stp_oreEquivalenti
+* calcola le ore di apertura equivalenti x una data macchina e periodo
+*
+* modif.: S.E.L. - 2011.06.29
+**************************************/
+create PROCEDURE stp_oreEquivalenti
+(
+ @dataFrom DATETIME,
+ @dataTo DATETIME,
+ @idxMacchina INT
+)
+AS
+
+SELECT dbo.f_diffOreLavorative(@dataFrom, @dataTo, @idxMacchina) AS apertura
+
+RETURN
diff --git a/Projects/GimDB/dbo/Stored Procedures/stp_vie_getByPeriodoSearch.sql b/Projects/GimDB/dbo/Stored Procedures/stp_vie_getByPeriodoSearch.sql
new file mode 100644
index 0000000..461f3da
--- /dev/null
+++ b/Projects/GimDB/dbo/Stored Procedures/stp_vie_getByPeriodoSearch.sql
@@ -0,0 +1,110 @@
+
+-- =============================================
+-- Author:
+-- Create date:
+-- Description:
+-- =============================================
+CREATE PROCEDURE [dbo].[stp_vie_getByPeriodoSearch] (
+ @inizio DATETIME
+ ,@fine DATETIME
+ ,@search NVARCHAR(50) = ''
+ )
+AS
+BEGIN
+ -- SET NOCOUNT ON added to prevent extra result sets from
+ -- interfering with SELECT statements.
+ SET NOCOUNT ON;
+
+ IF (
+ ISNULL (@search,'') = '' OR ISNULL (@search,'') = '*'
+ )
+ BEGIN
+ -- Insert statements for procedure here
+ SELECT DescrStato
+ ,codImpianto
+ ,codMacchina
+ ,dataLav
+ ,descrAmbitoGuasto
+ ,descrCausale
+ ,descrPriorita
+ ,descrTipo
+ ,descrizione
+ ,descrizioneIntervento
+ ,fineIntervento
+ ,guasto
+ ,idxAmbito
+ ,idxCausale
+ ,idxImpianto
+ ,idxMacchina
+ ,idxPriorita
+ ,idxStato
+ ,idxTipo
+ ,inizioIntervento
+ ,isFermo
+ ,isPreventivabile
+ ,matr
+ ,nomeImpianto
+ ,nomeMacchina
+ ,numIntMtz
+ ,presaInCarico
+ ,richiesta
+ ,turnoLav
+ FROM v_intervExp
+ WHERE (
+ richiesta BETWEEN @inizio
+ AND @fine
+ )
+ ORDER BY numIntMtz DESC
+ END
+ ELSE
+ BEGIN
+ SELECT DescrStato
+ ,codImpianto
+ ,codMacchina
+ ,dataLav
+ ,descrAmbitoGuasto
+ ,descrCausale
+ ,descrPriorita
+ ,descrTipo
+ ,descrizione
+ ,descrizioneIntervento
+ ,fineIntervento
+ ,guasto
+ ,idxAmbito
+ ,idxCausale
+ ,idxImpianto
+ ,idxMacchina
+ ,idxPriorita
+ ,idxStato
+ ,idxTipo
+ ,inizioIntervento
+ ,isFermo
+ ,isPreventivabile
+ ,matr
+ ,nomeImpianto
+ ,nomeMacchina
+ ,numIntMtz
+ ,presaInCarico
+ ,richiesta
+ ,turnoLav
+ FROM v_intervExp
+ WHERE (
+ richiesta BETWEEN @inizio
+ AND @fine
+ )
+ AND (
+ CONVERT(varchar(50),numIntMtz) LIKE '%' + @search + '%'
+ OR codImpianto LIKE '%' + @search + '%'
+ OR nomeImpianto LIKE '%' + @search + '%'
+ OR codMacchina LIKE '%' + @search + '%'
+ OR nomeMacchina LIKE '%' + @search + '%'
+ OR descrizione LIKE '%' + @search + '%'
+ OR descrAmbitoGuasto LIKE '%' + @search + '%'
+ OR descrCausale LIKE '%' + @search + '%'
+ OR descrizioneIntervento LIKE '%' + @search + '%'
+ OR descrPriorita LIKE '%' + @search + '%'
+ OR DescrStato LIKE '%' + @search + '%'
+ )
+ ORDER BY numIntMtz DESC
+ END
+END
diff --git a/Projects/GimDB/dbo/Stored Procedures/stp_vscm_getByConditio.sql b/Projects/GimDB/dbo/Stored Procedures/stp_vscm_getByConditio.sql
new file mode 100644
index 0000000..1c3ed87
--- /dev/null
+++ b/Projects/GimDB/dbo/Stored Procedures/stp_vscm_getByConditio.sql
@@ -0,0 +1,17 @@
+-- =============================================
+-- Author: S.E.Locatelli
+-- Create date: 2013.12.27
+-- Description: ricerca causali by conditio
+-- =============================================
+create PROCEDURE stp_vscm_getByConditio
+(
+ @conditio INT = 0
+)
+AS
+
+SELECT value, label, conditio
+FROM v_selCausaliMacchine
+WHERE (conditio = @conditio)
+
+
+RETURN
diff --git a/Projects/GimDB/dbo/Stored Procedures/stp_vscm_getByConditioAndCurr.sql b/Projects/GimDB/dbo/Stored Procedures/stp_vscm_getByConditioAndCurr.sql
new file mode 100644
index 0000000..51d575c
--- /dev/null
+++ b/Projects/GimDB/dbo/Stored Procedures/stp_vscm_getByConditioAndCurr.sql
@@ -0,0 +1,35 @@
+-- =============================================
+-- Author: S.E.Locatelli
+-- Create date: 2013.12.27
+-- Description: ricerca causali by conditio + valore corrente (x storico)
+-- =============================================
+CREATE PROCEDURE stp_vscm_getByConditioAndCurr
+(
+ @conditio INT = 0,
+ @currVal INT = 0
+)
+AS
+DECLARE @trovati INT = 0
+
+SELECT @trovati = COUNT(*) FROM v_selCausaliMacchine WHERE value=@currVal AND conditio = @conditio
+-- controllo se c'è valore ok così...
+IF @trovati=1
+ BEGIN
+ SELECT value, label, conditio
+ FROM v_selCausaliMacchine
+ WHERE (conditio = @conditio)
+ END
+ELSE
+ BEGIN
+ SELECT @currVal as value, '--- ### ---' as label, @conditio as conditio
+
+ UNION
+
+ SELECT value, label, conditio
+ FROM v_selCausaliMacchine
+ WHERE (conditio = @conditio)
+ END
+
+
+
+RETURN
diff --git a/Projects/GimDB/dbo/Tables/AnagAmbitoGuasto.sql b/Projects/GimDB/dbo/Tables/AnagAmbitoGuasto.sql
new file mode 100644
index 0000000..649ce3f
--- /dev/null
+++ b/Projects/GimDB/dbo/Tables/AnagAmbitoGuasto.sql
@@ -0,0 +1,6 @@
+CREATE TABLE [dbo].[AnagAmbitoGuasto] (
+ [idxAmbito] INT IDENTITY (1, 1) NOT NULL,
+ [descrAmbitoGuasto] NVARCHAR (50) NULL,
+ CONSTRAINT [PK_AnagAmbitoGuasto] PRIMARY KEY CLUSTERED ([idxAmbito] ASC)
+);
+
diff --git a/Projects/GimDB/dbo/Tables/AnagCausali.sql b/Projects/GimDB/dbo/Tables/AnagCausali.sql
new file mode 100644
index 0000000..0cc082c
--- /dev/null
+++ b/Projects/GimDB/dbo/Tables/AnagCausali.sql
@@ -0,0 +1,9 @@
+CREATE TABLE [dbo].[AnagCausali] (
+ [idxCausale] INT IDENTITY (1, 1) NOT NULL,
+ [idxFamMacchine] INT NOT NULL,
+ [descrCausale] NVARCHAR (50) NULL,
+ [attiva] BIT CONSTRAINT [DF_AnagCausali_attiva] DEFAULT ((1)) NULL,
+ CONSTRAINT [PK_AnagCausali] PRIMARY KEY CLUSTERED ([idxCausale] ASC),
+ CONSTRAINT [FK_AnagCausali_AnagFamMacchine] FOREIGN KEY ([idxFamMacchine]) REFERENCES [dbo].[AnagFamMacchine] ([idxFamMacchine]) ON UPDATE CASCADE
+);
+
diff --git a/Projects/GimDB/dbo/Tables/AnagClasseTurno.sql b/Projects/GimDB/dbo/Tables/AnagClasseTurno.sql
new file mode 100644
index 0000000..9436857
--- /dev/null
+++ b/Projects/GimDB/dbo/Tables/AnagClasseTurno.sql
@@ -0,0 +1,7 @@
+CREATE TABLE [dbo].[AnagClasseTurno] (
+ [CodClasseTurno] NVARCHAR (50) NOT NULL,
+ [Descrizione] NVARCHAR (50) NULL,
+ [hSettStd] INT NULL,
+ CONSTRAINT [PK_AnagClasseTurno] PRIMARY KEY CLUSTERED ([CodClasseTurno] ASC)
+);
+
diff --git a/Projects/GimDB/dbo/Tables/AnagEventi.sql b/Projects/GimDB/dbo/Tables/AnagEventi.sql
new file mode 100644
index 0000000..96bd850
--- /dev/null
+++ b/Projects/GimDB/dbo/Tables/AnagEventi.sql
@@ -0,0 +1,6 @@
+CREATE TABLE [dbo].[AnagEventi] (
+ [idxEvento] INT NOT NULL,
+ [DescrEvento] NVARCHAR (50) NULL,
+ CONSTRAINT [PK_AnagEventi] PRIMARY KEY CLUSTERED ([idxEvento] ASC)
+);
+
diff --git a/Projects/GimDB/dbo/Tables/AnagFamMacchine.sql b/Projects/GimDB/dbo/Tables/AnagFamMacchine.sql
new file mode 100644
index 0000000..437f3c7
--- /dev/null
+++ b/Projects/GimDB/dbo/Tables/AnagFamMacchine.sql
@@ -0,0 +1,6 @@
+CREATE TABLE [dbo].[AnagFamMacchine] (
+ [idxFamMacchine] INT IDENTITY (1, 1) NOT NULL,
+ [nomeFamMacch] NVARCHAR (50) NULL,
+ CONSTRAINT [PK_AnagFamMacchine] PRIMARY KEY CLUSTERED ([idxFamMacchine] ASC)
+);
+
diff --git a/Projects/GimDB/dbo/Tables/AnagFrequenze.sql b/Projects/GimDB/dbo/Tables/AnagFrequenze.sql
new file mode 100644
index 0000000..6f5a567
--- /dev/null
+++ b/Projects/GimDB/dbo/Tables/AnagFrequenze.sql
@@ -0,0 +1,6 @@
+CREATE TABLE [dbo].[AnagFrequenze] (
+ [codFrequenza] NCHAR (2) NOT NULL,
+ [frequenza] NVARCHAR (50) NULL,
+ CONSTRAINT [PK_AnagFrequenze] PRIMARY KEY CLUSTERED ([codFrequenza] ASC)
+);
+
diff --git a/Projects/GimDB/dbo/Tables/AnagImpianti.sql b/Projects/GimDB/dbo/Tables/AnagImpianti.sql
new file mode 100644
index 0000000..0e57940
--- /dev/null
+++ b/Projects/GimDB/dbo/Tables/AnagImpianti.sql
@@ -0,0 +1,10 @@
+CREATE TABLE [dbo].[AnagImpianti] (
+ [idxImpianto] INT IDENTITY (1, 1) NOT NULL,
+ [codImpianto] NVARCHAR (50) NULL,
+ [nomeImpianto] NVARCHAR (50) NULL,
+ [tipoImpianto] NVARCHAR (50) NULL,
+ [funzDal] DATETIME NULL,
+ [funzAl] DATETIME NULL,
+ CONSTRAINT [PK_AnagImpianti] PRIMARY KEY CLUSTERED ([idxImpianto] ASC)
+);
+
diff --git a/Projects/GimDB/dbo/Tables/AnagItems.sql b/Projects/GimDB/dbo/Tables/AnagItems.sql
new file mode 100644
index 0000000..1b0a3e7
--- /dev/null
+++ b/Projects/GimDB/dbo/Tables/AnagItems.sql
@@ -0,0 +1,9 @@
+CREATE TABLE [dbo].[AnagItems] (
+ [idxItem] INT NOT NULL,
+ [Descrizione] NVARCHAR (250) CONSTRAINT [DF_AnagItems_Descrizione] DEFAULT ('') NOT NULL,
+ [NomeCostruttore] NVARCHAR (250) CONSTRAINT [DF_AnagItems_NomeCostruttore] DEFAULT ('') NOT NULL,
+ [CodCostruttore] NVARCHAR (250) CONSTRAINT [DF_AnagItems_CodCostruttore] DEFAULT ('') NOT NULL,
+ [CodSomaschini] NVARCHAR (50) CONSTRAINT [DF_AnagItems_CodSomaschini] DEFAULT ('') NOT NULL,
+ CONSTRAINT [PK_AnagItems] PRIMARY KEY CLUSTERED ([idxItem] ASC)
+);
+
diff --git a/Projects/GimDB/dbo/Tables/AnagLocazioni.sql b/Projects/GimDB/dbo/Tables/AnagLocazioni.sql
new file mode 100644
index 0000000..1a1a23d
--- /dev/null
+++ b/Projects/GimDB/dbo/Tables/AnagLocazioni.sql
@@ -0,0 +1,6 @@
+CREATE TABLE [dbo].[AnagLocazioni] (
+ [CodLocazione] NVARCHAR (50) CONSTRAINT [DF_AnagLocazioni_CodLocazione] DEFAULT ('') NOT NULL,
+ [Descrizione] NVARCHAR (50) NULL,
+ CONSTRAINT [PK_AnagLocazioni] PRIMARY KEY CLUSTERED ([CodLocazione] ASC)
+);
+
diff --git a/Projects/GimDB/dbo/Tables/AnagMacchine.sql b/Projects/GimDB/dbo/Tables/AnagMacchine.sql
new file mode 100644
index 0000000..8a3d08a
--- /dev/null
+++ b/Projects/GimDB/dbo/Tables/AnagMacchine.sql
@@ -0,0 +1,31 @@
+CREATE TABLE [dbo].[AnagMacchine] (
+ [idxMacchina] INT IDENTITY (1, 1) NOT NULL,
+ [idxImpianto] INT NULL,
+ [codMacchina] NVARCHAR (50) NULL,
+ [nomeMacchina] NVARCHAR (250) NULL,
+ [modello] NVARCHAR (250) NULL,
+ [matricola] NVARCHAR (50) NULL,
+ [anno] INT NULL,
+ [kgPeso] FLOAT (53) CONSTRAINT [DF_AnagMacchine_kgPeso] DEFAULT ((0)) NOT NULL,
+ [kwConsumo] FLOAT (53) CONSTRAINT [DF_AnagMacchine_kwConsumo] DEFAULT ((0)) NOT NULL,
+ [funzDal] DATETIME NULL,
+ [funzAl] DATETIME NULL,
+ CONSTRAINT [PK_AnagMacchine] PRIMARY KEY CLUSTERED ([idxMacchina] ASC),
+ CONSTRAINT [FK_AnagMacchine_AnagImpianti] FOREIGN KEY ([idxImpianto]) REFERENCES [dbo].[AnagImpianti] ([idxImpianto]) ON UPDATE CASCADE
+);
+
+
+GO
+
+CREATE TRIGGER updateAssociazioneFamMacchine
+ON dbo.AnagMacchine
+FOR INSERT
+AS
+
+-- aggiungo le eventuali "macchine orfane" alla fam macchine di base (1 = TUTTE)
+INSERT INTO Macchine2FamMacchine(idxMacchina, idxFamMacchine)
+(
+ SELECT am.idxMacchina, 1 FROM anagMacchine am LEFT OUTER JOIN macchine2FamMacchine m2f
+ ON am.idxMacchina=m2f.idxMacchina
+ WHERE m2f.idxmacchina IS NULL
+)
diff --git a/Projects/GimDB/dbo/Tables/AnagPeriodi.sql b/Projects/GimDB/dbo/Tables/AnagPeriodi.sql
new file mode 100644
index 0000000..3b5cce3
--- /dev/null
+++ b/Projects/GimDB/dbo/Tables/AnagPeriodi.sql
@@ -0,0 +1,6 @@
+CREATE TABLE [dbo].[AnagPeriodi] (
+ [codPeriodo] NVARCHAR (20) NOT NULL,
+ [lemmaPeriodo] NVARCHAR (50) NULL,
+ CONSTRAINT [PK_AnagPeriodi] PRIMARY KEY CLUSTERED ([codPeriodo] ASC)
+);
+
diff --git a/Projects/GimDB/dbo/Tables/AnagPriorita.sql b/Projects/GimDB/dbo/Tables/AnagPriorita.sql
new file mode 100644
index 0000000..a1a1204
--- /dev/null
+++ b/Projects/GimDB/dbo/Tables/AnagPriorita.sql
@@ -0,0 +1,7 @@
+CREATE TABLE [dbo].[AnagPriorita] (
+ [idxPriorita] INT NOT NULL,
+ [descrPriorita] NVARCHAR (50) NULL,
+ [stile] NVARCHAR (50) NULL,
+ CONSTRAINT [PK_AnagPriorita] PRIMARY KEY CLUSTERED ([idxPriorita] ASC)
+);
+
diff --git a/Projects/GimDB/dbo/Tables/AnagSemafori.sql b/Projects/GimDB/dbo/Tables/AnagSemafori.sql
new file mode 100644
index 0000000..3164de1
--- /dev/null
+++ b/Projects/GimDB/dbo/Tables/AnagSemafori.sql
@@ -0,0 +1,6 @@
+CREATE TABLE [dbo].[AnagSemafori] (
+ [codSemaforo] NVARCHAR (50) NOT NULL,
+ [descrSemaforo] NVARCHAR (50) NULL,
+ CONSTRAINT [PK_AnagSemafori] PRIMARY KEY CLUSTERED ([codSemaforo] ASC)
+);
+
diff --git a/Projects/GimDB/dbo/Tables/AnagStati.sql b/Projects/GimDB/dbo/Tables/AnagStati.sql
new file mode 100644
index 0000000..4b3c2cb
--- /dev/null
+++ b/Projects/GimDB/dbo/Tables/AnagStati.sql
@@ -0,0 +1,7 @@
+CREATE TABLE [dbo].[AnagStati] (
+ [idxStato] INT NOT NULL,
+ [DescrStato] NVARCHAR (50) NULL,
+ [stile] NVARCHAR (50) NULL,
+ CONSTRAINT [PK_AnagStati] PRIMARY KEY CLUSTERED ([idxStato] ASC)
+);
+
diff --git a/Projects/GimDB/dbo/Tables/AnagTipoGuasto.sql b/Projects/GimDB/dbo/Tables/AnagTipoGuasto.sql
new file mode 100644
index 0000000..fee6488
--- /dev/null
+++ b/Projects/GimDB/dbo/Tables/AnagTipoGuasto.sql
@@ -0,0 +1,6 @@
+CREATE TABLE [dbo].[AnagTipoGuasto] (
+ [idxTipo] INT IDENTITY (1, 1) NOT NULL,
+ [descrTipo] NVARCHAR (50) NULL,
+ CONSTRAINT [PK_AnagTipoGuasto] PRIMARY KEY CLUSTERED ([idxTipo] ASC)
+);
+
diff --git a/Projects/GimDB/dbo/Tables/AnagTipoRisorsa.sql b/Projects/GimDB/dbo/Tables/AnagTipoRisorsa.sql
new file mode 100644
index 0000000..520dd90
--- /dev/null
+++ b/Projects/GimDB/dbo/Tables/AnagTipoRisorsa.sql
@@ -0,0 +1,8 @@
+CREATE TABLE [dbo].[AnagTipoRisorsa] (
+ [CodRisorsa] NVARCHAR (10) NOT NULL,
+ [UM] NVARCHAR (10) NOT NULL,
+ [DescrRisorsa] NVARCHAR (50) NOT NULL,
+ [Valuta] NVARCHAR (5) CONSTRAINT [DF_AnagTipoRisorsa_Valuta] DEFAULT ('€') NOT NULL,
+ CONSTRAINT [PK_AnagTipoRisorsa] PRIMARY KEY CLUSTERED ([CodRisorsa] ASC)
+);
+
diff --git a/Projects/GimDB/dbo/Tables/AnagTurni.sql b/Projects/GimDB/dbo/Tables/AnagTurni.sql
new file mode 100644
index 0000000..233ffc5
--- /dev/null
+++ b/Projects/GimDB/dbo/Tables/AnagTurni.sql
@@ -0,0 +1,8 @@
+CREATE TABLE [dbo].[AnagTurni] (
+ [CodTurno] NVARCHAR (50) NOT NULL,
+ [hStart] INT NULL,
+ [hEnd] INT NULL,
+ [descr] NVARCHAR (50) NULL,
+ CONSTRAINT [PK_AnagTurni] PRIMARY KEY CLUSTERED ([CodTurno] ASC)
+);
+
diff --git a/Projects/GimDB/dbo/Tables/AnagrOperMtz.sql b/Projects/GimDB/dbo/Tables/AnagrOperMtz.sql
new file mode 100644
index 0000000..214aa45
--- /dev/null
+++ b/Projects/GimDB/dbo/Tables/AnagrOperMtz.sql
@@ -0,0 +1,7 @@
+CREATE TABLE [dbo].[AnagrOperMtz] (
+ [matrOp] NVARCHAR (10) NOT NULL,
+ [Cognome] NVARCHAR (50) NULL,
+ [Nome] NVARCHAR (50) NULL,
+ CONSTRAINT [PK_AnagrOperatoriMtz] PRIMARY KEY CLUSTERED ([matrOp] ASC)
+);
+
diff --git a/Projects/GimDB/dbo/Tables/CDC.sql b/Projects/GimDB/dbo/Tables/CDC.sql
new file mode 100644
index 0000000..cf14a05
--- /dev/null
+++ b/Projects/GimDB/dbo/Tables/CDC.sql
@@ -0,0 +1,8 @@
+CREATE TABLE [dbo].[CDC] (
+ [COD_CDC] VARCHAR (10) NOT NULL,
+ [DESCRIZIONE] VARCHAR (200) NULL,
+ [COD_TIPO] VARCHAR (1) NOT NULL,
+ [POSIZIONE] VARCHAR (100) NULL,
+ PRIMARY KEY CLUSTERED ([COD_CDC] ASC)
+);
+
diff --git a/Projects/GimDB/dbo/Tables/CalendFesteFerie.sql b/Projects/GimDB/dbo/Tables/CalendFesteFerie.sql
new file mode 100644
index 0000000..1f1219d
--- /dev/null
+++ b/Projects/GimDB/dbo/Tables/CalendFesteFerie.sql
@@ -0,0 +1,6 @@
+CREATE TABLE [dbo].[CalendFesteFerie] (
+ [data] DATETIME NOT NULL,
+ [descrizione] NVARCHAR (50) NULL,
+ CONSTRAINT [PK_CalendFesteFerie] PRIMARY KEY CLUSTERED ([data] ASC)
+);
+
diff --git a/Projects/GimDB/dbo/Tables/DIRITTI.sql b/Projects/GimDB/dbo/Tables/DIRITTI.sql
new file mode 100644
index 0000000..6789dec
--- /dev/null
+++ b/Projects/GimDB/dbo/Tables/DIRITTI.sql
@@ -0,0 +1,12 @@
+CREATE TABLE [dbo].[DIRITTI] (
+ [USER_NAME] NVARCHAR (50) NOT NULL,
+ [COD_CDC] NVARCHAR (50) NOT NULL,
+ [COD_MODULO] NVARCHAR (31) NOT NULL,
+ [COD_FUNZIONE] NVARCHAR (31) NOT NULL,
+ [VALUE] VARCHAR (255) NULL,
+ CONSTRAINT [PK_DIRITTI] PRIMARY KEY CLUSTERED ([USER_NAME] ASC, [COD_CDC] ASC, [COD_MODULO] ASC, [COD_FUNZIONE] ASC),
+ CONSTRAINT [FK_DIRITTI_FUNZIONE] FOREIGN KEY ([COD_FUNZIONE]) REFERENCES [dbo].[FUNZIONE] ([COD_FUNZIONE]) ON UPDATE CASCADE,
+ CONSTRAINT [FK_DIRITTI_MODULO] FOREIGN KEY ([COD_MODULO]) REFERENCES [dbo].[MODULO] ([COD_MODULO]) ON UPDATE CASCADE,
+ CONSTRAINT [FK_DIRITTI_UTENTE] FOREIGN KEY ([USER_NAME]) REFERENCES [dbo].[UTENTE] ([USER_NAME]) ON UPDATE CASCADE
+);
+
diff --git a/Projects/GimDB/dbo/Tables/FUNZIONE.sql b/Projects/GimDB/dbo/Tables/FUNZIONE.sql
new file mode 100644
index 0000000..b089e55
--- /dev/null
+++ b/Projects/GimDB/dbo/Tables/FUNZIONE.sql
@@ -0,0 +1,6 @@
+CREATE TABLE [dbo].[FUNZIONE] (
+ [COD_FUNZIONE] NVARCHAR (31) NOT NULL,
+ [DESCRIZIONE] NVARCHAR (500) NULL,
+ CONSTRAINT [PK_FUNZIONE] PRIMARY KEY CLUSTERED ([COD_FUNZIONE] ASC)
+);
+
diff --git a/Projects/GimDB/dbo/Tables/FiltroImpianti.sql b/Projects/GimDB/dbo/Tables/FiltroImpianti.sql
new file mode 100644
index 0000000..f052b4d
--- /dev/null
+++ b/Projects/GimDB/dbo/Tables/FiltroImpianti.sql
@@ -0,0 +1,12 @@
+CREATE TABLE [dbo].[FiltroImpianti] (
+ [username] NVARCHAR (50) NOT NULL,
+ [idxImpianto] INT NOT NULL,
+ CONSTRAINT [PK_FiltroImpianti] PRIMARY KEY CLUSTERED ([username] ASC, [idxImpianto] ASC),
+ CONSTRAINT [FK_FiltroImpianti_AnagImpianti] FOREIGN KEY ([idxImpianto]) REFERENCES [dbo].[AnagImpianti] ([idxImpianto]) ON DELETE CASCADE ON UPDATE CASCADE
+);
+
+
+GO
+CREATE NONCLUSTERED INDEX [i_username]
+ ON [dbo].[FiltroImpianti]([username] ASC);
+
diff --git a/Projects/GimDB/dbo/Tables/FiltroMacchine.sql b/Projects/GimDB/dbo/Tables/FiltroMacchine.sql
new file mode 100644
index 0000000..07b75b7
--- /dev/null
+++ b/Projects/GimDB/dbo/Tables/FiltroMacchine.sql
@@ -0,0 +1,12 @@
+CREATE TABLE [dbo].[FiltroMacchine] (
+ [username] NVARCHAR (50) NOT NULL,
+ [idxMacchina] INT NOT NULL,
+ CONSTRAINT [PK_FiltroMacchine] PRIMARY KEY CLUSTERED ([username] ASC, [idxMacchina] ASC),
+ CONSTRAINT [FK_FiltroMacchine_AnagMacchine] FOREIGN KEY ([idxMacchina]) REFERENCES [dbo].[AnagMacchine] ([idxMacchina]) ON DELETE CASCADE ON UPDATE CASCADE
+);
+
+
+GO
+CREATE NONCLUSTERED INDEX [i_username]
+ ON [dbo].[FiltroMacchine]([username] ASC);
+
diff --git a/Projects/GimDB/dbo/Tables/FiltroStati.sql b/Projects/GimDB/dbo/Tables/FiltroStati.sql
new file mode 100644
index 0000000..20a3f49
--- /dev/null
+++ b/Projects/GimDB/dbo/Tables/FiltroStati.sql
@@ -0,0 +1,12 @@
+CREATE TABLE [dbo].[FiltroStati] (
+ [username] NVARCHAR (50) NOT NULL,
+ [idxStato] INT NOT NULL,
+ CONSTRAINT [PK_FiltroStati] PRIMARY KEY CLUSTERED ([username] ASC, [idxStato] ASC),
+ CONSTRAINT [FK_FiltroStati_AnagStati] FOREIGN KEY ([idxStato]) REFERENCES [dbo].[AnagStati] ([idxStato]) ON DELETE CASCADE ON UPDATE CASCADE
+);
+
+
+GO
+CREATE NONCLUSTERED INDEX [i_username]
+ ON [dbo].[FiltroStati]([username] ASC);
+
diff --git a/Projects/GimDB/dbo/Tables/ImpiegoRisorse.sql b/Projects/GimDB/dbo/Tables/ImpiegoRisorse.sql
new file mode 100644
index 0000000..947b59e
--- /dev/null
+++ b/Projects/GimDB/dbo/Tables/ImpiegoRisorse.sql
@@ -0,0 +1,13 @@
+CREATE TABLE [dbo].[ImpiegoRisorse] (
+ [idxImpiego] INT IDENTITY (1, 1) NOT NULL,
+ [CodRisorsa] NVARCHAR (10) NOT NULL,
+ [numIntMtz] INT NOT NULL,
+ [QtaRisorsa] DECIMAL (18, 6) NOT NULL,
+ [CostoUnit] DECIMAL (18, 6) CONSTRAINT [DF_ImpiegoRisorse_CostoUnit] DEFAULT ((0)) NOT NULL,
+ [TotImport] AS ([QtaRisorsa]*[CostoUnit]),
+ [Note] NVARCHAR (MAX) CONSTRAINT [DF_ImpiegoRisorse_Note] DEFAULT ('') NOT NULL,
+ CONSTRAINT [PK_ImpiegoRisorse] PRIMARY KEY CLUSTERED ([idxImpiego] ASC),
+ CONSTRAINT [FK_ImpiegoRisorse_AnagTipoRisorsa] FOREIGN KEY ([CodRisorsa]) REFERENCES [dbo].[AnagTipoRisorsa] ([CodRisorsa]) ON UPDATE CASCADE,
+ CONSTRAINT [FK_ImpiegoRisorse_InterventiMtz] FOREIGN KEY ([numIntMtz]) REFERENCES [dbo].[InterventiMtz] ([numIntMtz]) ON UPDATE CASCADE
+);
+
diff --git a/Projects/GimDB/dbo/Tables/InterventiMtz.sql b/Projects/GimDB/dbo/Tables/InterventiMtz.sql
new file mode 100644
index 0000000..c5c3ac6
--- /dev/null
+++ b/Projects/GimDB/dbo/Tables/InterventiMtz.sql
@@ -0,0 +1,56 @@
+CREATE TABLE [dbo].[InterventiMtz] (
+ [numIntMtz] INT IDENTITY (1, 1) NOT NULL,
+ [richiesta] DATETIME NOT NULL,
+ [dataLav] DATETIME NOT NULL,
+ [turnoLav] INT NOT NULL,
+ [matr] NVARCHAR (10) NOT NULL,
+ [guasto] DATETIME NOT NULL,
+ [idxAmbito] INT NOT NULL,
+ [idxPriorita] INT NOT NULL,
+ [isFermo] BIT CONSTRAINT [DF_InterventiMtz_isFermo] DEFAULT ((1)) NOT NULL,
+ [idxTipo] INT NOT NULL,
+ [idxImpianto] INT NOT NULL,
+ [idxMacchina] INT NOT NULL,
+ [descrizione] NVARCHAR (2500) NOT NULL,
+ [idxStato] INT NOT NULL,
+ [presaInCarico] DATETIME NULL,
+ [inizioIntervento] DATETIME NULL,
+ [fineIntervento] DATETIME NULL,
+ [descrizioneIntervento] NVARCHAR (2500) NULL,
+ [isPreventivabile] BIT CONSTRAINT [DF_InterventiMtz_isPreventivabile] DEFAULT ((0)) NOT NULL,
+ [idxCausale] INT NULL,
+ [scheduled] BIT CONSTRAINT [DF_InterventiMtz_scheduled] DEFAULT ((0)) NULL,
+ CONSTRAINT [PK_InterventiMtz] PRIMARY KEY CLUSTERED ([numIntMtz] ASC),
+ CONSTRAINT [FK_InterventiMtz_AnagAmbitoGuasto] FOREIGN KEY ([idxAmbito]) REFERENCES [dbo].[AnagAmbitoGuasto] ([idxAmbito]) ON UPDATE CASCADE,
+ CONSTRAINT [FK_InterventiMtz_AnagCausali] FOREIGN KEY ([idxCausale]) REFERENCES [dbo].[AnagCausali] ([idxCausale]) ON UPDATE CASCADE,
+ CONSTRAINT [FK_InterventiMtz_AnagImpianti] FOREIGN KEY ([idxImpianto]) REFERENCES [dbo].[AnagImpianti] ([idxImpianto]),
+ CONSTRAINT [FK_InterventiMtz_AnagMacchine] FOREIGN KEY ([idxMacchina]) REFERENCES [dbo].[AnagMacchine] ([idxMacchina]) ON UPDATE CASCADE,
+ CONSTRAINT [FK_InterventiMtz_AnagPriorita] FOREIGN KEY ([idxPriorita]) REFERENCES [dbo].[AnagPriorita] ([idxPriorita]) ON UPDATE CASCADE,
+ CONSTRAINT [FK_InterventiMtz_AnagStati] FOREIGN KEY ([idxStato]) REFERENCES [dbo].[AnagStati] ([idxStato]) ON UPDATE CASCADE,
+ CONSTRAINT [FK_InterventiMtz_AnagTipoGuasto] FOREIGN KEY ([idxTipo]) REFERENCES [dbo].[AnagTipoGuasto] ([idxTipo]) ON UPDATE CASCADE
+);
+
+
+GO
+CREATE NONCLUSTERED INDEX [i_richiesta]
+ ON [dbo].[InterventiMtz]([richiesta] ASC);
+
+
+GO
+CREATE NONCLUSTERED INDEX [i_impianto]
+ ON [dbo].[InterventiMtz]([idxImpianto] ASC);
+
+
+GO
+CREATE NONCLUSTERED INDEX [i_macchina]
+ ON [dbo].[InterventiMtz]([idxMacchina] ASC);
+
+
+GO
+CREATE NONCLUSTERED INDEX [i_stato]
+ ON [dbo].[InterventiMtz]([idxStato] ASC);
+
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = 'indica se l''intervento sia stato generato da manutenzione programmata/preventiva', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'InterventiMtz', @level2type = N'COLUMN', @level2name = N'scheduled';
+
diff --git a/Projects/GimDB/dbo/Tables/InterventoOpMtz.sql b/Projects/GimDB/dbo/Tables/InterventoOpMtz.sql
new file mode 100644
index 0000000..7cbe207
--- /dev/null
+++ b/Projects/GimDB/dbo/Tables/InterventoOpMtz.sql
@@ -0,0 +1,9 @@
+CREATE TABLE [dbo].[InterventoOpMtz] (
+ [numIntMtz] INT NOT NULL,
+ [matrOp] NVARCHAR (10) NOT NULL,
+ [durataMinuti] INT NULL,
+ CONSTRAINT [PK_InterventoOpMtz] PRIMARY KEY CLUSTERED ([numIntMtz] ASC, [matrOp] ASC),
+ CONSTRAINT [FK_InterventoOpMtz_AnagrOperMtz] FOREIGN KEY ([matrOp]) REFERENCES [dbo].[AnagrOperMtz] ([matrOp]) ON UPDATE CASCADE,
+ CONSTRAINT [FK_InterventoOpMtz_InterventiMtz] FOREIGN KEY ([numIntMtz]) REFERENCES [dbo].[InterventiMtz] ([numIntMtz]) ON UPDATE CASCADE
+);
+
diff --git a/Projects/GimDB/dbo/Tables/Item2FamMacchine.sql b/Projects/GimDB/dbo/Tables/Item2FamMacchine.sql
new file mode 100644
index 0000000..929a893
--- /dev/null
+++ b/Projects/GimDB/dbo/Tables/Item2FamMacchine.sql
@@ -0,0 +1,8 @@
+CREATE TABLE [dbo].[Item2FamMacchine] (
+ [idxItem] INT NOT NULL,
+ [idxFamMacchine] INT NOT NULL,
+ CONSTRAINT [PK_Item2FamMacchine] PRIMARY KEY CLUSTERED ([idxItem] ASC, [idxFamMacchine] ASC),
+ CONSTRAINT [FK_Item2FamMacchine_AnagFamMacchine] FOREIGN KEY ([idxFamMacchine]) REFERENCES [dbo].[AnagFamMacchine] ([idxFamMacchine]) ON UPDATE CASCADE,
+ CONSTRAINT [FK_Item2FamMacchine_AnagItems] FOREIGN KEY ([idxItem]) REFERENCES [dbo].[AnagItems] ([idxItem]) ON UPDATE CASCADE
+);
+
diff --git a/Projects/GimDB/dbo/Tables/Item2Macchine.sql b/Projects/GimDB/dbo/Tables/Item2Macchine.sql
new file mode 100644
index 0000000..9706b71
--- /dev/null
+++ b/Projects/GimDB/dbo/Tables/Item2Macchine.sql
@@ -0,0 +1,8 @@
+CREATE TABLE [dbo].[Item2Macchine] (
+ [idxItem] INT NOT NULL,
+ [idxMacchina] INT NOT NULL,
+ CONSTRAINT [PK_Item2Macchine] PRIMARY KEY CLUSTERED ([idxItem] ASC, [idxMacchina] ASC),
+ CONSTRAINT [FK_Item2Macchine_AnagItems] FOREIGN KEY ([idxItem]) REFERENCES [dbo].[AnagItems] ([idxItem]) ON UPDATE CASCADE,
+ CONSTRAINT [FK_Item2Macchine_AnagMacchine] FOREIGN KEY ([idxMacchina]) REFERENCES [dbo].[AnagMacchine] ([idxMacchina]) ON UPDATE CASCADE
+);
+
diff --git a/Projects/GimDB/dbo/Tables/Lingue.sql b/Projects/GimDB/dbo/Tables/Lingue.sql
new file mode 100644
index 0000000..9ae1331
--- /dev/null
+++ b/Projects/GimDB/dbo/Tables/Lingue.sql
@@ -0,0 +1,6 @@
+CREATE TABLE [dbo].[Lingue] (
+ [Lingua] NVARCHAR (3) NOT NULL,
+ [DescrizioneLingua] NVARCHAR (50) NOT NULL,
+ CONSTRAINT [PK_Lingue] PRIMARY KEY CLUSTERED ([Lingua] ASC)
+);
+
diff --git a/Projects/GimDB/dbo/Tables/ListValues.sql b/Projects/GimDB/dbo/Tables/ListValues.sql
new file mode 100644
index 0000000..868698b
--- /dev/null
+++ b/Projects/GimDB/dbo/Tables/ListValues.sql
@@ -0,0 +1,9 @@
+CREATE TABLE [dbo].[ListValues] (
+ [TableName] NVARCHAR (50) NOT NULL,
+ [FieldName] NVARCHAR (50) NOT NULL,
+ [value] NVARCHAR (10) NOT NULL,
+ [label] NVARCHAR (50) NULL,
+ [ordinal] INT NULL,
+ CONSTRAINT [PK_ListValues] PRIMARY KEY CLUSTERED ([TableName] ASC, [FieldName] ASC, [value] ASC)
+);
+
diff --git a/Projects/GimDB/dbo/Tables/LogUpdateDb.sql b/Projects/GimDB/dbo/Tables/LogUpdateDb.sql
new file mode 100644
index 0000000..42dd985
--- /dev/null
+++ b/Projects/GimDB/dbo/Tables/LogUpdateDb.sql
@@ -0,0 +1,6 @@
+CREATE TABLE [dbo].[LogUpdateDb] (
+ [Versione] INT NOT NULL,
+ [Data] DATETIME NULL,
+ CONSTRAINT [PK_LogUpdateDb] PRIMARY KEY CLUSTERED ([Versione] ASC)
+);
+
diff --git a/Projects/GimDB/dbo/Tables/MODULO.sql b/Projects/GimDB/dbo/Tables/MODULO.sql
new file mode 100644
index 0000000..d37b3b3
--- /dev/null
+++ b/Projects/GimDB/dbo/Tables/MODULO.sql
@@ -0,0 +1,6 @@
+CREATE TABLE [dbo].[MODULO] (
+ [COD_MODULO] NVARCHAR (31) NOT NULL,
+ [DESCRIZIONE] VARCHAR (200) NULL,
+ CONSTRAINT [PK_MODULO] PRIMARY KEY CLUSTERED ([COD_MODULO] ASC)
+);
+
diff --git a/Projects/GimDB/dbo/Tables/Macchine2FamMacchine.sql b/Projects/GimDB/dbo/Tables/Macchine2FamMacchine.sql
new file mode 100644
index 0000000..61a1db6
--- /dev/null
+++ b/Projects/GimDB/dbo/Tables/Macchine2FamMacchine.sql
@@ -0,0 +1,8 @@
+CREATE TABLE [dbo].[Macchine2FamMacchine] (
+ [idxMacchina] INT NOT NULL,
+ [idxFamMacchine] INT NOT NULL,
+ CONSTRAINT [PK_Macchine2FamMacchine] PRIMARY KEY CLUSTERED ([idxMacchina] ASC, [idxFamMacchine] ASC),
+ CONSTRAINT [FK_Macchine2FamMacchine_AnagFamMacchine] FOREIGN KEY ([idxFamMacchine]) REFERENCES [dbo].[AnagFamMacchine] ([idxFamMacchine]) ON UPDATE CASCADE,
+ CONSTRAINT [FK_Macchine2FamMacchine_AnagMacchine] FOREIGN KEY ([idxMacchina]) REFERENCES [dbo].[AnagMacchine] ([idxMacchina]) ON UPDATE CASCADE
+);
+
diff --git a/Projects/GimDB/dbo/Tables/MagRicambi.sql b/Projects/GimDB/dbo/Tables/MagRicambi.sql
new file mode 100644
index 0000000..5a48b09
--- /dev/null
+++ b/Projects/GimDB/dbo/Tables/MagRicambi.sql
@@ -0,0 +1,10 @@
+CREATE TABLE [dbo].[MagRicambi] (
+ [idxItem] INT NOT NULL,
+ [CodLocazione] NVARCHAR (50) CONSTRAINT [DF__MagRicamb__CodLo__041093DD] DEFAULT ('') NOT NULL,
+ [Qta] INT CONSTRAINT [DF__MagRicambi__Qta__031C6FA4] DEFAULT ((0)) NOT NULL,
+ [Note] NVARCHAR (MAX) CONSTRAINT [DF__MagRicambi__Note__0504B816] DEFAULT ('') NOT NULL,
+ CONSTRAINT [PK__MagRicam__51E8426210504E93] PRIMARY KEY CLUSTERED ([idxItem] ASC, [CodLocazione] ASC),
+ CONSTRAINT [FK_MagRicambi_AnagItems] FOREIGN KEY ([idxItem]) REFERENCES [dbo].[AnagItems] ([idxItem]) ON UPDATE CASCADE,
+ CONSTRAINT [FK_MagRicambi_AnagLocazioni] FOREIGN KEY ([CodLocazione]) REFERENCES [dbo].[AnagLocazioni] ([CodLocazione]) ON UPDATE CASCADE
+);
+
diff --git a/Projects/GimDB/dbo/Tables/MovMagRicambi.sql b/Projects/GimDB/dbo/Tables/MovMagRicambi.sql
new file mode 100644
index 0000000..1856707
--- /dev/null
+++ b/Projects/GimDB/dbo/Tables/MovMagRicambi.sql
@@ -0,0 +1,9 @@
+CREATE TABLE [dbo].[MovMagRicambi] (
+ [idxItem] INT NOT NULL,
+ [dtMov] DATETIME NOT NULL,
+ [Qta] INT NULL,
+ [idxMacchina] INT NOT NULL,
+ CONSTRAINT [PK_MovMagRicambi] PRIMARY KEY CLUSTERED ([idxItem] ASC, [dtMov] ASC),
+ CONSTRAINT [FK_MovMagRicambi_AnagItems] FOREIGN KEY ([idxItem]) REFERENCES [dbo].[AnagItems] ([idxItem]) ON UPDATE CASCADE
+);
+
diff --git a/Projects/GimDB/dbo/Tables/MtzProgPending.sql b/Projects/GimDB/dbo/Tables/MtzProgPending.sql
new file mode 100644
index 0000000..84eff90
--- /dev/null
+++ b/Projects/GimDB/dbo/Tables/MtzProgPending.sql
@@ -0,0 +1,13 @@
+CREATE TABLE [dbo].[MtzProgPending] (
+ [idxPending] INT IDENTITY (1, 1) NOT NULL,
+ [idxIntPro] INT NOT NULL,
+ [idxMacchina] INT NULL,
+ [data] DATETIME NULL,
+ [descrizione] NVARCHAR (2500) NULL,
+ [idxPriorita] INT NULL,
+ [isFermo] BIT CONSTRAINT [DF_MtzProgPending_isFermo] DEFAULT ((1)) NULL,
+ [idxTipo] INT NULL,
+ CONSTRAINT [PK_MtzProgPending] PRIMARY KEY CLUSTERED ([idxPending] ASC),
+ CONSTRAINT [FK_MtzProgPending_MtzProgrammata] FOREIGN KEY ([idxIntPro]) REFERENCES [dbo].[MtzProgrammata] ([idxIntPro]) ON DELETE CASCADE ON UPDATE CASCADE
+);
+
diff --git a/Projects/GimDB/dbo/Tables/MtzProgrammata.sql b/Projects/GimDB/dbo/Tables/MtzProgrammata.sql
new file mode 100644
index 0000000..7ab73bb
--- /dev/null
+++ b/Projects/GimDB/dbo/Tables/MtzProgrammata.sql
@@ -0,0 +1,40 @@
+CREATE TABLE [dbo].[MtzProgrammata] (
+ [idxIntPro] INT IDENTITY (1, 1) NOT NULL,
+ [idxMacchina] INT NULL,
+ [inizio] DATETIME NULL,
+ [codFrequenza] NCHAR (2) NULL,
+ [cadenza] INT NULL,
+ [descrizione] NVARCHAR (2500) NULL,
+ [idxPriorita] INT NULL,
+ [isFermo] BIT CONSTRAINT [DF_MtzProgrammata_isFermo] DEFAULT ((1)) NULL,
+ [idxTipo] INT NULL,
+ CONSTRAINT [PK_MtzProgrammata] PRIMARY KEY CLUSTERED ([idxIntPro] ASC),
+ CONSTRAINT [FK_MtzProgrammata_AnagFrequenze] FOREIGN KEY ([codFrequenza]) REFERENCES [dbo].[AnagFrequenze] ([codFrequenza]) ON UPDATE CASCADE,
+ CONSTRAINT [FK_MtzProgrammata_AnagMacchine] FOREIGN KEY ([idxMacchina]) REFERENCES [dbo].[AnagMacchine] ([idxMacchina]) ON UPDATE CASCADE
+);
+
+
+GO
+/*********************************************************************************
+* TRIGGER trg_updateMPPending
+*
+* eliminazione, in caso di update di un intervento di MtzProgrammata,
+* dei record di interventi "pending" predisposti... così saranno rigenerati corretti
+*
+**********************************************************************************/
+CREATE TRIGGER trg_updateMPPending
+ON dbo.MtzProgrammata
+FOR UPDATE, DELETE
+AS
+
+BEGIN tran
+ -- elimino interventi pending interessati...
+ DELETE
+ FROM MtzProgPending
+ WHERE idxIntPro IN
+ (
+ -- prendendo gli interventi mtzProgrammata modificati...
+ SELECT DISTINCT idxIntPro FROM DELETED
+ )
+
+COMMIT tran
diff --git a/Projects/GimDB/dbo/Tables/OreAperturaSett.sql b/Projects/GimDB/dbo/Tables/OreAperturaSett.sql
new file mode 100644
index 0000000..0a0b832
--- /dev/null
+++ b/Projects/GimDB/dbo/Tables/OreAperturaSett.sql
@@ -0,0 +1,7 @@
+CREATE TABLE [dbo].[OreAperturaSett] (
+ [giorno] INT NOT NULL,
+ [descrGiorno] NVARCHAR (50) NULL,
+ [apertura] INT NULL,
+ CONSTRAINT [PK_OreAperturaSett_2] PRIMARY KEY CLUSTERED ([giorno] ASC)
+);
+
diff --git a/Projects/GimDB/dbo/Tables/OreAperturaSettTurni.sql b/Projects/GimDB/dbo/Tables/OreAperturaSettTurni.sql
new file mode 100644
index 0000000..577328d
--- /dev/null
+++ b/Projects/GimDB/dbo/Tables/OreAperturaSettTurni.sql
@@ -0,0 +1,8 @@
+CREATE TABLE [dbo].[OreAperturaSettTurni] (
+ [CodClasseTurno] NVARCHAR (50) NOT NULL,
+ [CodTurno] NVARCHAR (50) NOT NULL,
+ [giorno] INT NOT NULL,
+ [descrGiorno] NVARCHAR (50) NULL,
+ CONSTRAINT [PK_OreAperturaSett] PRIMARY KEY CLUSTERED ([CodClasseTurno] ASC, [giorno] ASC, [CodTurno] ASC)
+);
+
diff --git a/Projects/GimDB/dbo/Tables/OreChiusuraSett.sql b/Projects/GimDB/dbo/Tables/OreChiusuraSett.sql
new file mode 100644
index 0000000..487cc03
--- /dev/null
+++ b/Projects/GimDB/dbo/Tables/OreChiusuraSett.sql
@@ -0,0 +1,7 @@
+CREATE TABLE [dbo].[OreChiusuraSett] (
+ [giorno] INT NOT NULL,
+ [descrGiorno] NVARCHAR (50) NULL,
+ [chiusura] INT NULL,
+ CONSTRAINT [PK_OreAperturaSett_1] PRIMARY KEY CLUSTERED ([giorno] ASC)
+);
+
diff --git a/Projects/GimDB/dbo/Tables/Permessi.sql b/Projects/GimDB/dbo/Tables/Permessi.sql
new file mode 100644
index 0000000..13f8d90
--- /dev/null
+++ b/Projects/GimDB/dbo/Tables/Permessi.sql
@@ -0,0 +1,10 @@
+CREATE TABLE [dbo].[Permessi] (
+ [COD_PERMESSO] VARCHAR (50) NOT NULL,
+ [URL] VARCHAR (250) NOT NULL,
+ [GRUPPO] INT NULL,
+ [NUMERO] INT NULL,
+ [NOME] VARCHAR (50) NULL,
+ [DESCRIZIONE] VARCHAR (50) NULL,
+ CONSTRAINT [PK_Permessi] PRIMARY KEY CLUSTERED ([COD_PERMESSO] ASC)
+);
+
diff --git a/Projects/GimDB/dbo/Tables/Permessi2Funzione.sql b/Projects/GimDB/dbo/Tables/Permessi2Funzione.sql
new file mode 100644
index 0000000..c623e87
--- /dev/null
+++ b/Projects/GimDB/dbo/Tables/Permessi2Funzione.sql
@@ -0,0 +1,8 @@
+CREATE TABLE [dbo].[Permessi2Funzione] (
+ [COD_PERMESSO] VARCHAR (50) NOT NULL,
+ [COD_FUNZIONE] NVARCHAR (31) NOT NULL,
+ [READWRITE] CHAR (1) NULL,
+ CONSTRAINT [PK_Permessi2Funzione] PRIMARY KEY CLUSTERED ([COD_PERMESSO] ASC, [COD_FUNZIONE] ASC),
+ CONSTRAINT [FK_Permessi2Funzione_Permessi] FOREIGN KEY ([COD_PERMESSO]) REFERENCES [dbo].[Permessi] ([COD_PERMESSO]) ON UPDATE CASCADE
+);
+
diff --git a/Projects/GimDB/dbo/Tables/Tra_Ev2Stati.sql b/Projects/GimDB/dbo/Tables/Tra_Ev2Stati.sql
new file mode 100644
index 0000000..486b0ce
--- /dev/null
+++ b/Projects/GimDB/dbo/Tables/Tra_Ev2Stati.sql
@@ -0,0 +1,9 @@
+CREATE TABLE [dbo].[Tra_Ev2Stati] (
+ [idxStato] INT NOT NULL,
+ [idxEvento] INT NOT NULL,
+ [nextIdxStato] INT NOT NULL,
+ CONSTRAINT [PK_Tra_Ev2Stati] PRIMARY KEY CLUSTERED ([idxStato] ASC, [idxEvento] ASC),
+ CONSTRAINT [FK_Tra_Ev2Stati_AnagEventi] FOREIGN KEY ([idxEvento]) REFERENCES [dbo].[AnagEventi] ([idxEvento]) ON UPDATE CASCADE,
+ CONSTRAINT [FK_Tra_Ev2Stati_AnagStati] FOREIGN KEY ([idxStato]) REFERENCES [dbo].[AnagStati] ([idxStato]) ON UPDATE CASCADE
+);
+
diff --git a/Projects/GimDB/dbo/Tables/UTENTE.sql b/Projects/GimDB/dbo/Tables/UTENTE.sql
new file mode 100644
index 0000000..d5c72d6
--- /dev/null
+++ b/Projects/GimDB/dbo/Tables/UTENTE.sql
@@ -0,0 +1,16 @@
+CREATE TABLE [dbo].[UTENTE] (
+ [DOMINIO] VARCHAR (30) NULL,
+ [USER_NAME] NVARCHAR (50) NOT NULL,
+ [COGNOME] VARCHAR (100) NULL,
+ [NOME] VARCHAR (100) NULL,
+ [COD_SOCIETA] VARCHAR (5) NULL,
+ [MATRICOLA] VARCHAR (5) NULL,
+ [COD_CDC] VARCHAR (10) NULL,
+ [EMAIL] VARCHAR (100) NULL,
+ [SIGLA] NVARCHAR (5) NULL,
+ [COD_LINGUA] VARCHAR (3) NULL,
+ [ATTIVO] CHAR (1) NULL,
+ CONSTRAINT [PK_UTENTE] PRIMARY KEY CLUSTERED ([USER_NAME] ASC),
+ CONSTRAINT [FK_UTENTE_CDC] FOREIGN KEY ([COD_CDC]) REFERENCES [dbo].[CDC] ([COD_CDC]) ON UPDATE CASCADE
+);
+
diff --git a/Projects/GimDB/dbo/Tables/Vocabolario.sql b/Projects/GimDB/dbo/Tables/Vocabolario.sql
new file mode 100644
index 0000000..4c1d463
--- /dev/null
+++ b/Projects/GimDB/dbo/Tables/Vocabolario.sql
@@ -0,0 +1,13 @@
+CREATE TABLE [dbo].[Vocabolario] (
+ [Lingua] NVARCHAR (3) NOT NULL,
+ [Lemma] NVARCHAR (50) NOT NULL,
+ [Traduzione] NVARCHAR (500) NOT NULL,
+ CONSTRAINT [PK_Vocabolario] PRIMARY KEY CLUSTERED ([Lingua] ASC, [Lemma] ASC),
+ CONSTRAINT [FK_Vocabolario_Lingue] FOREIGN KEY ([Lingua]) REFERENCES [dbo].[Lingue] ([Lingua]) ON UPDATE CASCADE
+);
+
+
+GO
+CREATE NONCLUSTERED INDEX [I_lemma]
+ ON [dbo].[Vocabolario]([Lemma] ASC);
+
diff --git a/Projects/GimDB/dbo/Tables/tmp_importaMacchine.sql b/Projects/GimDB/dbo/Tables/tmp_importaMacchine.sql
new file mode 100644
index 0000000..d1fa1e2
--- /dev/null
+++ b/Projects/GimDB/dbo/Tables/tmp_importaMacchine.sql
@@ -0,0 +1,12 @@
+CREATE TABLE [dbo].[tmp_importaMacchine] (
+ [idGest] NVARCHAR (500) NULL,
+ [denominazione] NVARCHAR (500) NULL,
+ [costruttore] NVARCHAR (500) NULL,
+ [matricola] NVARCHAR (50) NULL,
+ [anno] INT NULL,
+ [reparto] NVARCHAR (500) NULL,
+ [Gruppo] NVARCHAR (500) NULL,
+ [idx] INT IDENTITY (1, 1) NOT NULL,
+ CONSTRAINT [PK_tmp_importaMacchine] PRIMARY KEY CLUSTERED ([idx] ASC)
+);
+
diff --git a/Projects/GimDB/dbo/Views/v_datiMTBFMTTR.sql b/Projects/GimDB/dbo/Views/v_datiMTBFMTTR.sql
new file mode 100644
index 0000000..51cdf41
--- /dev/null
+++ b/Projects/GimDB/dbo/Views/v_datiMTBFMTTR.sql
@@ -0,0 +1,132 @@
+CREATE VIEW dbo.v_datiMTBFMTTR
+AS
+SELECT COUNT(numIntMtz) AS numInterventi, SUM(durataMtz) AS totOreMtz, SUM(durataOff) AS totOreOfficina, codImpianto, codMacchina, nomeImpianto,
+ nomeMacchina
+FROM dbo.v_elencoIntervFilt
+GROUP BY codImpianto, codMacchina, nomeImpianto, nomeMacchina
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPane1', @value = N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
+Begin DesignProperties =
+ Begin PaneConfigurations =
+ Begin PaneConfiguration = 0
+ NumPanes = 4
+ Configuration = "(H (1[41] 4[20] 2[20] 3) )"
+ End
+ Begin PaneConfiguration = 1
+ NumPanes = 3
+ Configuration = "(H (1 [50] 4 [25] 3))"
+ End
+ Begin PaneConfiguration = 2
+ NumPanes = 3
+ Configuration = "(H (1 [50] 2 [25] 3))"
+ End
+ Begin PaneConfiguration = 3
+ NumPanes = 3
+ Configuration = "(H (4 [30] 2 [40] 3))"
+ End
+ Begin PaneConfiguration = 4
+ NumPanes = 2
+ Configuration = "(H (1 [56] 3))"
+ End
+ Begin PaneConfiguration = 5
+ NumPanes = 2
+ Configuration = "(H (2 [66] 3))"
+ End
+ Begin PaneConfiguration = 6
+ NumPanes = 2
+ Configuration = "(H (4 [50] 3))"
+ End
+ Begin PaneConfiguration = 7
+ NumPanes = 1
+ Configuration = "(V (3))"
+ End
+ Begin PaneConfiguration = 8
+ NumPanes = 3
+ Configuration = "(H (1[56] 4[18] 2) )"
+ End
+ Begin PaneConfiguration = 9
+ NumPanes = 2
+ Configuration = "(H (1 [75] 4))"
+ End
+ Begin PaneConfiguration = 10
+ NumPanes = 2
+ Configuration = "(H (1[66] 2) )"
+ End
+ Begin PaneConfiguration = 11
+ NumPanes = 2
+ Configuration = "(H (4 [60] 2))"
+ End
+ Begin PaneConfiguration = 12
+ NumPanes = 1
+ Configuration = "(H (1) )"
+ End
+ Begin PaneConfiguration = 13
+ NumPanes = 1
+ Configuration = "(V (4))"
+ End
+ Begin PaneConfiguration = 14
+ NumPanes = 1
+ Configuration = "(V (2))"
+ End
+ ActivePaneConfig = 0
+ End
+ Begin DiagramPane =
+ Begin Origin =
+ Top = 0
+ Left = 0
+ End
+ Begin Tables =
+ Begin Table = "v_elencoIntervFilt"
+ Begin Extent =
+ Top = 6
+ Left = 38
+ Bottom = 391
+ Right = 223
+ End
+ DisplayFlags = 280
+ TopColumn = 0
+ End
+ End
+ End
+ Begin SQLPane =
+ End
+ Begin DataPane =
+ Begin ParameterDefaults = ""
+ End
+ Begin ColumnWidths = 9
+ Width = 284
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 2235
+ Width = 3210
+ Width = 1500
+ End
+ End
+ Begin CriteriaPane =
+ Begin ColumnWidths = 12
+ Column = 1440
+ Alias = 900
+ Table = 1170
+ Output = 720
+ Append = 1400
+ NewValue = 1170
+ SortType = 1350
+ SortOrder = 1410
+ GroupBy = 1350
+ Filter = 1350
+ Or = 1350
+ Or = 1350
+ Or = 1350
+ End
+ End
+End
+', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'v_datiMTBFMTTR';
+
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPaneCount', @value = 1, @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'v_datiMTBFMTTR';
+
diff --git a/Projects/GimDB/dbo/Views/v_elencoImpiantiMacchine.sql b/Projects/GimDB/dbo/Views/v_elencoImpiantiMacchine.sql
new file mode 100644
index 0000000..8febe66
--- /dev/null
+++ b/Projects/GimDB/dbo/Views/v_elencoImpiantiMacchine.sql
@@ -0,0 +1,145 @@
+CREATE VIEW v_elencoImpiantiMacchine
+AS
+SELECT dbo.AnagImpianti.codImpianto, dbo.AnagImpianti.nomeImpianto, dbo.AnagImpianti.tipoImpianto, dbo.AnagMacchine.codMacchina, dbo.AnagMacchine.nomeMacchina,
+ dbo.AnagMacchine.modello, ISNULL(dbo.AnagMacchine.matricola, 'n.d.') AS matricola, dbo.AnagMacchine.anno, dbo.AnagMacchine.kgPeso,
+ dbo.AnagMacchine.kwConsumo
+FROM dbo.AnagImpianti INNER JOIN
+ dbo.AnagMacchine ON dbo.AnagImpianti.idxImpianto = dbo.AnagMacchine.idxImpianto
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPane1', @value = N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
+Begin DesignProperties =
+ Begin PaneConfigurations =
+ Begin PaneConfiguration = 0
+ NumPanes = 4
+ Configuration = "(H (1[40] 4[20] 2[20] 3) )"
+ End
+ Begin PaneConfiguration = 1
+ NumPanes = 3
+ Configuration = "(H (1 [50] 4 [25] 3))"
+ End
+ Begin PaneConfiguration = 2
+ NumPanes = 3
+ Configuration = "(H (1 [50] 2 [25] 3))"
+ End
+ Begin PaneConfiguration = 3
+ NumPanes = 3
+ Configuration = "(H (4 [30] 2 [40] 3))"
+ End
+ Begin PaneConfiguration = 4
+ NumPanes = 2
+ Configuration = "(H (1 [56] 3))"
+ End
+ Begin PaneConfiguration = 5
+ NumPanes = 2
+ Configuration = "(H (2 [66] 3))"
+ End
+ Begin PaneConfiguration = 6
+ NumPanes = 2
+ Configuration = "(H (4 [50] 3))"
+ End
+ Begin PaneConfiguration = 7
+ NumPanes = 1
+ Configuration = "(V (3))"
+ End
+ Begin PaneConfiguration = 8
+ NumPanes = 3
+ Configuration = "(H (1[56] 4[18] 2) )"
+ End
+ Begin PaneConfiguration = 9
+ NumPanes = 2
+ Configuration = "(H (1 [75] 4))"
+ End
+ Begin PaneConfiguration = 10
+ NumPanes = 2
+ Configuration = "(H (1[66] 2) )"
+ End
+ Begin PaneConfiguration = 11
+ NumPanes = 2
+ Configuration = "(H (4 [60] 2))"
+ End
+ Begin PaneConfiguration = 12
+ NumPanes = 1
+ Configuration = "(H (1) )"
+ End
+ Begin PaneConfiguration = 13
+ NumPanes = 1
+ Configuration = "(V (4))"
+ End
+ Begin PaneConfiguration = 14
+ NumPanes = 1
+ Configuration = "(V (2))"
+ End
+ ActivePaneConfig = 0
+ End
+ Begin DiagramPane =
+ Begin Origin =
+ Top = 0
+ Left = 0
+ End
+ Begin Tables =
+ Begin Table = "AnagImpianti"
+ Begin Extent =
+ Top = 6
+ Left = 38
+ Bottom = 171
+ Right = 189
+ End
+ DisplayFlags = 280
+ TopColumn = 0
+ End
+ Begin Table = "AnagMacchine"
+ Begin Extent =
+ Top = 6
+ Left = 227
+ Bottom = 207
+ Right = 378
+ End
+ DisplayFlags = 280
+ TopColumn = 0
+ End
+ End
+ End
+ Begin SQLPane =
+ End
+ Begin DataPane =
+ Begin ParameterDefaults = ""
+ End
+ Begin ColumnWidths = 11
+ Width = 284
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ End
+ End
+ Begin CriteriaPane =
+ Begin ColumnWidths = 11
+ Column = 1440
+ Alias = 900
+ Table = 1170
+ Output = 720
+ Append = 1400
+ NewValue = 1170
+ SortType = 1350
+ SortOrder = 1410
+ GroupBy = 1350
+ Filter = 1350
+ Or = 1350
+ Or = 1350
+ Or = 1350
+ End
+ End
+End
+', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'v_elencoImpiantiMacchine';
+
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPaneCount', @value = 1, @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'v_elencoImpiantiMacchine';
+
diff --git a/Projects/GimDB/dbo/Views/v_elencoIntervFilt.sql b/Projects/GimDB/dbo/Views/v_elencoIntervFilt.sql
new file mode 100644
index 0000000..e5ad917
--- /dev/null
+++ b/Projects/GimDB/dbo/Views/v_elencoIntervFilt.sql
@@ -0,0 +1,253 @@
+
+CREATE VIEW v_elencoIntervFilt
+AS
+SELECT TOP (100) PERCENT dbo.InterventiMtz.numIntMtz, dbo.InterventiMtz.richiesta, dbo.AnagImpianti.codImpianto, dbo.AnagImpianti.nomeImpianto,
+ dbo.AnagMacchine.codMacchina, dbo.AnagMacchine.nomeMacchina, dbo.InterventiMtz.descrizione, dbo.InterventiMtz.inizioIntervento,
+ dbo.InterventiMtz.fineIntervento, ISNULL(dbo.InterventiMtz.descrizioneIntervento, 'n.d. (report mtz)') AS descrizioneIntervento,
+ ISNULL(dbo.AnagCausali.descrCausale, 'n.d. (causale)') AS descrCausale, ROUND(CAST(ISNULL(dbo.v_interventiErogati.totMinErogati, 0) AS float) / 60, 2)
+ AS minErogati, dbo.f_diffOreLavorative(dbo.InterventiMtz.inizioIntervento, dbo.InterventiMtz.fineIntervento, dbo.InterventiMtz.idxMacchina) AS durataMtz,
+ CASE (isFermo) WHEN 1 THEN dbo.f_diffOreLavorative(dbo.InterventiMtz.guasto, dbo.InterventiMtz.fineIntervento, InterventiMtz.idxMacchina)
+ WHEN 0 THEN dbo.f_diffOreLavorative(dbo.InterventiMtz.inizioIntervento, dbo.InterventiMtz.fineIntervento, InterventiMtz.idxMacchina) END AS durataOff,
+ dbo.InterventiMtz.guasto, dbo.InterventiMtz.idxStato, dbo.InterventiMtz.idxImpianto, dbo.InterventiMtz.idxMacchina, dbo.InterventiMtz.isFermo,
+ dbo.InterventiMtz.scheduled
+FROM dbo.InterventiMtz INNER JOIN
+ dbo.AnagAmbitoGuasto ON dbo.InterventiMtz.idxAmbito = dbo.AnagAmbitoGuasto.idxAmbito INNER JOIN
+ dbo.AnagImpianti ON dbo.InterventiMtz.idxImpianto = dbo.AnagImpianti.idxImpianto INNER JOIN
+ dbo.AnagMacchine ON dbo.InterventiMtz.idxMacchina = dbo.AnagMacchine.idxMacchina INNER JOIN
+ dbo.AnagTipoGuasto ON dbo.InterventiMtz.idxTipo = dbo.AnagTipoGuasto.idxTipo INNER JOIN
+ dbo.AnagPriorita ON dbo.InterventiMtz.idxPriorita = dbo.AnagPriorita.idxPriorita INNER JOIN
+ dbo.AnagStati ON dbo.InterventiMtz.idxStato = dbo.AnagStati.idxStato LEFT OUTER JOIN
+ dbo.v_interventiErogati ON dbo.InterventiMtz.numIntMtz = dbo.v_interventiErogati.numIntMtz LEFT OUTER JOIN
+ dbo.AnagCausali ON dbo.InterventiMtz.idxCausale = dbo.AnagCausali.idxCausale
+ORDER BY dbo.InterventiMtz.numIntMtz DESC
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPane1', @value = '[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
+Begin DesignProperties =
+ Begin PaneConfigurations =
+ Begin PaneConfiguration = 0
+ NumPanes = 4
+ Configuration = "(H (1[40] 4[20] 2[20] 3) )"
+ End
+ Begin PaneConfiguration = 1
+ NumPanes = 3
+ Configuration = "(H (1 [50] 4 [25] 3))"
+ End
+ Begin PaneConfiguration = 2
+ NumPanes = 3
+ Configuration = "(H (1 [50] 2 [25] 3))"
+ End
+ Begin PaneConfiguration = 3
+ NumPanes = 3
+ Configuration = "(H (4 [30] 2 [40] 3))"
+ End
+ Begin PaneConfiguration = 4
+ NumPanes = 2
+ Configuration = "(H (1 [56] 3))"
+ End
+ Begin PaneConfiguration = 5
+ NumPanes = 2
+ Configuration = "(H (2 [66] 3))"
+ End
+ Begin PaneConfiguration = 6
+ NumPanes = 2
+ Configuration = "(H (4 [50] 3))"
+ End
+ Begin PaneConfiguration = 7
+ NumPanes = 1
+ Configuration = "(V (3))"
+ End
+ Begin PaneConfiguration = 8
+ NumPanes = 3
+ Configuration = "(H (1[56] 4[18] 2) )"
+ End
+ Begin PaneConfiguration = 9
+ NumPanes = 2
+ Configuration = "(H (1 [75] 4))"
+ End
+ Begin PaneConfiguration = 10
+ NumPanes = 2
+ Configuration = "(H (1[66] 2) )"
+ End
+ Begin PaneConfiguration = 11
+ NumPanes = 2
+ Configuration = "(H (4 [60] 2))"
+ End
+ Begin PaneConfiguration = 12
+ NumPanes = 1
+ Configuration = "(H (1) )"
+ End
+ Begin PaneConfiguration = 13
+ NumPanes = 1
+ Configuration = "(V (4))"
+ End
+ Begin PaneConfiguration = 14
+ NumPanes = 1
+ Configuration = "(V (2))"
+ End
+ ActivePaneConfig = 0
+ End
+ Begin DiagramPane =
+ Begin Origin =
+ Top = 0
+ Left = 0
+ End
+ Begin Tables =
+ Begin Table = "AnagAmbitoGuasto"
+ Begin Extent =
+ Top = 11
+ Left = 82
+ Bottom = 89
+ Right = 255
+ End
+ DisplayFlags = 280
+ TopColumn = 0
+ End
+ Begin Table = "AnagImpianti"
+ Begin Extent =
+ Top = 123
+ Left = 219
+ Bottom = 231
+ Right = 370
+ End
+ DisplayFlags = 280
+ TopColumn = 0
+ End
+ Begin Table = "AnagMacchine"
+ Begin Extent =
+ Top = 190
+ Left = 826
+ Bottom = 298
+ Right = 977
+ End
+ DisplayFlags = 280
+ TopColumn = 0
+ End
+ Begin Table = "AnagTipoGuasto"
+ Begin Extent =
+ Top = 90
+ Left = 1143
+ Bottom = 168
+ Right = 1294
+ End
+ DisplayFlags = 280
+ TopColumn = 0
+ End
+ Begin Table = "AnagPriorita"
+ Begin Extent =
+ Top = 23
+ Left = 958
+ Bottom = 116
+ Right = 1109
+ End
+ DisplayFlags = 280
+ TopColumn = 0
+ End
+ Begin Table = "AnagStati"
+ Begin Extent =
+ Top = 263
+ Left = 90
+ Bottom = 356
+ Right = 241
+ End
+ DisplayFlags = 280
+ TopColumn = 0
+ End
+ Begin Table = "v_interventiErogati"
+ Begin Extent =
+ Top = 3
+ Left = 739
+ Bottom = 81
+ Right = 890
+ ', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'v_elencoIntervFilt';
+
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPane2', @value = ' End
+ DisplayFlags = 280
+ TopColumn = 0
+ End
+ Begin Table = "AnagCausali"
+ Begin Extent =
+ Top = 291
+ Left = 1011
+ Bottom = 369
+ Right = 1162
+ End
+ DisplayFlags = 280
+ TopColumn = 0
+ End
+ Begin Table = "InterventiMtz"
+ Begin Extent =
+ Top = 8
+ Left = 486
+ Bottom = 354
+ Right = 671
+ End
+ DisplayFlags = 280
+ TopColumn = 0
+ End
+ End
+ End
+ Begin SQLPane =
+ End
+ Begin DataPane =
+ Begin ParameterDefaults = ""
+ End
+ Begin ColumnWidths = 30
+ Width = 284
+ Width = 915
+ Width = 1815
+ Width = 690
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1665
+ Width = 1665
+ Width = 1500
+ Width = 1500
+ Width = 1050
+ Width = 1020
+ Width = 1125
+ Width = 1815
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ End
+ End
+ Begin CriteriaPane =
+ Begin ColumnWidths = 11
+ Column = 1440
+ Alias = 900
+ Table = 1170
+ Output = 720
+ Append = 1400
+ NewValue = 1170
+ SortType = 1350
+ SortOrder = 1410
+ GroupBy = 1350
+ Filter = 1350
+ Or = 1350
+ Or = 1350
+ Or = 1350
+ End
+ End
+End
+', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'v_elencoIntervFilt';
+
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPaneCount', @value = 2, @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'v_elencoIntervFilt';
+
diff --git a/Projects/GimDB/dbo/Views/v_intervExp.sql b/Projects/GimDB/dbo/Views/v_intervExp.sql
new file mode 100644
index 0000000..f18945a
--- /dev/null
+++ b/Projects/GimDB/dbo/Views/v_intervExp.sql
@@ -0,0 +1,240 @@
+CREATE VIEW dbo.v_intervExp
+AS
+SELECT TOP (100) PERCENT dbo.InterventiMtz.numIntMtz, dbo.InterventiMtz.richiesta, dbo.InterventiMtz.dataLav, dbo.InterventiMtz.turnoLav, dbo.InterventiMtz.matr,
+ dbo.InterventiMtz.guasto, dbo.InterventiMtz.idxAmbito, dbo.AnagAmbitoGuasto.descrAmbitoGuasto, dbo.InterventiMtz.idxPriorita, dbo.AnagPriorita.descrPriorita,
+ CASE dbo.InterventiMtz.isFermo WHEN 'True' THEN 'SI' ELSE 'NO' END AS isFermoSiNo, dbo.InterventiMtz.idxTipo, dbo.AnagTipoGuasto.descrTipo,
+ dbo.InterventiMtz.idxImpianto, dbo.AnagImpianti.codImpianto, dbo.AnagImpianti.nomeImpianto, dbo.InterventiMtz.idxMacchina, dbo.AnagMacchine.codMacchina,
+ dbo.AnagMacchine.nomeMacchina, dbo.InterventiMtz.descrizione, dbo.InterventiMtz.idxStato, dbo.AnagStati.DescrStato, ISNULL(dbo.InterventiMtz.presaInCarico,
+ dbo.InterventiMtz.richiesta) AS presaInCarico, ISNULL(dbo.InterventiMtz.inizioIntervento, ISNULL(dbo.InterventiMtz.presaInCarico, dbo.InterventiMtz.richiesta))
+ AS inizioIntervento, ISNULL(dbo.InterventiMtz.fineIntervento, GETDATE()) AS fineIntervento, dbo.InterventiMtz.descrizioneIntervento,
+ dbo.InterventiMtz.isPreventivabile, dbo.InterventiMtz.idxCausale, ISNULL(dbo.AnagCausali.descrCausale, 'N.D.') AS descrCausale, dbo.InterventiMtz.isFermo
+FROM dbo.InterventiMtz INNER JOIN
+ dbo.AnagAmbitoGuasto ON dbo.InterventiMtz.idxAmbito = dbo.AnagAmbitoGuasto.idxAmbito INNER JOIN
+ dbo.AnagImpianti ON dbo.InterventiMtz.idxImpianto = dbo.AnagImpianti.idxImpianto INNER JOIN
+ dbo.AnagMacchine ON dbo.InterventiMtz.idxMacchina = dbo.AnagMacchine.idxMacchina INNER JOIN
+ dbo.AnagTipoGuasto ON dbo.InterventiMtz.idxTipo = dbo.AnagTipoGuasto.idxTipo INNER JOIN
+ dbo.AnagPriorita ON dbo.InterventiMtz.idxPriorita = dbo.AnagPriorita.idxPriorita INNER JOIN
+ dbo.AnagStati ON dbo.InterventiMtz.idxStato = dbo.AnagStati.idxStato LEFT OUTER JOIN
+ dbo.AnagCausali ON dbo.InterventiMtz.idxCausale = dbo.AnagCausali.idxCausale
+ORDER BY dbo.InterventiMtz.numIntMtz DESC
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPane1', @value = N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
+Begin DesignProperties =
+ Begin PaneConfigurations =
+ Begin PaneConfiguration = 0
+ NumPanes = 4
+ Configuration = "(H (1[40] 4[20] 2[20] 3) )"
+ End
+ Begin PaneConfiguration = 1
+ NumPanes = 3
+ Configuration = "(H (1 [50] 4 [25] 3))"
+ End
+ Begin PaneConfiguration = 2
+ NumPanes = 3
+ Configuration = "(H (1 [50] 2 [25] 3))"
+ End
+ Begin PaneConfiguration = 3
+ NumPanes = 3
+ Configuration = "(H (4 [30] 2 [40] 3))"
+ End
+ Begin PaneConfiguration = 4
+ NumPanes = 2
+ Configuration = "(H (1 [56] 3))"
+ End
+ Begin PaneConfiguration = 5
+ NumPanes = 2
+ Configuration = "(H (2 [66] 3))"
+ End
+ Begin PaneConfiguration = 6
+ NumPanes = 2
+ Configuration = "(H (4 [50] 3))"
+ End
+ Begin PaneConfiguration = 7
+ NumPanes = 1
+ Configuration = "(V (3))"
+ End
+ Begin PaneConfiguration = 8
+ NumPanes = 3
+ Configuration = "(H (1[56] 4[18] 2) )"
+ End
+ Begin PaneConfiguration = 9
+ NumPanes = 2
+ Configuration = "(H (1 [75] 4))"
+ End
+ Begin PaneConfiguration = 10
+ NumPanes = 2
+ Configuration = "(H (1[66] 2) )"
+ End
+ Begin PaneConfiguration = 11
+ NumPanes = 2
+ Configuration = "(H (4 [60] 2))"
+ End
+ Begin PaneConfiguration = 12
+ NumPanes = 1
+ Configuration = "(H (1) )"
+ End
+ Begin PaneConfiguration = 13
+ NumPanes = 1
+ Configuration = "(V (4))"
+ End
+ Begin PaneConfiguration = 14
+ NumPanes = 1
+ Configuration = "(V (2))"
+ End
+ ActivePaneConfig = 0
+ End
+ Begin DiagramPane =
+ Begin Origin =
+ Top = 0
+ Left = 0
+ End
+ Begin Tables =
+ Begin Table = "InterventiMtz"
+ Begin Extent =
+ Top = 5
+ Left = 576
+ Bottom = 360
+ Right = 761
+ End
+ DisplayFlags = 280
+ TopColumn = 0
+ End
+ Begin Table = "AnagAmbitoGuasto"
+ Begin Extent =
+ Top = 4
+ Left = 213
+ Bottom = 82
+ Right = 386
+ End
+ DisplayFlags = 280
+ TopColumn = 0
+ End
+ Begin Table = "AnagImpianti"
+ Begin Extent =
+ Top = 113
+ Left = 834
+ Bottom = 221
+ Right = 985
+ End
+ DisplayFlags = 280
+ TopColumn = 0
+ End
+ Begin Table = "AnagMacchine"
+ Begin Extent =
+ Top = 181
+ Left = 227
+ Bottom = 289
+ Right = 378
+ End
+ DisplayFlags = 280
+ TopColumn = 0
+ End
+ Begin Table = "AnagTipoGuasto"
+ Begin Extent =
+ Top = 91
+ Left = 228
+ Bottom = 169
+ Right = 379
+ End
+ DisplayFlags = 280
+ TopColumn = 0
+ End
+ Begin Table = "AnagPriorita"
+ Begin Extent =
+ Top = 19
+ Left = 834
+ Bottom = 97
+ Right = 985
+ End
+ DisplayFlags = 280
+ TopColumn = 0
+ End
+ Begin Table = "AnagStati"
+ Begin Extent =
+ Top = 237
+ Left = 834
+ Bottom = 315
+ Right = 985
+ ', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'v_intervExp';
+
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPane2', @value = N' End
+ DisplayFlags = 280
+ TopColumn = 0
+ End
+ Begin Table = "AnagCausali"
+ Begin Extent =
+ Top = 295
+ Left = 235
+ Bottom = 373
+ Right = 386
+ End
+ DisplayFlags = 280
+ TopColumn = 0
+ End
+ End
+ End
+ Begin SQLPane =
+ End
+ Begin DataPane =
+ Begin ParameterDefaults = ""
+ End
+ Begin ColumnWidths = 30
+ Width = 284
+ Width = 1500
+ Width = 1665
+ Width = 1185
+ Width = 1500
+ Width = 1500
+ Width = 1830
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ End
+ End
+ Begin CriteriaPane =
+ Begin ColumnWidths = 11
+ Column = 1440
+ Alias = 900
+ Table = 1170
+ Output = 720
+ Append = 1400
+ NewValue = 1170
+ SortType = 1350
+ SortOrder = 1410
+ GroupBy = 1350
+ Filter = 1350
+ Or = 1350
+ Or = 1350
+ Or = 1350
+ End
+ End
+End
+', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'v_intervExp';
+
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPaneCount', @value = 2, @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'v_intervExp';
+
diff --git a/Projects/GimDB/dbo/Views/v_interventiErogati.sql b/Projects/GimDB/dbo/Views/v_interventiErogati.sql
new file mode 100644
index 0000000..6c74b3f
--- /dev/null
+++ b/Projects/GimDB/dbo/Views/v_interventiErogati.sql
@@ -0,0 +1,133 @@
+
+CREATE VIEW [dbo].[v_interventiErogati]
+AS
+SELECT numIntMtz
+ ,SUM(durataMinuti) AS totMinErogati
+FROM dbo.InterventoOpMtz
+GROUP BY numIntMtz
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPane1', @value = N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
+Begin DesignProperties =
+ Begin PaneConfigurations =
+ Begin PaneConfiguration = 0
+ NumPanes = 4
+ Configuration = "(H (1[40] 4[20] 2[20] 3) )"
+ End
+ Begin PaneConfiguration = 1
+ NumPanes = 3
+ Configuration = "(H (1 [50] 4 [25] 3))"
+ End
+ Begin PaneConfiguration = 2
+ NumPanes = 3
+ Configuration = "(H (1 [50] 2 [25] 3))"
+ End
+ Begin PaneConfiguration = 3
+ NumPanes = 3
+ Configuration = "(H (4 [30] 2 [40] 3))"
+ End
+ Begin PaneConfiguration = 4
+ NumPanes = 2
+ Configuration = "(H (1 [56] 3))"
+ End
+ Begin PaneConfiguration = 5
+ NumPanes = 2
+ Configuration = "(H (2 [66] 3))"
+ End
+ Begin PaneConfiguration = 6
+ NumPanes = 2
+ Configuration = "(H (4 [50] 3))"
+ End
+ Begin PaneConfiguration = 7
+ NumPanes = 1
+ Configuration = "(V (3))"
+ End
+ Begin PaneConfiguration = 8
+ NumPanes = 3
+ Configuration = "(H (1[56] 4[18] 2) )"
+ End
+ Begin PaneConfiguration = 9
+ NumPanes = 2
+ Configuration = "(H (1 [75] 4))"
+ End
+ Begin PaneConfiguration = 10
+ NumPanes = 2
+ Configuration = "(H (1[66] 2) )"
+ End
+ Begin PaneConfiguration = 11
+ NumPanes = 2
+ Configuration = "(H (4 [60] 2))"
+ End
+ Begin PaneConfiguration = 12
+ NumPanes = 1
+ Configuration = "(H (1) )"
+ End
+ Begin PaneConfiguration = 13
+ NumPanes = 1
+ Configuration = "(V (4))"
+ End
+ Begin PaneConfiguration = 14
+ NumPanes = 1
+ Configuration = "(V (2))"
+ End
+ ActivePaneConfig = 0
+ End
+ Begin DiagramPane =
+ Begin Origin =
+ Top = 0
+ Left = 0
+ End
+ Begin Tables =
+ Begin Table = "InterventoOpMtz"
+ Begin Extent =
+ Top = 6
+ Left = 38
+ Bottom = 99
+ Right = 189
+ End
+ DisplayFlags = 280
+ TopColumn = 0
+ End
+ End
+ End
+ Begin SQLPane =
+ End
+ Begin DataPane =
+ Begin ParameterDefaults = ""
+ End
+ Begin ColumnWidths = 9
+ Width = 284
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ End
+ End
+ Begin CriteriaPane =
+ Begin ColumnWidths = 12
+ Column = 1440
+ Alias = 900
+ Table = 1170
+ Output = 720
+ Append = 1400
+ NewValue = 1170
+ SortType = 1350
+ SortOrder = 1410
+ GroupBy = 1350
+ Filter = 1350
+ Or = 1350
+ Or = 1350
+ Or = 1350
+ End
+ End
+End
+', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'v_interventiErogati';
+
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPaneCount', @value = 1, @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'v_interventiErogati';
+
diff --git a/Projects/GimDB/dbo/Views/v_macchine.sql b/Projects/GimDB/dbo/Views/v_macchine.sql
new file mode 100644
index 0000000..ad95a43
--- /dev/null
+++ b/Projects/GimDB/dbo/Views/v_macchine.sql
@@ -0,0 +1,7 @@
+CREATE VIEW dbo.v_macchine
+AS
+SELECT dbo.AnagMacchine.idxMacchina, dbo.AnagMacchine.idxImpianto, dbo.AnagMacchine.codMacchina, dbo.AnagMacchine.nomeMacchina, dbo.AnagMacchine.modello,
+ dbo.AnagMacchine.matricola, dbo.AnagMacchine.anno, dbo.AnagMacchine.kgPeso, dbo.AnagMacchine.kwConsumo, dbo.AnagMacchine.funzDal,
+ dbo.AnagMacchine.funzAl, dbo.AnagImpianti.codImpianto + ' - ' + dbo.AnagImpianti.nomeImpianto AS descrImpianto
+FROM dbo.AnagMacchine INNER JOIN
+ dbo.AnagImpianti ON dbo.AnagMacchine.idxImpianto = dbo.AnagImpianti.idxImpianto
diff --git a/Projects/GimDB/dbo/Views/v_mtzProgExp.sql b/Projects/GimDB/dbo/Views/v_mtzProgExp.sql
new file mode 100644
index 0000000..3b06063
--- /dev/null
+++ b/Projects/GimDB/dbo/Views/v_mtzProgExp.sql
@@ -0,0 +1,199 @@
+CREATE VIEW dbo.v_mtzProgExp
+AS
+SELECT dbo.MtzProgrammata.idxIntPro, dbo.AnagImpianti.idxImpianto, dbo.MtzProgrammata.idxMacchina, dbo.AnagImpianti.codImpianto, dbo.AnagImpianti.nomeImpianto, dbo.AnagMacchine.codMacchina,
+ dbo.AnagMacchine.nomeMacchina, dbo.MtzProgrammata.inizio, dbo.MtzProgrammata.codFrequenza, dbo.AnagFrequenze.frequenza, dbo.MtzProgrammata.cadenza, dbo.MtzProgrammata.descrizione,
+ dbo.MtzProgrammata.idxPriorita, dbo.AnagPriorita.descrPriorita, dbo.MtzProgrammata.isFermo, dbo.MtzProgrammata.idxTipo, dbo.AnagTipoGuasto.descrTipo
+FROM dbo.MtzProgrammata INNER JOIN
+ dbo.AnagMacchine ON dbo.MtzProgrammata.idxMacchina = dbo.AnagMacchine.idxMacchina INNER JOIN
+ dbo.AnagFrequenze ON dbo.MtzProgrammata.codFrequenza = dbo.AnagFrequenze.codFrequenza INNER JOIN
+ dbo.AnagPriorita ON dbo.MtzProgrammata.idxPriorita = dbo.AnagPriorita.idxPriorita INNER JOIN
+ dbo.AnagTipoGuasto ON dbo.MtzProgrammata.idxTipo = dbo.AnagTipoGuasto.idxTipo INNER JOIN
+ dbo.AnagImpianti ON dbo.AnagMacchine.idxImpianto = dbo.AnagImpianti.idxImpianto
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPane1', @value = N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
+Begin DesignProperties =
+ Begin PaneConfigurations =
+ Begin PaneConfiguration = 0
+ NumPanes = 4
+ Configuration = "(H (1[40] 4[20] 2[20] 3) )"
+ End
+ Begin PaneConfiguration = 1
+ NumPanes = 3
+ Configuration = "(H (1 [50] 4 [25] 3))"
+ End
+ Begin PaneConfiguration = 2
+ NumPanes = 3
+ Configuration = "(H (1 [50] 2 [25] 3))"
+ End
+ Begin PaneConfiguration = 3
+ NumPanes = 3
+ Configuration = "(H (4 [30] 2 [40] 3))"
+ End
+ Begin PaneConfiguration = 4
+ NumPanes = 2
+ Configuration = "(H (1 [56] 3))"
+ End
+ Begin PaneConfiguration = 5
+ NumPanes = 2
+ Configuration = "(H (2 [66] 3))"
+ End
+ Begin PaneConfiguration = 6
+ NumPanes = 2
+ Configuration = "(H (4 [50] 3))"
+ End
+ Begin PaneConfiguration = 7
+ NumPanes = 1
+ Configuration = "(V (3))"
+ End
+ Begin PaneConfiguration = 8
+ NumPanes = 3
+ Configuration = "(H (1[56] 4[18] 2) )"
+ End
+ Begin PaneConfiguration = 9
+ NumPanes = 2
+ Configuration = "(H (1 [75] 4))"
+ End
+ Begin PaneConfiguration = 10
+ NumPanes = 2
+ Configuration = "(H (1[66] 2) )"
+ End
+ Begin PaneConfiguration = 11
+ NumPanes = 2
+ Configuration = "(H (4 [60] 2))"
+ End
+ Begin PaneConfiguration = 12
+ NumPanes = 1
+ Configuration = "(H (1) )"
+ End
+ Begin PaneConfiguration = 13
+ NumPanes = 1
+ Configuration = "(V (4))"
+ End
+ Begin PaneConfiguration = 14
+ NumPanes = 1
+ Configuration = "(V (2))"
+ End
+ ActivePaneConfig = 0
+ End
+ Begin DiagramPane =
+ Begin Origin =
+ Top = 0
+ Left = 0
+ End
+ Begin Tables =
+ Begin Table = "MtzProgrammata"
+ Begin Extent =
+ Top = 6
+ Left = 38
+ Bottom = 275
+ Right = 189
+ End
+ DisplayFlags = 280
+ TopColumn = 0
+ End
+ Begin Table = "AnagMacchine"
+ Begin Extent =
+ Top = 213
+ Left = 288
+ Bottom = 321
+ Right = 439
+ End
+ DisplayFlags = 280
+ TopColumn = 0
+ End
+ Begin Table = "AnagFrequenze"
+ Begin Extent =
+ Top = 6
+ Left = 416
+ Bottom = 84
+ Right = 567
+ End
+ DisplayFlags = 280
+ TopColumn = 0
+ End
+ Begin Table = "AnagPriorita"
+ Begin Extent =
+ Top = 6
+ Left = 605
+ Bottom = 99
+ Right = 756
+ End
+ DisplayFlags = 280
+ TopColumn = 0
+ End
+ Begin Table = "AnagTipoGuasto"
+ Begin Extent =
+ Top = 6
+ Left = 794
+ Bottom = 84
+ Right = 945
+ End
+ DisplayFlags = 280
+ TopColumn = 0
+ End
+ Begin Table = "AnagImpianti"
+ Begin Extent =
+ Top = 137
+ Left = 581
+ Bottom = 267
+ Right = 751
+ End
+ DisplayFlags = 280
+ TopColumn = 0
+ End
+ End
+ End
+ Begin SQLPane =
+ End
+ Begin DataPane =
+ Begin ParameterDefaults = ""
+ End
+ Begin ColumnWidths = 17
+ Width = 284
+ Width = 1500', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'v_mtzProgExp';
+
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPane2', @value = N'
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ End
+ End
+ Begin CriteriaPane =
+ Begin ColumnWidths = 11
+ Column = 1440
+ Alias = 900
+ Table = 1170
+ Output = 720
+ Append = 1400
+ NewValue = 1170
+ SortType = 1350
+ SortOrder = 1410
+ GroupBy = 1350
+ Filter = 1350
+ Or = 1350
+ Or = 1350
+ Or = 1350
+ End
+ End
+End
+', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'v_mtzProgExp';
+
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPaneCount', @value = 2, @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'v_mtzProgExp';
+
diff --git a/Projects/GimDB/dbo/Views/v_mtzProgPendingExp.sql b/Projects/GimDB/dbo/Views/v_mtzProgPendingExp.sql
new file mode 100644
index 0000000..45d2ef2
--- /dev/null
+++ b/Projects/GimDB/dbo/Views/v_mtzProgPendingExp.sql
@@ -0,0 +1,184 @@
+CREATE VIEW [dbo].[v_mtzProgPendingExp]
+AS
+
+
+SELECT TOP (100) PERCENT dbo.MtzProgPending.idxPending, dbo.AnagImpianti.codImpianto, dbo.AnagImpianti.nomeImpianto, dbo.AnagMacchine.codMacchina,
+ dbo.AnagMacchine.nomeMacchina, dbo.MtzProgPending.data, dbo.MtzProgPending.descrizione, dbo.AnagPriorita.descrPriorita, dbo.MtzProgPending.isFermo,
+ dbo.AnagTipoGuasto.descrTipo, dbo.AnagTipoGuasto.idxTipo, dbo.AnagMacchine.idxMacchina, dbo.AnagMacchine.idxImpianto
+FROM dbo.MtzProgPending INNER JOIN
+ dbo.AnagMacchine ON dbo.MtzProgPending.idxMacchina = dbo.AnagMacchine.idxMacchina INNER JOIN
+ dbo.AnagImpianti ON dbo.AnagMacchine.idxImpianto = dbo.AnagImpianti.idxImpianto INNER JOIN
+ dbo.AnagTipoGuasto ON dbo.MtzProgPending.idxTipo = dbo.AnagTipoGuasto.idxTipo INNER JOIN
+ dbo.AnagPriorita ON dbo.MtzProgPending.idxPriorita = dbo.AnagPriorita.idxPriorita
+ORDER BY dbo.MtzProgPending.data
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPane1', @value = '[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
+Begin DesignProperties =
+ Begin PaneConfigurations =
+ Begin PaneConfiguration = 0
+ NumPanes = 4
+ Configuration = "(H (1[40] 4[20] 2[20] 3) )"
+ End
+ Begin PaneConfiguration = 1
+ NumPanes = 3
+ Configuration = "(H (1 [50] 4 [25] 3))"
+ End
+ Begin PaneConfiguration = 2
+ NumPanes = 3
+ Configuration = "(H (1 [50] 2 [25] 3))"
+ End
+ Begin PaneConfiguration = 3
+ NumPanes = 3
+ Configuration = "(H (4 [30] 2 [40] 3))"
+ End
+ Begin PaneConfiguration = 4
+ NumPanes = 2
+ Configuration = "(H (1 [56] 3))"
+ End
+ Begin PaneConfiguration = 5
+ NumPanes = 2
+ Configuration = "(H (2 [66] 3))"
+ End
+ Begin PaneConfiguration = 6
+ NumPanes = 2
+ Configuration = "(H (4 [50] 3))"
+ End
+ Begin PaneConfiguration = 7
+ NumPanes = 1
+ Configuration = "(V (3))"
+ End
+ Begin PaneConfiguration = 8
+ NumPanes = 3
+ Configuration = "(H (1[56] 4[18] 2) )"
+ End
+ Begin PaneConfiguration = 9
+ NumPanes = 2
+ Configuration = "(H (1 [75] 4))"
+ End
+ Begin PaneConfiguration = 10
+ NumPanes = 2
+ Configuration = "(H (1[66] 2) )"
+ End
+ Begin PaneConfiguration = 11
+ NumPanes = 2
+ Configuration = "(H (4 [60] 2))"
+ End
+ Begin PaneConfiguration = 12
+ NumPanes = 1
+ Configuration = "(H (1) )"
+ End
+ Begin PaneConfiguration = 13
+ NumPanes = 1
+ Configuration = "(V (4))"
+ End
+ Begin PaneConfiguration = 14
+ NumPanes = 1
+ Configuration = "(V (2))"
+ End
+ ActivePaneConfig = 0
+ End
+ Begin DiagramPane =
+ Begin Origin =
+ Top = 0
+ Left = 0
+ End
+ Begin Tables =
+ Begin Table = "MtzProgPending"
+ Begin Extent =
+ Top = 57
+ Left = 597
+ Bottom = 228
+ Right = 748
+ End
+ DisplayFlags = 280
+ TopColumn = 0
+ End
+ Begin Table = "AnagMacchine"
+ Begin Extent =
+ Top = 33
+ Left = 341
+ Bottom = 253
+ Right = 492
+ End
+ DisplayFlags = 280
+ TopColumn = 0
+ End
+ Begin Table = "AnagImpianti"
+ Begin Extent =
+ Top = 83
+ Left = 127
+ Bottom = 226
+ Right = 278
+ End
+ DisplayFlags = 280
+ TopColumn = 0
+ End
+ Begin Table = "AnagTipoGuasto"
+ Begin Extent =
+ Top = 182
+ Left = 869
+ Bottom = 260
+ Right = 1020
+ End
+ DisplayFlags = 280
+ TopColumn = 0
+ End
+ Begin Table = "AnagPriorita"
+ Begin Extent =
+ Top = 16
+ Left = 874
+ Bottom = 109
+ Right = 1025
+ End
+ DisplayFlags = 280
+ TopColumn = 0
+ End
+ End
+ End
+ Begin SQLPane =
+ End
+ Begin DataPane =
+ Begin ParameterDefaults = ""
+ End
+ Begin ColumnWidths = 10
+ Width = 284
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ End
+ End
+ Begin CriteriaPane =
+ Begin ColumnWidths = 1', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'v_mtzProgPendingExp';
+
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPane2', @value = '1
+ Column = 1440
+ Alias = 900
+ Table = 1170
+ Output = 720
+ Append = 1400
+ NewValue = 1170
+ SortType = 1350
+ SortOrder = 1410
+ GroupBy = 1350
+ Filter = 1350
+ Or = 1350
+ Or = 1350
+ Or = 1350
+ End
+ End
+End
+', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'v_mtzProgPendingExp';
+
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPaneCount', @value = 2, @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'v_mtzProgPendingExp';
+
diff --git a/Projects/GimDB/dbo/Views/v_reportSemestraleFix.sql b/Projects/GimDB/dbo/Views/v_reportSemestraleFix.sql
new file mode 100644
index 0000000..3edcc9c
--- /dev/null
+++ b/Projects/GimDB/dbo/Views/v_reportSemestraleFix.sql
@@ -0,0 +1,133 @@
+CREATE VIEW dbo.v_reportSemestraleFix
+AS
+SELECT numIntMtz AS 'Richiesta Webgim Nr.', codImpianto AS 'Codice Reparto', nomeImpianto AS 'Reparto', nomeMacchina AS 'Descrizione Macchina ', codMacchina AS 'Codice macchina', dbo.f_fixCR(descrizione)
+ AS 'Descrizione Guasto', dbo.f_fixCR(descrizioneIntervento) AS 'Descrizione Intervento MTZ', guasto AS 'Ora Guasto', richiesta AS 'Ora Richiesta Webgim', inizioIntervento AS 'Ora Inizio Intervento',
+ fineIntervento AS 'Ora Fine Intervento', durataMtz AS 'Ore intervento MTZ', durataOff AS 'Ore fermo Officina', minErogati AS 'Ore operatori MTZ'
+FROM dbo.v_elencoIntervFilt
+WHERE (guasto BETWEEN '20140101' AND '20140701')
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPane1', @value = N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
+Begin DesignProperties =
+ Begin PaneConfigurations =
+ Begin PaneConfiguration = 0
+ NumPanes = 4
+ Configuration = "(H (1[40] 4[20] 2[20] 3) )"
+ End
+ Begin PaneConfiguration = 1
+ NumPanes = 3
+ Configuration = "(H (1 [50] 4 [25] 3))"
+ End
+ Begin PaneConfiguration = 2
+ NumPanes = 3
+ Configuration = "(H (1 [50] 2 [25] 3))"
+ End
+ Begin PaneConfiguration = 3
+ NumPanes = 3
+ Configuration = "(H (4 [30] 2 [40] 3))"
+ End
+ Begin PaneConfiguration = 4
+ NumPanes = 2
+ Configuration = "(H (1 [56] 3))"
+ End
+ Begin PaneConfiguration = 5
+ NumPanes = 2
+ Configuration = "(H (2 [66] 3))"
+ End
+ Begin PaneConfiguration = 6
+ NumPanes = 2
+ Configuration = "(H (4 [50] 3))"
+ End
+ Begin PaneConfiguration = 7
+ NumPanes = 1
+ Configuration = "(V (3))"
+ End
+ Begin PaneConfiguration = 8
+ NumPanes = 3
+ Configuration = "(H (1[56] 4[18] 2) )"
+ End
+ Begin PaneConfiguration = 9
+ NumPanes = 2
+ Configuration = "(H (1 [75] 4))"
+ End
+ Begin PaneConfiguration = 10
+ NumPanes = 2
+ Configuration = "(H (1[66] 2) )"
+ End
+ Begin PaneConfiguration = 11
+ NumPanes = 2
+ Configuration = "(H (4 [60] 2))"
+ End
+ Begin PaneConfiguration = 12
+ NumPanes = 1
+ Configuration = "(H (1) )"
+ End
+ Begin PaneConfiguration = 13
+ NumPanes = 1
+ Configuration = "(V (4))"
+ End
+ Begin PaneConfiguration = 14
+ NumPanes = 1
+ Configuration = "(V (2))"
+ End
+ ActivePaneConfig = 0
+ End
+ Begin DiagramPane =
+ Begin Origin =
+ Top = 0
+ Left = 0
+ End
+ Begin Tables =
+ Begin Table = "v_elencoIntervFilt"
+ Begin Extent =
+ Top = 6
+ Left = 38
+ Bottom = 136
+ Right = 240
+ End
+ DisplayFlags = 280
+ TopColumn = 0
+ End
+ End
+ End
+ Begin SQLPane =
+ End
+ Begin DataPane =
+ Begin ParameterDefaults = ""
+ End
+ Begin ColumnWidths = 9
+ Width = 284
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ End
+ End
+ Begin CriteriaPane =
+ Begin ColumnWidths = 11
+ Column = 1440
+ Alias = 900
+ Table = 1170
+ Output = 720
+ Append = 1400
+ NewValue = 1170
+ SortType = 1350
+ SortOrder = 1410
+ GroupBy = 1350
+ Filter = 1350
+ Or = 1350
+ Or = 1350
+ Or = 1350
+ End
+ End
+End
+', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'v_reportSemestraleFix';
+
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPaneCount', @value = 1, @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'v_reportSemestraleFix';
+
diff --git a/Projects/GimDB/dbo/Views/v_risorseImpiegate.sql b/Projects/GimDB/dbo/Views/v_risorseImpiegate.sql
new file mode 100644
index 0000000..5b9c821
--- /dev/null
+++ b/Projects/GimDB/dbo/Views/v_risorseImpiegate.sql
@@ -0,0 +1,131 @@
+CREATE VIEW dbo.v_risorseImpiegate
+AS
+SELECT numIntMtz, SUM(TotImport) AS TotImport
+FROM dbo.ImpiegoRisorse
+GROUP BY numIntMtz
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPane1', @value = N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
+Begin DesignProperties =
+ Begin PaneConfigurations =
+ Begin PaneConfiguration = 0
+ NumPanes = 4
+ Configuration = "(H (1[40] 4[20] 2[20] 3) )"
+ End
+ Begin PaneConfiguration = 1
+ NumPanes = 3
+ Configuration = "(H (1 [50] 4 [25] 3))"
+ End
+ Begin PaneConfiguration = 2
+ NumPanes = 3
+ Configuration = "(H (1 [50] 2 [25] 3))"
+ End
+ Begin PaneConfiguration = 3
+ NumPanes = 3
+ Configuration = "(H (4 [30] 2 [40] 3))"
+ End
+ Begin PaneConfiguration = 4
+ NumPanes = 2
+ Configuration = "(H (1 [56] 3))"
+ End
+ Begin PaneConfiguration = 5
+ NumPanes = 2
+ Configuration = "(H (2 [66] 3))"
+ End
+ Begin PaneConfiguration = 6
+ NumPanes = 2
+ Configuration = "(H (4 [50] 3))"
+ End
+ Begin PaneConfiguration = 7
+ NumPanes = 1
+ Configuration = "(V (3))"
+ End
+ Begin PaneConfiguration = 8
+ NumPanes = 3
+ Configuration = "(H (1[56] 4[18] 2) )"
+ End
+ Begin PaneConfiguration = 9
+ NumPanes = 2
+ Configuration = "(H (1 [75] 4))"
+ End
+ Begin PaneConfiguration = 10
+ NumPanes = 2
+ Configuration = "(H (1[66] 2) )"
+ End
+ Begin PaneConfiguration = 11
+ NumPanes = 2
+ Configuration = "(H (4 [60] 2))"
+ End
+ Begin PaneConfiguration = 12
+ NumPanes = 1
+ Configuration = "(H (1) )"
+ End
+ Begin PaneConfiguration = 13
+ NumPanes = 1
+ Configuration = "(V (4))"
+ End
+ Begin PaneConfiguration = 14
+ NumPanes = 1
+ Configuration = "(V (2))"
+ End
+ ActivePaneConfig = 0
+ End
+ Begin DiagramPane =
+ Begin Origin =
+ Top = 0
+ Left = 0
+ End
+ Begin Tables =
+ Begin Table = "ImpiegoRisorse"
+ Begin Extent =
+ Top = 6
+ Left = 38
+ Bottom = 192
+ Right = 208
+ End
+ DisplayFlags = 280
+ TopColumn = 0
+ End
+ End
+ End
+ Begin SQLPane =
+ End
+ Begin DataPane =
+ Begin ParameterDefaults = ""
+ End
+ Begin ColumnWidths = 9
+ Width = 284
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ End
+ End
+ Begin CriteriaPane =
+ Begin ColumnWidths = 12
+ Column = 1440
+ Alias = 900
+ Table = 1170
+ Output = 720
+ Append = 1400
+ NewValue = 1170
+ SortType = 1350
+ SortOrder = 1410
+ GroupBy = 1350
+ Filter = 1350
+ Or = 1350
+ Or = 1350
+ Or = 1350
+ End
+ End
+End
+', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'v_risorseImpiegate';
+
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPaneCount', @value = 1, @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'v_risorseImpiegate';
+
diff --git a/Projects/GimDB/dbo/Views/v_selAmbiti.sql b/Projects/GimDB/dbo/Views/v_selAmbiti.sql
new file mode 100644
index 0000000..6f421a5
--- /dev/null
+++ b/Projects/GimDB/dbo/Views/v_selAmbiti.sql
@@ -0,0 +1,5 @@
+CREATE VIEW dbo.v_selAmbiti
+AS
+SELECT TOP (100) PERCENT idxAmbito AS value, descrAmbitoGuasto AS label
+FROM dbo.AnagAmbitoGuasto
+ORDER BY label
diff --git a/Projects/GimDB/dbo/Views/v_selAnTipoRis.sql b/Projects/GimDB/dbo/Views/v_selAnTipoRis.sql
new file mode 100644
index 0000000..3a28054
--- /dev/null
+++ b/Projects/GimDB/dbo/Views/v_selAnTipoRis.sql
@@ -0,0 +1,130 @@
+CREATE VIEW dbo.v_selAnTipoRis
+AS
+SELECT CodRisorsa AS value, DescrRisorsa + ' (' + UM + ')' AS label
+FROM dbo.AnagTipoRisorsa
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPane1', @value = N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
+Begin DesignProperties =
+ Begin PaneConfigurations =
+ Begin PaneConfiguration = 0
+ NumPanes = 4
+ Configuration = "(H (1[40] 4[20] 2[20] 3) )"
+ End
+ Begin PaneConfiguration = 1
+ NumPanes = 3
+ Configuration = "(H (1 [50] 4 [25] 3))"
+ End
+ Begin PaneConfiguration = 2
+ NumPanes = 3
+ Configuration = "(H (1 [50] 2 [25] 3))"
+ End
+ Begin PaneConfiguration = 3
+ NumPanes = 3
+ Configuration = "(H (4 [30] 2 [40] 3))"
+ End
+ Begin PaneConfiguration = 4
+ NumPanes = 2
+ Configuration = "(H (1 [56] 3))"
+ End
+ Begin PaneConfiguration = 5
+ NumPanes = 2
+ Configuration = "(H (2 [66] 3))"
+ End
+ Begin PaneConfiguration = 6
+ NumPanes = 2
+ Configuration = "(H (4 [50] 3))"
+ End
+ Begin PaneConfiguration = 7
+ NumPanes = 1
+ Configuration = "(V (3))"
+ End
+ Begin PaneConfiguration = 8
+ NumPanes = 3
+ Configuration = "(H (1[56] 4[18] 2) )"
+ End
+ Begin PaneConfiguration = 9
+ NumPanes = 2
+ Configuration = "(H (1 [75] 4))"
+ End
+ Begin PaneConfiguration = 10
+ NumPanes = 2
+ Configuration = "(H (1[66] 2) )"
+ End
+ Begin PaneConfiguration = 11
+ NumPanes = 2
+ Configuration = "(H (4 [60] 2))"
+ End
+ Begin PaneConfiguration = 12
+ NumPanes = 1
+ Configuration = "(H (1) )"
+ End
+ Begin PaneConfiguration = 13
+ NumPanes = 1
+ Configuration = "(V (4))"
+ End
+ Begin PaneConfiguration = 14
+ NumPanes = 1
+ Configuration = "(V (2))"
+ End
+ ActivePaneConfig = 0
+ End
+ Begin DiagramPane =
+ Begin Origin =
+ Top = 0
+ Left = 0
+ End
+ Begin Tables =
+ Begin Table = "AnagTipoRisorsa"
+ Begin Extent =
+ Top = 6
+ Left = 38
+ Bottom = 136
+ Right = 208
+ End
+ DisplayFlags = 280
+ TopColumn = 0
+ End
+ End
+ End
+ Begin SQLPane =
+ End
+ Begin DataPane =
+ Begin ParameterDefaults = ""
+ End
+ Begin ColumnWidths = 9
+ Width = 284
+ Width = 1500
+ Width = 2355
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ End
+ End
+ Begin CriteriaPane =
+ Begin ColumnWidths = 11
+ Column = 1440
+ Alias = 900
+ Table = 1170
+ Output = 720
+ Append = 1400
+ NewValue = 1170
+ SortType = 1350
+ SortOrder = 1410
+ GroupBy = 1350
+ Filter = 1350
+ Or = 1350
+ Or = 1350
+ Or = 1350
+ End
+ End
+End
+', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'v_selAnTipoRis';
+
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPaneCount', @value = 1, @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'v_selAnTipoRis';
+
diff --git a/Projects/GimDB/dbo/Views/v_selCausaliMacchine.sql b/Projects/GimDB/dbo/Views/v_selCausaliMacchine.sql
new file mode 100644
index 0000000..7bdd20f
--- /dev/null
+++ b/Projects/GimDB/dbo/Views/v_selCausaliMacchine.sql
@@ -0,0 +1,143 @@
+CREATE VIEW v_selCausaliMacchine
+AS
+SELECT TOP (100) PERCENT dbo.AnagCausali.idxCausale AS value, dbo.AnagCausali.descrCausale AS label, dbo.Macchine2FamMacchine.idxMacchina AS conditio
+FROM dbo.Macchine2FamMacchine INNER JOIN
+ dbo.AnagCausali ON dbo.Macchine2FamMacchine.idxFamMacchine = dbo.AnagCausali.idxFamMacchine
+WHERE (dbo.AnagCausali.attiva = 1)
+ORDER BY conditio, label
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPane1', @value = '[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
+Begin DesignProperties =
+ Begin PaneConfigurations =
+ Begin PaneConfiguration = 0
+ NumPanes = 4
+ Configuration = "(H (1[40] 4[20] 2[20] 3) )"
+ End
+ Begin PaneConfiguration = 1
+ NumPanes = 3
+ Configuration = "(H (1 [50] 4 [25] 3))"
+ End
+ Begin PaneConfiguration = 2
+ NumPanes = 3
+ Configuration = "(H (1 [50] 2 [25] 3))"
+ End
+ Begin PaneConfiguration = 3
+ NumPanes = 3
+ Configuration = "(H (4 [30] 2 [40] 3))"
+ End
+ Begin PaneConfiguration = 4
+ NumPanes = 2
+ Configuration = "(H (1 [56] 3))"
+ End
+ Begin PaneConfiguration = 5
+ NumPanes = 2
+ Configuration = "(H (2 [66] 3))"
+ End
+ Begin PaneConfiguration = 6
+ NumPanes = 2
+ Configuration = "(H (4 [50] 3))"
+ End
+ Begin PaneConfiguration = 7
+ NumPanes = 1
+ Configuration = "(V (3))"
+ End
+ Begin PaneConfiguration = 8
+ NumPanes = 3
+ Configuration = "(H (1[56] 4[18] 2) )"
+ End
+ Begin PaneConfiguration = 9
+ NumPanes = 2
+ Configuration = "(H (1 [75] 4))"
+ End
+ Begin PaneConfiguration = 10
+ NumPanes = 2
+ Configuration = "(H (1[66] 2) )"
+ End
+ Begin PaneConfiguration = 11
+ NumPanes = 2
+ Configuration = "(H (4 [60] 2))"
+ End
+ Begin PaneConfiguration = 12
+ NumPanes = 1
+ Configuration = "(H (1) )"
+ End
+ Begin PaneConfiguration = 13
+ NumPanes = 1
+ Configuration = "(V (4))"
+ End
+ Begin PaneConfiguration = 14
+ NumPanes = 1
+ Configuration = "(V (2))"
+ End
+ ActivePaneConfig = 0
+ End
+ Begin DiagramPane =
+ Begin Origin =
+ Top = 0
+ Left = 0
+ End
+ Begin Tables =
+ Begin Table = "Macchine2FamMacchine"
+ Begin Extent =
+ Top = 15
+ Left = 448
+ Bottom = 93
+ Right = 606
+ End
+ DisplayFlags = 280
+ TopColumn = 0
+ End
+ Begin Table = "AnagCausali"
+ Begin Extent =
+ Top = 54
+ Left = 38
+ Bottom = 162
+ Right = 196
+ End
+ DisplayFlags = 280
+ TopColumn = 0
+ End
+ End
+ End
+ Begin SQLPane =
+ End
+ Begin DataPane =
+ Begin ParameterDefaults = ""
+ End
+ Begin ColumnWidths = 9
+ Width = 284
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ End
+ End
+ Begin CriteriaPane =
+ Begin ColumnWidths = 11
+ Column = 1440
+ Alias = 900
+ Table = 1170
+ Output = 720
+ Append = 1400
+ NewValue = 1170
+ SortType = 1350
+ SortOrder = 1410
+ GroupBy = 1350
+ Filter = 1350
+ Or = 1350
+ Or = 1350
+ Or = 1350
+ End
+ End
+End
+', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'v_selCausaliMacchine';
+
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPaneCount', @value = 1, @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'v_selCausaliMacchine';
+
diff --git a/Projects/GimDB/dbo/Views/v_selFam.sql b/Projects/GimDB/dbo/Views/v_selFam.sql
new file mode 100644
index 0000000..87be2cd
--- /dev/null
+++ b/Projects/GimDB/dbo/Views/v_selFam.sql
@@ -0,0 +1,119 @@
+create VIEW v_selFam
+AS
+SELECT idxFamMacchine AS value, nomeFamMacch AS label
+FROM dbo.AnagFamMacchine
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPane1', @value = '[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
+Begin DesignProperties =
+ Begin PaneConfigurations =
+ Begin PaneConfiguration = 0
+ NumPanes = 4
+ Configuration = "(H (1[40] 4[20] 2[20] 3) )"
+ End
+ Begin PaneConfiguration = 1
+ NumPanes = 3
+ Configuration = "(H (1 [50] 4 [25] 3))"
+ End
+ Begin PaneConfiguration = 2
+ NumPanes = 3
+ Configuration = "(H (1 [50] 2 [25] 3))"
+ End
+ Begin PaneConfiguration = 3
+ NumPanes = 3
+ Configuration = "(H (4 [30] 2 [40] 3))"
+ End
+ Begin PaneConfiguration = 4
+ NumPanes = 2
+ Configuration = "(H (1 [56] 3))"
+ End
+ Begin PaneConfiguration = 5
+ NumPanes = 2
+ Configuration = "(H (2 [66] 3))"
+ End
+ Begin PaneConfiguration = 6
+ NumPanes = 2
+ Configuration = "(H (4 [50] 3))"
+ End
+ Begin PaneConfiguration = 7
+ NumPanes = 1
+ Configuration = "(V (3))"
+ End
+ Begin PaneConfiguration = 8
+ NumPanes = 3
+ Configuration = "(H (1[56] 4[18] 2) )"
+ End
+ Begin PaneConfiguration = 9
+ NumPanes = 2
+ Configuration = "(H (1 [75] 4))"
+ End
+ Begin PaneConfiguration = 10
+ NumPanes = 2
+ Configuration = "(H (1[66] 2) )"
+ End
+ Begin PaneConfiguration = 11
+ NumPanes = 2
+ Configuration = "(H (4 [60] 2))"
+ End
+ Begin PaneConfiguration = 12
+ NumPanes = 1
+ Configuration = "(H (1) )"
+ End
+ Begin PaneConfiguration = 13
+ NumPanes = 1
+ Configuration = "(V (4))"
+ End
+ Begin PaneConfiguration = 14
+ NumPanes = 1
+ Configuration = "(V (2))"
+ End
+ ActivePaneConfig = 0
+ End
+ Begin DiagramPane =
+ Begin Origin =
+ Top = 0
+ Left = 0
+ End
+ Begin Tables =
+ Begin Table = "AnagFamMacchine"
+ Begin Extent =
+ Top = 6
+ Left = 38
+ Bottom = 84
+ Right = 196
+ End
+ DisplayFlags = 280
+ TopColumn = 0
+ End
+ End
+ End
+ Begin SQLPane =
+ End
+ Begin DataPane =
+ Begin ParameterDefaults = ""
+ End
+ End
+ Begin CriteriaPane =
+ Begin ColumnWidths = 11
+ Column = 1440
+ Alias = 900
+ Table = 1170
+ Output = 720
+ Append = 1400
+ NewValue = 1170
+ SortType = 1350
+ SortOrder = 1410
+ GroupBy = 1350
+ Filter = 1350
+ Or = 1350
+ Or = 1350
+ Or = 1350
+ End
+ End
+End
+', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'v_selFam';
+
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPaneCount', @value = 1, @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'v_selFam';
+
diff --git a/Projects/GimDB/dbo/Views/v_selFamMacc.sql b/Projects/GimDB/dbo/Views/v_selFamMacc.sql
new file mode 100644
index 0000000..8a57166
--- /dev/null
+++ b/Projects/GimDB/dbo/Views/v_selFamMacc.sql
@@ -0,0 +1,8 @@
+CREATE VIEW dbo.v_selFamMacc
+AS
+SELECT dbo.Macchine2FamMacchine.idxFamMacchine, dbo.AnagMacchine.idxMacchina, dbo.AnagFamMacchine.nomeFamMacch AS famiglia,
+ ISNULL(dbo.AnagMacchine.codMacchina, 'n.d.') + ' - ' + dbo.AnagMacchine.nomeMacchina + ', mod. ' + ISNULL(dbo.AnagMacchine.modello, 'n.d.')
+ + ' (' + ISNULL(dbo.AnagMacchine.matricola, 'n.d.') + ')' AS macchina
+FROM dbo.Macchine2FamMacchine INNER JOIN
+ dbo.AnagFamMacchine ON dbo.Macchine2FamMacchine.idxFamMacchine = dbo.AnagFamMacchine.idxFamMacchine INNER JOIN
+ dbo.AnagMacchine ON dbo.Macchine2FamMacchine.idxMacchina = dbo.AnagMacchine.idxMacchina
diff --git a/Projects/GimDB/dbo/Views/v_selFreq.sql b/Projects/GimDB/dbo/Views/v_selFreq.sql
new file mode 100644
index 0000000..47339a0
--- /dev/null
+++ b/Projects/GimDB/dbo/Views/v_selFreq.sql
@@ -0,0 +1,130 @@
+CREATE VIEW dbo.v_selFreq
+AS
+SELECT codFrequenza AS value, frequenza AS label
+FROM dbo.AnagFrequenze
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPane1', @value = N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
+Begin DesignProperties =
+ Begin PaneConfigurations =
+ Begin PaneConfiguration = 0
+ NumPanes = 4
+ Configuration = "(H (1[40] 4[20] 2[20] 3) )"
+ End
+ Begin PaneConfiguration = 1
+ NumPanes = 3
+ Configuration = "(H (1 [50] 4 [25] 3))"
+ End
+ Begin PaneConfiguration = 2
+ NumPanes = 3
+ Configuration = "(H (1 [50] 2 [25] 3))"
+ End
+ Begin PaneConfiguration = 3
+ NumPanes = 3
+ Configuration = "(H (4 [30] 2 [40] 3))"
+ End
+ Begin PaneConfiguration = 4
+ NumPanes = 2
+ Configuration = "(H (1 [56] 3))"
+ End
+ Begin PaneConfiguration = 5
+ NumPanes = 2
+ Configuration = "(H (2 [66] 3))"
+ End
+ Begin PaneConfiguration = 6
+ NumPanes = 2
+ Configuration = "(H (4 [50] 3))"
+ End
+ Begin PaneConfiguration = 7
+ NumPanes = 1
+ Configuration = "(V (3))"
+ End
+ Begin PaneConfiguration = 8
+ NumPanes = 3
+ Configuration = "(H (1[56] 4[18] 2) )"
+ End
+ Begin PaneConfiguration = 9
+ NumPanes = 2
+ Configuration = "(H (1 [75] 4))"
+ End
+ Begin PaneConfiguration = 10
+ NumPanes = 2
+ Configuration = "(H (1[66] 2) )"
+ End
+ Begin PaneConfiguration = 11
+ NumPanes = 2
+ Configuration = "(H (4 [60] 2))"
+ End
+ Begin PaneConfiguration = 12
+ NumPanes = 1
+ Configuration = "(H (1) )"
+ End
+ Begin PaneConfiguration = 13
+ NumPanes = 1
+ Configuration = "(V (4))"
+ End
+ Begin PaneConfiguration = 14
+ NumPanes = 1
+ Configuration = "(V (2))"
+ End
+ ActivePaneConfig = 0
+ End
+ Begin DiagramPane =
+ Begin Origin =
+ Top = 0
+ Left = 0
+ End
+ Begin Tables =
+ Begin Table = "AnagFrequenze"
+ Begin Extent =
+ Top = 6
+ Left = 38
+ Bottom = 84
+ Right = 189
+ End
+ DisplayFlags = 280
+ TopColumn = 0
+ End
+ End
+ End
+ Begin SQLPane =
+ End
+ Begin DataPane =
+ Begin ParameterDefaults = ""
+ End
+ Begin ColumnWidths = 9
+ Width = 284
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ End
+ End
+ Begin CriteriaPane =
+ Begin ColumnWidths = 11
+ Column = 1440
+ Alias = 900
+ Table = 1170
+ Output = 720
+ Append = 1400
+ NewValue = 1170
+ SortType = 1350
+ SortOrder = 1410
+ GroupBy = 1350
+ Filter = 1350
+ Or = 1350
+ Or = 1350
+ Or = 1350
+ End
+ End
+End
+', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'v_selFreq';
+
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPaneCount', @value = 1, @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'v_selFreq';
+
diff --git a/Projects/GimDB/dbo/Views/v_selImpianti.sql b/Projects/GimDB/dbo/Views/v_selImpianti.sql
new file mode 100644
index 0000000..dd9c1bc
--- /dev/null
+++ b/Projects/GimDB/dbo/Views/v_selImpianti.sql
@@ -0,0 +1,131 @@
+CREATE VIEW dbo.v_selImpianti
+AS
+SELECT TOP (100) PERCENT idxImpianto AS value, nomeImpianto + ' - ' + ISNULL(tipoImpianto, 'n.d.') + ' (' + ISNULL(codImpianto, 'n.d.') + ')' AS label
+FROM dbo.AnagImpianti
+ORDER BY label
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPane1', @value = N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
+Begin DesignProperties =
+ Begin PaneConfigurations =
+ Begin PaneConfiguration = 0
+ NumPanes = 4
+ Configuration = "(H (1[40] 4[20] 2[20] 3) )"
+ End
+ Begin PaneConfiguration = 1
+ NumPanes = 3
+ Configuration = "(H (1 [50] 4 [25] 3))"
+ End
+ Begin PaneConfiguration = 2
+ NumPanes = 3
+ Configuration = "(H (1 [50] 2 [25] 3))"
+ End
+ Begin PaneConfiguration = 3
+ NumPanes = 3
+ Configuration = "(H (4 [30] 2 [40] 3))"
+ End
+ Begin PaneConfiguration = 4
+ NumPanes = 2
+ Configuration = "(H (1 [56] 3))"
+ End
+ Begin PaneConfiguration = 5
+ NumPanes = 2
+ Configuration = "(H (2 [66] 3))"
+ End
+ Begin PaneConfiguration = 6
+ NumPanes = 2
+ Configuration = "(H (4 [50] 3))"
+ End
+ Begin PaneConfiguration = 7
+ NumPanes = 1
+ Configuration = "(V (3))"
+ End
+ Begin PaneConfiguration = 8
+ NumPanes = 3
+ Configuration = "(H (1[56] 4[18] 2) )"
+ End
+ Begin PaneConfiguration = 9
+ NumPanes = 2
+ Configuration = "(H (1 [75] 4))"
+ End
+ Begin PaneConfiguration = 10
+ NumPanes = 2
+ Configuration = "(H (1[66] 2) )"
+ End
+ Begin PaneConfiguration = 11
+ NumPanes = 2
+ Configuration = "(H (4 [60] 2))"
+ End
+ Begin PaneConfiguration = 12
+ NumPanes = 1
+ Configuration = "(H (1) )"
+ End
+ Begin PaneConfiguration = 13
+ NumPanes = 1
+ Configuration = "(V (4))"
+ End
+ Begin PaneConfiguration = 14
+ NumPanes = 1
+ Configuration = "(V (2))"
+ End
+ ActivePaneConfig = 0
+ End
+ Begin DiagramPane =
+ Begin Origin =
+ Top = 0
+ Left = 0
+ End
+ Begin Tables =
+ Begin Table = "AnagImpianti"
+ Begin Extent =
+ Top = 6
+ Left = 38
+ Bottom = 114
+ Right = 189
+ End
+ DisplayFlags = 280
+ TopColumn = 0
+ End
+ End
+ End
+ Begin SQLPane =
+ End
+ Begin DataPane =
+ Begin ParameterDefaults = ""
+ End
+ Begin ColumnWidths = 9
+ Width = 284
+ Width = 1500
+ Width = 4185
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ End
+ End
+ Begin CriteriaPane =
+ Begin ColumnWidths = 11
+ Column = 1440
+ Alias = 900
+ Table = 1170
+ Output = 720
+ Append = 1400
+ NewValue = 1170
+ SortType = 1350
+ SortOrder = 1410
+ GroupBy = 1350
+ Filter = 1350
+ Or = 1350
+ Or = 1350
+ Or = 1350
+ End
+ End
+End
+', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'v_selImpianti';
+
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPaneCount', @value = 1, @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'v_selImpianti';
+
diff --git a/Projects/GimDB/dbo/Views/v_selListVal.sql b/Projects/GimDB/dbo/Views/v_selListVal.sql
new file mode 100644
index 0000000..344bd99
--- /dev/null
+++ b/Projects/GimDB/dbo/Views/v_selListVal.sql
@@ -0,0 +1,132 @@
+
+CREATE VIEW [dbo].[v_selListVal]
+AS
+SELECT TableName + '-' + FieldName + '-' + value AS value, label
+FROM dbo.ListValues
+
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPane1', @value = N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
+Begin DesignProperties =
+ Begin PaneConfigurations =
+ Begin PaneConfiguration = 0
+ NumPanes = 4
+ Configuration = "(H (1[40] 4[20] 2[20] 3) )"
+ End
+ Begin PaneConfiguration = 1
+ NumPanes = 3
+ Configuration = "(H (1 [50] 4 [25] 3))"
+ End
+ Begin PaneConfiguration = 2
+ NumPanes = 3
+ Configuration = "(H (1 [50] 2 [25] 3))"
+ End
+ Begin PaneConfiguration = 3
+ NumPanes = 3
+ Configuration = "(H (4 [30] 2 [40] 3))"
+ End
+ Begin PaneConfiguration = 4
+ NumPanes = 2
+ Configuration = "(H (1 [56] 3))"
+ End
+ Begin PaneConfiguration = 5
+ NumPanes = 2
+ Configuration = "(H (2 [66] 3))"
+ End
+ Begin PaneConfiguration = 6
+ NumPanes = 2
+ Configuration = "(H (4 [50] 3))"
+ End
+ Begin PaneConfiguration = 7
+ NumPanes = 1
+ Configuration = "(V (3))"
+ End
+ Begin PaneConfiguration = 8
+ NumPanes = 3
+ Configuration = "(H (1[56] 4[18] 2) )"
+ End
+ Begin PaneConfiguration = 9
+ NumPanes = 2
+ Configuration = "(H (1 [75] 4))"
+ End
+ Begin PaneConfiguration = 10
+ NumPanes = 2
+ Configuration = "(H (1[66] 2) )"
+ End
+ Begin PaneConfiguration = 11
+ NumPanes = 2
+ Configuration = "(H (4 [60] 2))"
+ End
+ Begin PaneConfiguration = 12
+ NumPanes = 1
+ Configuration = "(H (1) )"
+ End
+ Begin PaneConfiguration = 13
+ NumPanes = 1
+ Configuration = "(V (4))"
+ End
+ Begin PaneConfiguration = 14
+ NumPanes = 1
+ Configuration = "(V (2))"
+ End
+ ActivePaneConfig = 0
+ End
+ Begin DiagramPane =
+ Begin Origin =
+ Top = 0
+ Left = 0
+ End
+ Begin Tables =
+ Begin Table = "ListValues"
+ Begin Extent =
+ Top = 6
+ Left = 38
+ Bottom = 136
+ Right = 208
+ End
+ DisplayFlags = 280
+ TopColumn = 0
+ End
+ End
+ End
+ Begin SQLPane =
+ End
+ Begin DataPane =
+ Begin ParameterDefaults = ""
+ End
+ Begin ColumnWidths = 9
+ Width = 284
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ End
+ End
+ Begin CriteriaPane =
+ Begin ColumnWidths = 11
+ Column = 1440
+ Alias = 900
+ Table = 1170
+ Output = 720
+ Append = 1400
+ NewValue = 1170
+ SortType = 1350
+ SortOrder = 1410
+ GroupBy = 1350
+ Filter = 1350
+ Or = 1350
+ Or = 1350
+ Or = 1350
+ End
+ End
+End
+', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'v_selListVal';
+
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPaneCount', @value = 1, @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'v_selListVal';
+
diff --git a/Projects/GimDB/dbo/Views/v_selMacchine.sql b/Projects/GimDB/dbo/Views/v_selMacchine.sql
new file mode 100644
index 0000000..2671c4a
--- /dev/null
+++ b/Projects/GimDB/dbo/Views/v_selMacchine.sql
@@ -0,0 +1,132 @@
+CREATE VIEW dbo.v_selMacchine
+AS
+SELECT TOP (100) PERCENT idxMacchina AS value, LTRIM(RTRIM(nomeMacchina)) + ' (' + ISNULL(codMacchina, 'n.d.') + ') ' + ', mod. ' + ISNULL(modello, 'n.d.')
+ + ' (' + ISNULL(matricola, 'n.d.') + ')' AS label, idxImpianto AS conditio
+FROM dbo.AnagMacchine
+ORDER BY label
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPane1', @value = N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
+Begin DesignProperties =
+ Begin PaneConfigurations =
+ Begin PaneConfiguration = 0
+ NumPanes = 4
+ Configuration = "(H (1[40] 4[20] 2[20] 3) )"
+ End
+ Begin PaneConfiguration = 1
+ NumPanes = 3
+ Configuration = "(H (1 [50] 4 [25] 3))"
+ End
+ Begin PaneConfiguration = 2
+ NumPanes = 3
+ Configuration = "(H (1 [50] 2 [25] 3))"
+ End
+ Begin PaneConfiguration = 3
+ NumPanes = 3
+ Configuration = "(H (4 [30] 2 [40] 3))"
+ End
+ Begin PaneConfiguration = 4
+ NumPanes = 2
+ Configuration = "(H (1 [56] 3))"
+ End
+ Begin PaneConfiguration = 5
+ NumPanes = 2
+ Configuration = "(H (2 [66] 3))"
+ End
+ Begin PaneConfiguration = 6
+ NumPanes = 2
+ Configuration = "(H (4 [50] 3))"
+ End
+ Begin PaneConfiguration = 7
+ NumPanes = 1
+ Configuration = "(V (3))"
+ End
+ Begin PaneConfiguration = 8
+ NumPanes = 3
+ Configuration = "(H (1[56] 4[18] 2) )"
+ End
+ Begin PaneConfiguration = 9
+ NumPanes = 2
+ Configuration = "(H (1 [75] 4))"
+ End
+ Begin PaneConfiguration = 10
+ NumPanes = 2
+ Configuration = "(H (1[66] 2) )"
+ End
+ Begin PaneConfiguration = 11
+ NumPanes = 2
+ Configuration = "(H (4 [60] 2))"
+ End
+ Begin PaneConfiguration = 12
+ NumPanes = 1
+ Configuration = "(H (1) )"
+ End
+ Begin PaneConfiguration = 13
+ NumPanes = 1
+ Configuration = "(V (4))"
+ End
+ Begin PaneConfiguration = 14
+ NumPanes = 1
+ Configuration = "(V (2))"
+ End
+ ActivePaneConfig = 0
+ End
+ Begin DiagramPane =
+ Begin Origin =
+ Top = -384
+ Left = 0
+ End
+ Begin Tables =
+ Begin Table = "AnagMacchine"
+ Begin Extent =
+ Top = 6
+ Left = 38
+ Bottom = 114
+ Right = 189
+ End
+ DisplayFlags = 280
+ TopColumn = 0
+ End
+ End
+ End
+ Begin SQLPane =
+ End
+ Begin DataPane =
+ Begin ParameterDefaults = ""
+ End
+ Begin ColumnWidths = 9
+ Width = 284
+ Width = 1500
+ Width = 6795
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ End
+ End
+ Begin CriteriaPane =
+ Begin ColumnWidths = 11
+ Column = 1440
+ Alias = 900
+ Table = 1170
+ Output = 720
+ Append = 1400
+ NewValue = 1170
+ SortType = 1350
+ SortOrder = 1410
+ GroupBy = 1350
+ Filter = 1350
+ Or = 1350
+ Or = 1350
+ Or = 1350
+ End
+ End
+End
+', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'v_selMacchine';
+
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPaneCount', @value = 1, @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'v_selMacchine';
+
diff --git a/Projects/GimDB/dbo/Views/v_selOperMtz.sql b/Projects/GimDB/dbo/Views/v_selOperMtz.sql
new file mode 100644
index 0000000..9202928
--- /dev/null
+++ b/Projects/GimDB/dbo/Views/v_selOperMtz.sql
@@ -0,0 +1,131 @@
+create VIEW v_selOperMtz
+AS
+SELECT TOP (100) PERCENT matrOp AS value, matrOp + ' - ' + Cognome + ' ' + Nome AS label
+FROM dbo.AnagrOperMtz
+ORDER BY label
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPane1', @value = '[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
+Begin DesignProperties =
+ Begin PaneConfigurations =
+ Begin PaneConfiguration = 0
+ NumPanes = 4
+ Configuration = "(H (1[40] 4[20] 2[20] 3) )"
+ End
+ Begin PaneConfiguration = 1
+ NumPanes = 3
+ Configuration = "(H (1 [50] 4 [25] 3))"
+ End
+ Begin PaneConfiguration = 2
+ NumPanes = 3
+ Configuration = "(H (1 [50] 2 [25] 3))"
+ End
+ Begin PaneConfiguration = 3
+ NumPanes = 3
+ Configuration = "(H (4 [30] 2 [40] 3))"
+ End
+ Begin PaneConfiguration = 4
+ NumPanes = 2
+ Configuration = "(H (1 [56] 3))"
+ End
+ Begin PaneConfiguration = 5
+ NumPanes = 2
+ Configuration = "(H (2 [66] 3))"
+ End
+ Begin PaneConfiguration = 6
+ NumPanes = 2
+ Configuration = "(H (4 [50] 3))"
+ End
+ Begin PaneConfiguration = 7
+ NumPanes = 1
+ Configuration = "(V (3))"
+ End
+ Begin PaneConfiguration = 8
+ NumPanes = 3
+ Configuration = "(H (1[56] 4[18] 2) )"
+ End
+ Begin PaneConfiguration = 9
+ NumPanes = 2
+ Configuration = "(H (1 [75] 4))"
+ End
+ Begin PaneConfiguration = 10
+ NumPanes = 2
+ Configuration = "(H (1[66] 2) )"
+ End
+ Begin PaneConfiguration = 11
+ NumPanes = 2
+ Configuration = "(H (4 [60] 2))"
+ End
+ Begin PaneConfiguration = 12
+ NumPanes = 1
+ Configuration = "(H (1) )"
+ End
+ Begin PaneConfiguration = 13
+ NumPanes = 1
+ Configuration = "(V (4))"
+ End
+ Begin PaneConfiguration = 14
+ NumPanes = 1
+ Configuration = "(V (2))"
+ End
+ ActivePaneConfig = 0
+ End
+ Begin DiagramPane =
+ Begin Origin =
+ Top = 0
+ Left = 0
+ End
+ Begin Tables =
+ Begin Table = "AnagrOperMtz"
+ Begin Extent =
+ Top = 6
+ Left = 38
+ Bottom = 99
+ Right = 190
+ End
+ DisplayFlags = 280
+ TopColumn = 0
+ End
+ End
+ End
+ Begin SQLPane =
+ End
+ Begin DataPane =
+ Begin ParameterDefaults = ""
+ End
+ Begin ColumnWidths = 9
+ Width = 284
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ End
+ End
+ Begin CriteriaPane =
+ Begin ColumnWidths = 11
+ Column = 1440
+ Alias = 900
+ Table = 1170
+ Output = 720
+ Append = 1400
+ NewValue = 1170
+ SortType = 1350
+ SortOrder = 1410
+ GroupBy = 1350
+ Filter = 1350
+ Or = 1350
+ Or = 1350
+ Or = 1350
+ End
+ End
+End
+', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'v_selOperMtz';
+
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPaneCount', @value = 1, @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'v_selOperMtz';
+
diff --git a/Projects/GimDB/dbo/Views/v_selPeriodiTrad.sql b/Projects/GimDB/dbo/Views/v_selPeriodiTrad.sql
new file mode 100644
index 0000000..cf281f8
--- /dev/null
+++ b/Projects/GimDB/dbo/Views/v_selPeriodiTrad.sql
@@ -0,0 +1,142 @@
+CREATE VIEW dbo.v_selPeriodiTrad
+AS
+SELECT TOP (100) PERCENT dbo.AnagPeriodi.codPeriodo AS value, dbo.v_vocabolario.Traduzione AS label, dbo.v_vocabolario.Lingua AS conditio
+FROM dbo.AnagPeriodi INNER JOIN
+ dbo.v_vocabolario ON dbo.AnagPeriodi.lemmaPeriodo = dbo.v_vocabolario.Lemma
+ORDER BY label
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPane1', @value = N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
+Begin DesignProperties =
+ Begin PaneConfigurations =
+ Begin PaneConfiguration = 0
+ NumPanes = 4
+ Configuration = "(H (1[40] 4[20] 2[20] 3) )"
+ End
+ Begin PaneConfiguration = 1
+ NumPanes = 3
+ Configuration = "(H (1 [50] 4 [25] 3))"
+ End
+ Begin PaneConfiguration = 2
+ NumPanes = 3
+ Configuration = "(H (1 [50] 2 [25] 3))"
+ End
+ Begin PaneConfiguration = 3
+ NumPanes = 3
+ Configuration = "(H (4 [30] 2 [40] 3))"
+ End
+ Begin PaneConfiguration = 4
+ NumPanes = 2
+ Configuration = "(H (1 [56] 3))"
+ End
+ Begin PaneConfiguration = 5
+ NumPanes = 2
+ Configuration = "(H (2 [66] 3))"
+ End
+ Begin PaneConfiguration = 6
+ NumPanes = 2
+ Configuration = "(H (4 [50] 3))"
+ End
+ Begin PaneConfiguration = 7
+ NumPanes = 1
+ Configuration = "(V (3))"
+ End
+ Begin PaneConfiguration = 8
+ NumPanes = 3
+ Configuration = "(H (1[56] 4[18] 2) )"
+ End
+ Begin PaneConfiguration = 9
+ NumPanes = 2
+ Configuration = "(H (1 [75] 4))"
+ End
+ Begin PaneConfiguration = 10
+ NumPanes = 2
+ Configuration = "(H (1[66] 2) )"
+ End
+ Begin PaneConfiguration = 11
+ NumPanes = 2
+ Configuration = "(H (4 [60] 2))"
+ End
+ Begin PaneConfiguration = 12
+ NumPanes = 1
+ Configuration = "(H (1) )"
+ End
+ Begin PaneConfiguration = 13
+ NumPanes = 1
+ Configuration = "(V (4))"
+ End
+ Begin PaneConfiguration = 14
+ NumPanes = 1
+ Configuration = "(V (2))"
+ End
+ ActivePaneConfig = 0
+ End
+ Begin DiagramPane =
+ Begin Origin =
+ Top = 0
+ Left = 0
+ End
+ Begin Tables =
+ Begin Table = "AnagPeriodi"
+ Begin Extent =
+ Top = 6
+ Left = 38
+ Bottom = 84
+ Right = 189
+ End
+ DisplayFlags = 280
+ TopColumn = 0
+ End
+ Begin Table = "v_vocabolario"
+ Begin Extent =
+ Top = 6
+ Left = 227
+ Bottom = 99
+ Right = 378
+ End
+ DisplayFlags = 280
+ TopColumn = 0
+ End
+ End
+ End
+ Begin SQLPane =
+ End
+ Begin DataPane =
+ Begin ParameterDefaults = ""
+ End
+ Begin ColumnWidths = 9
+ Width = 284
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ End
+ End
+ Begin CriteriaPane =
+ Begin ColumnWidths = 11
+ Column = 1440
+ Alias = 900
+ Table = 1170
+ Output = 720
+ Append = 1400
+ NewValue = 1170
+ SortType = 1350
+ SortOrder = 1410
+ GroupBy = 1350
+ Filter = 1350
+ Or = 1350
+ Or = 1350
+ Or = 1350
+ End
+ End
+End
+', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'v_selPeriodiTrad';
+
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPaneCount', @value = 1, @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'v_selPeriodiTrad';
+
diff --git a/Projects/GimDB/dbo/Views/v_selPrior.sql b/Projects/GimDB/dbo/Views/v_selPrior.sql
new file mode 100644
index 0000000..152257d
--- /dev/null
+++ b/Projects/GimDB/dbo/Views/v_selPrior.sql
@@ -0,0 +1,5 @@
+CREATE VIEW dbo.v_selPrior
+AS
+SELECT TOP (100) PERCENT idxPriorita AS value, CAST(idxPriorita AS varchar(4)) + ' - ' + descrPriorita AS label
+FROM dbo.AnagPriorita
+ORDER BY label
diff --git a/Projects/GimDB/dbo/Views/v_selSemafori.sql b/Projects/GimDB/dbo/Views/v_selSemafori.sql
new file mode 100644
index 0000000..d7970e2
--- /dev/null
+++ b/Projects/GimDB/dbo/Views/v_selSemafori.sql
@@ -0,0 +1,131 @@
+CREATE VIEW dbo.v_selSemafori
+AS
+SELECT TOP (100) PERCENT codSemaforo AS value, descrSemaforo AS label
+FROM dbo.AnagSemafori
+ORDER BY label
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPane1', @value = N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
+Begin DesignProperties =
+ Begin PaneConfigurations =
+ Begin PaneConfiguration = 0
+ NumPanes = 4
+ Configuration = "(H (1[40] 4[20] 2[20] 3) )"
+ End
+ Begin PaneConfiguration = 1
+ NumPanes = 3
+ Configuration = "(H (1 [50] 4 [25] 3))"
+ End
+ Begin PaneConfiguration = 2
+ NumPanes = 3
+ Configuration = "(H (1 [50] 2 [25] 3))"
+ End
+ Begin PaneConfiguration = 3
+ NumPanes = 3
+ Configuration = "(H (4 [30] 2 [40] 3))"
+ End
+ Begin PaneConfiguration = 4
+ NumPanes = 2
+ Configuration = "(H (1 [56] 3))"
+ End
+ Begin PaneConfiguration = 5
+ NumPanes = 2
+ Configuration = "(H (2 [66] 3))"
+ End
+ Begin PaneConfiguration = 6
+ NumPanes = 2
+ Configuration = "(H (4 [50] 3))"
+ End
+ Begin PaneConfiguration = 7
+ NumPanes = 1
+ Configuration = "(V (3))"
+ End
+ Begin PaneConfiguration = 8
+ NumPanes = 3
+ Configuration = "(H (1[56] 4[18] 2) )"
+ End
+ Begin PaneConfiguration = 9
+ NumPanes = 2
+ Configuration = "(H (1 [75] 4))"
+ End
+ Begin PaneConfiguration = 10
+ NumPanes = 2
+ Configuration = "(H (1[66] 2) )"
+ End
+ Begin PaneConfiguration = 11
+ NumPanes = 2
+ Configuration = "(H (4 [60] 2))"
+ End
+ Begin PaneConfiguration = 12
+ NumPanes = 1
+ Configuration = "(H (1) )"
+ End
+ Begin PaneConfiguration = 13
+ NumPanes = 1
+ Configuration = "(V (4))"
+ End
+ Begin PaneConfiguration = 14
+ NumPanes = 1
+ Configuration = "(V (2))"
+ End
+ ActivePaneConfig = 0
+ End
+ Begin DiagramPane =
+ Begin Origin =
+ Top = 0
+ Left = 0
+ End
+ Begin Tables =
+ Begin Table = "AnagSemafori"
+ Begin Extent =
+ Top = 6
+ Left = 38
+ Bottom = 84
+ Right = 190
+ End
+ DisplayFlags = 280
+ TopColumn = 0
+ End
+ End
+ End
+ Begin SQLPane =
+ End
+ Begin DataPane =
+ Begin ParameterDefaults = ""
+ End
+ Begin ColumnWidths = 9
+ Width = 284
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ End
+ End
+ Begin CriteriaPane =
+ Begin ColumnWidths = 11
+ Column = 1440
+ Alias = 900
+ Table = 1170
+ Output = 720
+ Append = 1400
+ NewValue = 1170
+ SortType = 1350
+ SortOrder = 1410
+ GroupBy = 1350
+ Filter = 1350
+ Or = 1350
+ Or = 1350
+ Or = 1350
+ End
+ End
+End
+', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'v_selSemafori';
+
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPaneCount', @value = 1, @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'v_selSemafori';
+
diff --git a/Projects/GimDB/dbo/Views/v_selStato.sql b/Projects/GimDB/dbo/Views/v_selStato.sql
new file mode 100644
index 0000000..46ba830
--- /dev/null
+++ b/Projects/GimDB/dbo/Views/v_selStato.sql
@@ -0,0 +1,130 @@
+CREATE VIEW dbo.v_selStato
+AS
+SELECT idxStato AS value, DescrStato AS label
+FROM dbo.AnagStati
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPane1', @value = N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
+Begin DesignProperties =
+ Begin PaneConfigurations =
+ Begin PaneConfiguration = 0
+ NumPanes = 4
+ Configuration = "(H (1[40] 4[20] 2[20] 3) )"
+ End
+ Begin PaneConfiguration = 1
+ NumPanes = 3
+ Configuration = "(H (1 [50] 4 [25] 3))"
+ End
+ Begin PaneConfiguration = 2
+ NumPanes = 3
+ Configuration = "(H (1 [50] 2 [25] 3))"
+ End
+ Begin PaneConfiguration = 3
+ NumPanes = 3
+ Configuration = "(H (4 [30] 2 [40] 3))"
+ End
+ Begin PaneConfiguration = 4
+ NumPanes = 2
+ Configuration = "(H (1 [56] 3))"
+ End
+ Begin PaneConfiguration = 5
+ NumPanes = 2
+ Configuration = "(H (2 [66] 3))"
+ End
+ Begin PaneConfiguration = 6
+ NumPanes = 2
+ Configuration = "(H (4 [50] 3))"
+ End
+ Begin PaneConfiguration = 7
+ NumPanes = 1
+ Configuration = "(V (3))"
+ End
+ Begin PaneConfiguration = 8
+ NumPanes = 3
+ Configuration = "(H (1[56] 4[18] 2) )"
+ End
+ Begin PaneConfiguration = 9
+ NumPanes = 2
+ Configuration = "(H (1 [75] 4))"
+ End
+ Begin PaneConfiguration = 10
+ NumPanes = 2
+ Configuration = "(H (1[66] 2) )"
+ End
+ Begin PaneConfiguration = 11
+ NumPanes = 2
+ Configuration = "(H (4 [60] 2))"
+ End
+ Begin PaneConfiguration = 12
+ NumPanes = 1
+ Configuration = "(H (1) )"
+ End
+ Begin PaneConfiguration = 13
+ NumPanes = 1
+ Configuration = "(V (4))"
+ End
+ Begin PaneConfiguration = 14
+ NumPanes = 1
+ Configuration = "(V (2))"
+ End
+ ActivePaneConfig = 0
+ End
+ Begin DiagramPane =
+ Begin Origin =
+ Top = 0
+ Left = 0
+ End
+ Begin Tables =
+ Begin Table = "AnagStati"
+ Begin Extent =
+ Top = 6
+ Left = 38
+ Bottom = 99
+ Right = 189
+ End
+ DisplayFlags = 280
+ TopColumn = 0
+ End
+ End
+ End
+ Begin SQLPane =
+ End
+ Begin DataPane =
+ Begin ParameterDefaults = ""
+ End
+ Begin ColumnWidths = 9
+ Width = 284
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ End
+ End
+ Begin CriteriaPane =
+ Begin ColumnWidths = 11
+ Column = 1440
+ Alias = 900
+ Table = 1170
+ Output = 720
+ Append = 1400
+ NewValue = 1170
+ SortType = 1350
+ SortOrder = 1410
+ GroupBy = 1350
+ Filter = 1350
+ Or = 1350
+ Or = 1350
+ Or = 1350
+ End
+ End
+End
+', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'v_selStato';
+
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPaneCount', @value = 1, @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'v_selStato';
+
diff --git a/Projects/GimDB/dbo/Views/v_selTipoGuasto.sql b/Projects/GimDB/dbo/Views/v_selTipoGuasto.sql
new file mode 100644
index 0000000..590cfbb
--- /dev/null
+++ b/Projects/GimDB/dbo/Views/v_selTipoGuasto.sql
@@ -0,0 +1,131 @@
+CREATE VIEW dbo.v_selTipoGuasto
+AS
+SELECT TOP (100) PERCENT idxTipo AS value, descrTipo AS label
+FROM dbo.AnagTipoGuasto
+ORDER BY label
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPane1', @value = N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
+Begin DesignProperties =
+ Begin PaneConfigurations =
+ Begin PaneConfiguration = 0
+ NumPanes = 4
+ Configuration = "(H (1[40] 4[20] 2[20] 3) )"
+ End
+ Begin PaneConfiguration = 1
+ NumPanes = 3
+ Configuration = "(H (1 [50] 4 [25] 3))"
+ End
+ Begin PaneConfiguration = 2
+ NumPanes = 3
+ Configuration = "(H (1 [50] 2 [25] 3))"
+ End
+ Begin PaneConfiguration = 3
+ NumPanes = 3
+ Configuration = "(H (4 [30] 2 [40] 3))"
+ End
+ Begin PaneConfiguration = 4
+ NumPanes = 2
+ Configuration = "(H (1 [56] 3))"
+ End
+ Begin PaneConfiguration = 5
+ NumPanes = 2
+ Configuration = "(H (2 [66] 3))"
+ End
+ Begin PaneConfiguration = 6
+ NumPanes = 2
+ Configuration = "(H (4 [50] 3))"
+ End
+ Begin PaneConfiguration = 7
+ NumPanes = 1
+ Configuration = "(V (3))"
+ End
+ Begin PaneConfiguration = 8
+ NumPanes = 3
+ Configuration = "(H (1[56] 4[18] 2) )"
+ End
+ Begin PaneConfiguration = 9
+ NumPanes = 2
+ Configuration = "(H (1 [75] 4))"
+ End
+ Begin PaneConfiguration = 10
+ NumPanes = 2
+ Configuration = "(H (1[66] 2) )"
+ End
+ Begin PaneConfiguration = 11
+ NumPanes = 2
+ Configuration = "(H (4 [60] 2))"
+ End
+ Begin PaneConfiguration = 12
+ NumPanes = 1
+ Configuration = "(H (1) )"
+ End
+ Begin PaneConfiguration = 13
+ NumPanes = 1
+ Configuration = "(V (4))"
+ End
+ Begin PaneConfiguration = 14
+ NumPanes = 1
+ Configuration = "(V (2))"
+ End
+ ActivePaneConfig = 0
+ End
+ Begin DiagramPane =
+ Begin Origin =
+ Top = 0
+ Left = 0
+ End
+ Begin Tables =
+ Begin Table = "AnagTipoGuasto"
+ Begin Extent =
+ Top = 6
+ Left = 38
+ Bottom = 84
+ Right = 189
+ End
+ DisplayFlags = 280
+ TopColumn = 0
+ End
+ End
+ End
+ Begin SQLPane =
+ End
+ Begin DataPane =
+ Begin ParameterDefaults = ""
+ End
+ Begin ColumnWidths = 9
+ Width = 284
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ End
+ End
+ Begin CriteriaPane =
+ Begin ColumnWidths = 11
+ Column = 1440
+ Alias = 900
+ Table = 1170
+ Output = 720
+ Append = 1400
+ NewValue = 1170
+ SortType = 1350
+ SortOrder = 1410
+ GroupBy = 1350
+ Filter = 1350
+ Or = 1350
+ Or = 1350
+ Or = 1350
+ End
+ End
+End
+', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'v_selTipoGuasto';
+
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPaneCount', @value = 1, @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'v_selTipoGuasto';
+
diff --git a/Projects/GimDB/dbo/Views/v_selUtentiAll.sql b/Projects/GimDB/dbo/Views/v_selUtentiAll.sql
new file mode 100644
index 0000000..f44ea64
--- /dev/null
+++ b/Projects/GimDB/dbo/Views/v_selUtentiAll.sql
@@ -0,0 +1,119 @@
+create VIEW v_selUtentiAll
+AS
+SELECT USER_NAME AS value, COGNOME + ' ' + NOME + ', matr' + MATRICOLA + ' (cdc: ' + COD_CDC + ')' AS label, COD_CDC, ATTIVO
+FROM dbo.UTENTE AS ut
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPane1', @value = '[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
+Begin DesignProperties =
+ Begin PaneConfigurations =
+ Begin PaneConfiguration = 0
+ NumPanes = 4
+ Configuration = "(H (1[40] 4[20] 2[20] 3) )"
+ End
+ Begin PaneConfiguration = 1
+ NumPanes = 3
+ Configuration = "(H (1 [50] 4 [25] 3))"
+ End
+ Begin PaneConfiguration = 2
+ NumPanes = 3
+ Configuration = "(H (1 [50] 2 [25] 3))"
+ End
+ Begin PaneConfiguration = 3
+ NumPanes = 3
+ Configuration = "(H (4 [30] 2 [40] 3))"
+ End
+ Begin PaneConfiguration = 4
+ NumPanes = 2
+ Configuration = "(H (1 [56] 3))"
+ End
+ Begin PaneConfiguration = 5
+ NumPanes = 2
+ Configuration = "(H (2 [66] 3))"
+ End
+ Begin PaneConfiguration = 6
+ NumPanes = 2
+ Configuration = "(H (4 [50] 3))"
+ End
+ Begin PaneConfiguration = 7
+ NumPanes = 1
+ Configuration = "(V (3))"
+ End
+ Begin PaneConfiguration = 8
+ NumPanes = 3
+ Configuration = "(H (1[56] 4[18] 2) )"
+ End
+ Begin PaneConfiguration = 9
+ NumPanes = 2
+ Configuration = "(H (1 [75] 4))"
+ End
+ Begin PaneConfiguration = 10
+ NumPanes = 2
+ Configuration = "(H (1[66] 2) )"
+ End
+ Begin PaneConfiguration = 11
+ NumPanes = 2
+ Configuration = "(H (4 [60] 2))"
+ End
+ Begin PaneConfiguration = 12
+ NumPanes = 1
+ Configuration = "(H (1) )"
+ End
+ Begin PaneConfiguration = 13
+ NumPanes = 1
+ Configuration = "(V (4))"
+ End
+ Begin PaneConfiguration = 14
+ NumPanes = 1
+ Configuration = "(V (2))"
+ End
+ ActivePaneConfig = 0
+ End
+ Begin DiagramPane =
+ Begin Origin =
+ Top = 0
+ Left = 0
+ End
+ Begin Tables =
+ Begin Table = "ut"
+ Begin Extent =
+ Top = 6
+ Left = 38
+ Bottom = 114
+ Right = 190
+ End
+ DisplayFlags = 280
+ TopColumn = 0
+ End
+ End
+ End
+ Begin SQLPane =
+ End
+ Begin DataPane =
+ Begin ParameterDefaults = ""
+ End
+ End
+ Begin CriteriaPane =
+ Begin ColumnWidths = 11
+ Column = 1440
+ Alias = 900
+ Table = 1170
+ Output = 720
+ Append = 1400
+ NewValue = 1170
+ SortType = 1350
+ SortOrder = 1410
+ GroupBy = 1350
+ Filter = 1350
+ Or = 1350
+ Or = 1350
+ Or = 1350
+ End
+ End
+End
+', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'v_selUtentiAll';
+
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPaneCount', @value = 1, @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'v_selUtentiAll';
+
diff --git a/Projects/GimDB/dbo/Views/v_selUtentiShort.sql b/Projects/GimDB/dbo/Views/v_selUtentiShort.sql
new file mode 100644
index 0000000..39dc88d
--- /dev/null
+++ b/Projects/GimDB/dbo/Views/v_selUtentiShort.sql
@@ -0,0 +1,119 @@
+create VIEW v_selUtentiShort
+AS
+SELECT USER_NAME AS value, COGNOME + ' ' + NOME AS label, COD_CDC, ATTIVO
+FROM dbo.UTENTE AS ut
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPane1', @value = '[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
+Begin DesignProperties =
+ Begin PaneConfigurations =
+ Begin PaneConfiguration = 0
+ NumPanes = 4
+ Configuration = "(H (1[40] 4[20] 2[20] 3) )"
+ End
+ Begin PaneConfiguration = 1
+ NumPanes = 3
+ Configuration = "(H (1 [50] 4 [25] 3))"
+ End
+ Begin PaneConfiguration = 2
+ NumPanes = 3
+ Configuration = "(H (1 [50] 2 [25] 3))"
+ End
+ Begin PaneConfiguration = 3
+ NumPanes = 3
+ Configuration = "(H (4 [30] 2 [40] 3))"
+ End
+ Begin PaneConfiguration = 4
+ NumPanes = 2
+ Configuration = "(H (1 [56] 3))"
+ End
+ Begin PaneConfiguration = 5
+ NumPanes = 2
+ Configuration = "(H (2 [66] 3))"
+ End
+ Begin PaneConfiguration = 6
+ NumPanes = 2
+ Configuration = "(H (4 [50] 3))"
+ End
+ Begin PaneConfiguration = 7
+ NumPanes = 1
+ Configuration = "(V (3))"
+ End
+ Begin PaneConfiguration = 8
+ NumPanes = 3
+ Configuration = "(H (1[56] 4[18] 2) )"
+ End
+ Begin PaneConfiguration = 9
+ NumPanes = 2
+ Configuration = "(H (1 [75] 4))"
+ End
+ Begin PaneConfiguration = 10
+ NumPanes = 2
+ Configuration = "(H (1[66] 2) )"
+ End
+ Begin PaneConfiguration = 11
+ NumPanes = 2
+ Configuration = "(H (4 [60] 2))"
+ End
+ Begin PaneConfiguration = 12
+ NumPanes = 1
+ Configuration = "(H (1) )"
+ End
+ Begin PaneConfiguration = 13
+ NumPanes = 1
+ Configuration = "(V (4))"
+ End
+ Begin PaneConfiguration = 14
+ NumPanes = 1
+ Configuration = "(V (2))"
+ End
+ ActivePaneConfig = 0
+ End
+ Begin DiagramPane =
+ Begin Origin =
+ Top = 0
+ Left = 0
+ End
+ Begin Tables =
+ Begin Table = "ut"
+ Begin Extent =
+ Top = 6
+ Left = 38
+ Bottom = 114
+ Right = 190
+ End
+ DisplayFlags = 280
+ TopColumn = 0
+ End
+ End
+ End
+ Begin SQLPane =
+ End
+ Begin DataPane =
+ Begin ParameterDefaults = ""
+ End
+ End
+ Begin CriteriaPane =
+ Begin ColumnWidths = 11
+ Column = 1440
+ Alias = 900
+ Table = 1170
+ Output = 720
+ Append = 1400
+ NewValue = 1170
+ SortType = 1350
+ SortOrder = 1410
+ GroupBy = 1350
+ Filter = 1350
+ Or = 1350
+ Or = 1350
+ Or = 1350
+ End
+ End
+End
+', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'v_selUtentiShort';
+
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPaneCount', @value = 1, @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'v_selUtentiShort';
+
diff --git a/Projects/GimDB/dbo/Views/v_selUtentiShortAD.sql b/Projects/GimDB/dbo/Views/v_selUtentiShortAD.sql
new file mode 100644
index 0000000..bc82913
--- /dev/null
+++ b/Projects/GimDB/dbo/Views/v_selUtentiShortAD.sql
@@ -0,0 +1,119 @@
+create VIEW v_selUtentiShortAD
+AS
+SELECT DOMINIO + '\' + USER_NAME AS value, COGNOME + ' ' + NOME AS label, COD_CDC, ATTIVO
+FROM dbo.UTENTE AS ut
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPane1', @value = '[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
+Begin DesignProperties =
+ Begin PaneConfigurations =
+ Begin PaneConfiguration = 0
+ NumPanes = 4
+ Configuration = "(H (1[40] 4[20] 2[20] 3) )"
+ End
+ Begin PaneConfiguration = 1
+ NumPanes = 3
+ Configuration = "(H (1 [50] 4 [25] 3))"
+ End
+ Begin PaneConfiguration = 2
+ NumPanes = 3
+ Configuration = "(H (1 [50] 2 [25] 3))"
+ End
+ Begin PaneConfiguration = 3
+ NumPanes = 3
+ Configuration = "(H (4 [30] 2 [40] 3))"
+ End
+ Begin PaneConfiguration = 4
+ NumPanes = 2
+ Configuration = "(H (1 [56] 3))"
+ End
+ Begin PaneConfiguration = 5
+ NumPanes = 2
+ Configuration = "(H (2 [66] 3))"
+ End
+ Begin PaneConfiguration = 6
+ NumPanes = 2
+ Configuration = "(H (4 [50] 3))"
+ End
+ Begin PaneConfiguration = 7
+ NumPanes = 1
+ Configuration = "(V (3))"
+ End
+ Begin PaneConfiguration = 8
+ NumPanes = 3
+ Configuration = "(H (1[56] 4[18] 2) )"
+ End
+ Begin PaneConfiguration = 9
+ NumPanes = 2
+ Configuration = "(H (1 [75] 4))"
+ End
+ Begin PaneConfiguration = 10
+ NumPanes = 2
+ Configuration = "(H (1[66] 2) )"
+ End
+ Begin PaneConfiguration = 11
+ NumPanes = 2
+ Configuration = "(H (4 [60] 2))"
+ End
+ Begin PaneConfiguration = 12
+ NumPanes = 1
+ Configuration = "(H (1) )"
+ End
+ Begin PaneConfiguration = 13
+ NumPanes = 1
+ Configuration = "(V (4))"
+ End
+ Begin PaneConfiguration = 14
+ NumPanes = 1
+ Configuration = "(V (2))"
+ End
+ ActivePaneConfig = 0
+ End
+ Begin DiagramPane =
+ Begin Origin =
+ Top = 0
+ Left = 0
+ End
+ Begin Tables =
+ Begin Table = "ut"
+ Begin Extent =
+ Top = 6
+ Left = 38
+ Bottom = 114
+ Right = 190
+ End
+ DisplayFlags = 280
+ TopColumn = 0
+ End
+ End
+ End
+ Begin SQLPane =
+ End
+ Begin DataPane =
+ Begin ParameterDefaults = ""
+ End
+ End
+ Begin CriteriaPane =
+ Begin ColumnWidths = 11
+ Column = 1440
+ Alias = 900
+ Table = 1170
+ Output = 720
+ Append = 1400
+ NewValue = 1170
+ SortType = 1350
+ SortOrder = 1410
+ GroupBy = 1350
+ Filter = 1350
+ Or = 1350
+ Or = 1350
+ Or = 1350
+ End
+ End
+End
+', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'v_selUtentiShortAD';
+
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPaneCount', @value = 1, @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'v_selUtentiShortAD';
+
diff --git a/Projects/GimDB/dbo/Views/v_vocabolario.sql b/Projects/GimDB/dbo/Views/v_vocabolario.sql
new file mode 100644
index 0000000..50f5b84
--- /dev/null
+++ b/Projects/GimDB/dbo/Views/v_vocabolario.sql
@@ -0,0 +1,130 @@
+CREATE VIEW v_vocabolario
+AS
+SELECT Lingua, Lemma, Traduzione
+FROM dbo.Vocabolario
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPane1', @value = '[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
+Begin DesignProperties =
+ Begin PaneConfigurations =
+ Begin PaneConfiguration = 0
+ NumPanes = 4
+ Configuration = "(H (1[40] 4[20] 2[20] 3) )"
+ End
+ Begin PaneConfiguration = 1
+ NumPanes = 3
+ Configuration = "(H (1 [50] 4 [25] 3))"
+ End
+ Begin PaneConfiguration = 2
+ NumPanes = 3
+ Configuration = "(H (1 [50] 2 [25] 3))"
+ End
+ Begin PaneConfiguration = 3
+ NumPanes = 3
+ Configuration = "(H (4 [30] 2 [40] 3))"
+ End
+ Begin PaneConfiguration = 4
+ NumPanes = 2
+ Configuration = "(H (1 [56] 3))"
+ End
+ Begin PaneConfiguration = 5
+ NumPanes = 2
+ Configuration = "(H (2 [66] 3))"
+ End
+ Begin PaneConfiguration = 6
+ NumPanes = 2
+ Configuration = "(H (4 [50] 3))"
+ End
+ Begin PaneConfiguration = 7
+ NumPanes = 1
+ Configuration = "(V (3))"
+ End
+ Begin PaneConfiguration = 8
+ NumPanes = 3
+ Configuration = "(H (1[56] 4[18] 2) )"
+ End
+ Begin PaneConfiguration = 9
+ NumPanes = 2
+ Configuration = "(H (1 [75] 4))"
+ End
+ Begin PaneConfiguration = 10
+ NumPanes = 2
+ Configuration = "(H (1[66] 2) )"
+ End
+ Begin PaneConfiguration = 11
+ NumPanes = 2
+ Configuration = "(H (4 [60] 2))"
+ End
+ Begin PaneConfiguration = 12
+ NumPanes = 1
+ Configuration = "(H (1) )"
+ End
+ Begin PaneConfiguration = 13
+ NumPanes = 1
+ Configuration = "(V (4))"
+ End
+ Begin PaneConfiguration = 14
+ NumPanes = 1
+ Configuration = "(V (2))"
+ End
+ ActivePaneConfig = 0
+ End
+ Begin DiagramPane =
+ Begin Origin =
+ Top = 0
+ Left = 0
+ End
+ Begin Tables =
+ Begin Table = "Vocabolario"
+ Begin Extent =
+ Top = 6
+ Left = 38
+ Bottom = 119
+ Right = 208
+ End
+ DisplayFlags = 280
+ TopColumn = 0
+ End
+ End
+ End
+ Begin SQLPane =
+ End
+ Begin DataPane =
+ Begin ParameterDefaults = ""
+ End
+ Begin ColumnWidths = 9
+ Width = 284
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ End
+ End
+ Begin CriteriaPane =
+ Begin ColumnWidths = 11
+ Column = 1440
+ Alias = 900
+ Table = 1170
+ Output = 720
+ Append = 1400
+ NewValue = 1170
+ SortType = 1350
+ SortOrder = 1410
+ GroupBy = 1350
+ Filter = 1350
+ Or = 1350
+ Or = 1350
+ Or = 1350
+ End
+ End
+End
+', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'v_vocabolario';
+
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPaneCount', @value = 1, @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'v_vocabolario';
+
diff --git a/Projects/GimDB/dwh/Views/VDWH_AnagStati.sql b/Projects/GimDB/dwh/Views/VDWH_AnagStati.sql
new file mode 100644
index 0000000..6dba58f
--- /dev/null
+++ b/Projects/GimDB/dwh/Views/VDWH_AnagStati.sql
@@ -0,0 +1,130 @@
+CREATE VIEW [dwh].VDWH_AnagStati
+AS
+SELECT idxStato, DescrStato
+FROM dbo.AnagStati
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPane1', @value = N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
+Begin DesignProperties =
+ Begin PaneConfigurations =
+ Begin PaneConfiguration = 0
+ NumPanes = 4
+ Configuration = "(H (1[40] 4[20] 2[20] 3) )"
+ End
+ Begin PaneConfiguration = 1
+ NumPanes = 3
+ Configuration = "(H (1 [50] 4 [25] 3))"
+ End
+ Begin PaneConfiguration = 2
+ NumPanes = 3
+ Configuration = "(H (1 [50] 2 [25] 3))"
+ End
+ Begin PaneConfiguration = 3
+ NumPanes = 3
+ Configuration = "(H (4 [30] 2 [40] 3))"
+ End
+ Begin PaneConfiguration = 4
+ NumPanes = 2
+ Configuration = "(H (1 [56] 3))"
+ End
+ Begin PaneConfiguration = 5
+ NumPanes = 2
+ Configuration = "(H (2 [66] 3))"
+ End
+ Begin PaneConfiguration = 6
+ NumPanes = 2
+ Configuration = "(H (4 [50] 3))"
+ End
+ Begin PaneConfiguration = 7
+ NumPanes = 1
+ Configuration = "(V (3))"
+ End
+ Begin PaneConfiguration = 8
+ NumPanes = 3
+ Configuration = "(H (1[56] 4[18] 2) )"
+ End
+ Begin PaneConfiguration = 9
+ NumPanes = 2
+ Configuration = "(H (1 [75] 4))"
+ End
+ Begin PaneConfiguration = 10
+ NumPanes = 2
+ Configuration = "(H (1[66] 2) )"
+ End
+ Begin PaneConfiguration = 11
+ NumPanes = 2
+ Configuration = "(H (4 [60] 2))"
+ End
+ Begin PaneConfiguration = 12
+ NumPanes = 1
+ Configuration = "(H (1) )"
+ End
+ Begin PaneConfiguration = 13
+ NumPanes = 1
+ Configuration = "(V (4))"
+ End
+ Begin PaneConfiguration = 14
+ NumPanes = 1
+ Configuration = "(V (2))"
+ End
+ ActivePaneConfig = 0
+ End
+ Begin DiagramPane =
+ Begin Origin =
+ Top = 0
+ Left = 0
+ End
+ Begin Tables =
+ Begin Table = "AnagStati"
+ Begin Extent =
+ Top = 6
+ Left = 38
+ Bottom = 119
+ Right = 208
+ End
+ DisplayFlags = 280
+ TopColumn = 0
+ End
+ End
+ End
+ Begin SQLPane =
+ End
+ Begin DataPane =
+ Begin ParameterDefaults = ""
+ End
+ Begin ColumnWidths = 9
+ Width = 284
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ End
+ End
+ Begin CriteriaPane =
+ Begin ColumnWidths = 11
+ Column = 1440
+ Alias = 900
+ Table = 1170
+ Output = 720
+ Append = 1400
+ NewValue = 1170
+ SortType = 1350
+ SortOrder = 1410
+ GroupBy = 1350
+ Filter = 1350
+ Or = 1350
+ Or = 1350
+ Or = 1350
+ End
+ End
+End
+', @level0type = N'SCHEMA', @level0name = N'dwh', @level1type = N'VIEW', @level1name = N'VDWH_AnagStati';
+
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPaneCount', @value = 1, @level0type = N'SCHEMA', @level0name = N'dwh', @level1type = N'VIEW', @level1name = N'VDWH_AnagStati';
+
diff --git a/Projects/GimDB/dwh/Views/VDWH_DettaglioInterv_OLD.sql b/Projects/GimDB/dwh/Views/VDWH_DettaglioInterv_OLD.sql
new file mode 100644
index 0000000..fcf5257
--- /dev/null
+++ b/Projects/GimDB/dwh/Views/VDWH_DettaglioInterv_OLD.sql
@@ -0,0 +1,217 @@
+
+
+
+CREATE VIEW [dwh].[VDWH_DettaglioInterv_OLD]
+AS
+
+/*
+ Obsoleta - I campi sono stati tutti inseriti nella VDWH_ElencoInterventi
+*/
+
+SELECT
+ dbo.InterventiMtz.numIntMtz
+-- ,dbo.InterventiMtz.richiesta
+ ,dbo.InterventiMtz.dataLav AS Data
+ ,dbo.InterventiMtz.turnoLav AS Turno
+ ,dbo.InterventiMtz.matr AS matr
+-- ,dbo.InterventiMtz.guasto
+-- ,dbo.InterventiMtz.idxAmbito
+ ,dbo.AnagAmbitoGuasto.descrAmbitoGuasto
+-- ,dbo.InterventiMtz.idxPriorita
+ ,dbo.AnagPriorita.descrPriorita
+-- ,CASE dbo.InterventiMtz.isFermo WHEN 'True' THEN 'SI' ELSE 'NO' END AS isFermoSiNo
+-- ,dbo.InterventiMtz.idxTipo
+ ,dbo.AnagTipoGuasto.descrTipo
+-- ,dbo.InterventiMtz.idxImpianto
+-- ,dbo.AnagImpianti.codImpianto
+-- ,dbo.AnagImpianti.nomeImpianto
+-- ,dbo.InterventiMtz.idxMacchina
+-- ,dbo.AnagMacchine.codMacchina
+-- ,dbo.AnagMacchine.nomeMacchina
+-- ,dbo.InterventiMtz.descrizione
+-- ,dbo.InterventiMtz.idxStato
+ ,dbo.AnagStati.DescrStato
+ ,ISNULL(dbo.InterventiMtz.presaInCarico, dbo.InterventiMtz.richiesta) AS presaInCarico
+ ,ISNULL(dbo.InterventiMtz.inizioIntervento, ISNULL(dbo.InterventiMtz.presaInCarico, dbo.InterventiMtz.richiesta)) AS inizioIntervento
+ ,ISNULL(dbo.InterventiMtz.fineIntervento, GETDATE()) AS fineIntervento
+-- ,dbo.InterventiMtz.descrizioneIntervento
+ ,dbo.InterventiMtz.isPreventivabile
+-- ,dbo.InterventiMtz.idxCausale
+ ,ISNULL(dbo.AnagCausali.descrCausale, 'N.D.') AS descrCausale
+ ,dbo.InterventiMtz.isFermo
+FROM dbo.InterventiMtz
+INNER JOIN dbo.AnagAmbitoGuasto ON dbo.InterventiMtz.idxAmbito = dbo.AnagAmbitoGuasto.idxAmbito
+INNER JOIN dbo.AnagImpianti ON dbo.InterventiMtz.idxImpianto = dbo.AnagImpianti.idxImpianto
+INNER JOIN dbo.AnagMacchine ON dbo.InterventiMtz.idxMacchina = dbo.AnagMacchine.idxMacchina
+INNER JOIN dbo.AnagTipoGuasto ON dbo.InterventiMtz.idxTipo = dbo.AnagTipoGuasto.idxTipo
+INNER JOIN dbo.AnagPriorita ON dbo.InterventiMtz.idxPriorita = dbo.AnagPriorita.idxPriorita
+INNER JOIN dbo.AnagStati ON dbo.InterventiMtz.idxStato = dbo.AnagStati.idxStato
+LEFT JOIN dbo.AnagCausali ON dbo.InterventiMtz.idxCausale = dbo.AnagCausali.idxCausale
+
+
+/*
+SELECT numIntMtz
+ ,dataLav AS Data
+ ,turnoLav AS Turno
+ ,matr
+ ,descrAmbitoGuasto
+ ,descrPriorita
+ ,descrTipo
+ ,DescrStato
+ ,presaInCarico
+ ,inizioIntervento
+ ,fineIntervento
+ ,isPreventivabile
+ ,descrCausale
+ ,isFermo
+FROM dbo.v_intervExp
+*/
+
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPane1', @value = N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
+Begin DesignProperties =
+ Begin PaneConfigurations =
+ Begin PaneConfiguration = 0
+ NumPanes = 4
+ Configuration = "(H (1[40] 4[20] 2[20] 3) )"
+ End
+ Begin PaneConfiguration = 1
+ NumPanes = 3
+ Configuration = "(H (1 [50] 4 [25] 3))"
+ End
+ Begin PaneConfiguration = 2
+ NumPanes = 3
+ Configuration = "(H (1 [50] 2 [25] 3))"
+ End
+ Begin PaneConfiguration = 3
+ NumPanes = 3
+ Configuration = "(H (4 [30] 2 [40] 3))"
+ End
+ Begin PaneConfiguration = 4
+ NumPanes = 2
+ Configuration = "(H (1 [56] 3))"
+ End
+ Begin PaneConfiguration = 5
+ NumPanes = 2
+ Configuration = "(H (2 [66] 3))"
+ End
+ Begin PaneConfiguration = 6
+ NumPanes = 2
+ Configuration = "(H (4 [50] 3))"
+ End
+ Begin PaneConfiguration = 7
+ NumPanes = 1
+ Configuration = "(V (3))"
+ End
+ Begin PaneConfiguration = 8
+ NumPanes = 3
+ Configuration = "(H (1[56] 4[18] 2) )"
+ End
+ Begin PaneConfiguration = 9
+ NumPanes = 2
+ Configuration = "(H (1 [75] 4))"
+ End
+ Begin PaneConfiguration = 10
+ NumPanes = 2
+ Configuration = "(H (1[66] 2) )"
+ End
+ Begin PaneConfiguration = 11
+ NumPanes = 2
+ Configuration = "(H (4 [60] 2))"
+ End
+ Begin PaneConfiguration = 12
+ NumPanes = 1
+ Configuration = "(H (1) )"
+ End
+ Begin PaneConfiguration = 13
+ NumPanes = 1
+ Configuration = "(V (4))"
+ End
+ Begin PaneConfiguration = 14
+ NumPanes = 1
+ Configuration = "(V (2))"
+ End
+ ActivePaneConfig = 0
+ End
+ Begin DiagramPane =
+ Begin Origin =
+ Top = 0
+ Left = 0
+ End
+ Begin Tables =
+ Begin Table = "v_intervExp"
+ Begin Extent =
+ Top = 6
+ Left = 38
+ Bottom = 350
+ Right = 240
+ End
+ DisplayFlags = 280
+ TopColumn = 14
+ End
+ End
+ End
+ Begin SQLPane =
+ End
+ Begin DataPane =
+ Begin ParameterDefaults = ""
+ End
+ Begin ColumnWidths = 31
+ Width = 284
+ Width = 1500
+ Width = 1305
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ End
+ End
+ Begin CriteriaPane =
+ Begin ColumnWidths = 11
+ Column = 1440
+ Alias = 900
+ Table = 1170
+ Output = 720
+ Append = 1400
+ NewValue = 1170
+ SortType = 1350
+ SortOrder = 1410
+ GroupBy = 1350
+ Filter = 1350
+ Or = 1350
+ Or = 1350
+ Or = 1350
+ End
+ End
+End
+', @level0type = N'SCHEMA', @level0name = N'dwh', @level1type = N'VIEW', @level1name = N'VDWH_DettaglioInterv_OLD';
+
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPaneCount', @value = 1, @level0type = N'SCHEMA', @level0name = N'dwh', @level1type = N'VIEW', @level1name = N'VDWH_DettaglioInterv_OLD';
+
diff --git a/Projects/GimDB/dwh/Views/VDWH_ElencoInterventi.sql b/Projects/GimDB/dwh/Views/VDWH_ElencoInterventi.sql
new file mode 100644
index 0000000..26ae3b2
--- /dev/null
+++ b/Projects/GimDB/dwh/Views/VDWH_ElencoInterventi.sql
@@ -0,0 +1,219 @@
+
+
+
+CREATE VIEW [dwh].[VDWH_ElencoInterventi]
+AS
+/*
+ messo in cte i campi della dbo.v_elencoIntervFilt + aggiunti i campi mancanti da da VDWH_DettaglioInterv
+*/
+WITH cte AS
+(
+ SELECT
+ dbo.InterventiMtz.numIntMtz
+ ,dbo.InterventiMtz.richiesta
+ ,dbo.AnagImpianti.codImpianto
+ ,dbo.AnagImpianti.nomeImpianto
+ ,dbo.AnagMacchine.codMacchina
+ ,dbo.AnagMacchine.nomeMacchina
+ ,dbo.InterventiMtz.descrizione
+ ,dbo.InterventiMtz.inizioIntervento
+ ,dbo.InterventiMtz.fineIntervento
+ ,ISNULL(dbo.InterventiMtz.descrizioneIntervento, 'n.d. (report mtz)') AS descrizioneIntervento
+ ,ISNULL(dbo.AnagCausali.descrCausale, 'n.d. (causale)') AS descrCausale
+ ,ROUND(CAST(ISNULL(dbo.v_interventiErogati.totMinErogati, 0) AS FLOAT) / 60, 2) AS minErogati
+ ,dbo.f_diffOreLavorative(dbo.InterventiMtz.inizioIntervento, dbo.InterventiMtz.fineIntervento, dbo.InterventiMtz.idxMacchina) AS durataMtz
+ ,CASE (isFermo) WHEN 1 THEN dbo.f_diffOreLavorative(dbo.InterventiMtz.guasto, dbo.InterventiMtz.fineIntervento, InterventiMtz.idxMacchina)
+ WHEN 0 THEN dbo.f_diffOreLavorative(dbo.InterventiMtz.inizioIntervento, dbo.InterventiMtz.fineIntervento, InterventiMtz.idxMacchina)
+ END AS durataOff
+ ,dbo.InterventiMtz.guasto
+ ,dbo.InterventiMtz.idxStato
+ ,dbo.InterventiMtz.idxImpianto
+ ,dbo.InterventiMtz.idxMacchina
+ -- ,dbo.InterventiMtz.isFermo
+ ,CASE dbo.InterventiMtz.isFermo WHEN 'True' THEN 'SI' ELSE 'NO' END AS isFermo
+ ,dbo.InterventiMtz.scheduled
+ -- aggiunti da VDWH_DettaglioInterv
+ ,dbo.InterventiMtz.turnoLav
+ ,dbo.InterventiMtz.matr
+ ,dbo.AnagAmbitoGuasto.descrAmbitoGuasto
+ ,dbo.AnagPriorita.descrPriorita
+ ,dbo.AnagTipoGuasto.descrTipo
+ ,dbo.AnagStati.DescrStato
+ ,ISNULL(dbo.InterventiMtz.presaInCarico, dbo.InterventiMtz.richiesta) AS presaInCarico
+ ,dbo.InterventiMtz.isPreventivabile
+ ,dbo.AnagFamMacchine.nomeFamMacch
+ FROM dbo.InterventiMtz
+ INNER JOIN dbo.AnagAmbitoGuasto ON dbo.InterventiMtz.idxAmbito = dbo.AnagAmbitoGuasto.idxAmbito
+ INNER JOIN dbo.AnagImpianti ON dbo.InterventiMtz.idxImpianto = dbo.AnagImpianti.idxImpianto
+ INNER JOIN dbo.AnagMacchine ON dbo.InterventiMtz.idxMacchina = dbo.AnagMacchine.idxMacchina
+ INNER JOIN dbo.AnagTipoGuasto ON dbo.InterventiMtz.idxTipo = dbo.AnagTipoGuasto.idxTipo
+ INNER JOIN dbo.AnagPriorita ON dbo.InterventiMtz.idxPriorita = dbo.AnagPriorita.idxPriorita
+ INNER JOIN dbo.AnagStati ON dbo.InterventiMtz.idxStato = dbo.AnagStati.idxStato
+ LEFT JOIN dbo.v_interventiErogati ON dbo.InterventiMtz.numIntMtz = dbo.v_interventiErogati.numIntMtz
+ LEFT JOIN dbo.AnagCausali ON dbo.InterventiMtz.idxCausale = dbo.AnagCausali.idxCausale
+ INNER JOIN dbo.AnagFamMacchine ON dbo.AnagCausali.idxFamMacchine = dbo.AnagFamMacchine.idxFamMacchine
+ -- ORDER BY dbo.InterventiMtz.numIntMtz DESC
+)
+SELECT numIntMtz AS [Richiesta Webgim Nr.]
+ ,codImpianto AS [Codice Reparto]
+ ,nomeImpianto AS Reparto
+ ,nomeMacchina AS [Descrizione Macchina ]
+ ,codMacchina AS [Codice macchina]
+ ,dbo.f_fixCR(descrizione) AS [Descrizione Guasto]
+ ,dbo.f_fixCR(descrizioneIntervento) AS [Descrizione Intervento MTZ]
+ ,guasto AS [Ora Guasto]
+ ,richiesta AS [Ora Richiesta Webgim]
+ ,inizioIntervento AS [Ora Inizio Intervento]
+ ,fineIntervento AS [Ora Fine Intervento]
+ ,durataMtz AS [Ore intervento MTZ]
+ ,durataOff AS [Ore fermo Officina]
+ ,minErogati AS [Ore operatori MTZ]
+ ,turnoLav AS Turno
+ ,matr AS Matricola
+ ,descrAmbitoGuasto AS [Ambito Guasto]
+ ,descrPriorita AS [Descrizione Priorita]
+ ,DescrStato AS [Descrizione Stato]
+ ,presaInCarico AS [Presa in Carico]
+ ,isPreventivabile AS [Preventivabile]
+ ,descrCausale AS [Descrizione Causale]
+ ,isFermo AS [isFermo]
+ ,descrTipo AS [Tipo Guasto]
+ ,nomeFamMacch AS [Famiglia Causale]
+FROM cte
+
+/*
+SELECT numIntMtz AS [Richiesta Webgim Nr.]
+ ,codImpianto AS [Codice Reparto]
+ ,nomeImpianto AS Reparto
+ ,nomeMacchina AS [Descrizione Macchina ]
+ ,codMacchina AS [Codice macchina]
+ ,dbo.f_fixCR(descrizione) AS [Descrizione Guasto]
+ ,dbo.f_fixCR(descrizioneIntervento) AS [Descrizione Intervento MTZ]
+ ,guasto AS [Ora Guasto]
+ ,richiesta AS [Ora Richiesta Webgim]
+ ,inizioIntervento AS [Ora Inizio Intervento]
+ ,fineIntervento AS [Ora Fine Intervento]
+ ,durataMtz AS [Ore intervento MTZ]
+ ,durataOff AS [Ore fermo Officina]
+ ,minErogati AS [Ore operatori MTZ]
+FROM dbo.v_elencoIntervFilt
+*/
+
+
+
+
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPane1', @value = N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
+Begin DesignProperties =
+ Begin PaneConfigurations =
+ Begin PaneConfiguration = 0
+ NumPanes = 4
+ Configuration = "(H (1[40] 4[20] 2[20] 3) )"
+ End
+ Begin PaneConfiguration = 1
+ NumPanes = 3
+ Configuration = "(H (1 [50] 4 [25] 3))"
+ End
+ Begin PaneConfiguration = 2
+ NumPanes = 3
+ Configuration = "(H (1 [50] 2 [25] 3))"
+ End
+ Begin PaneConfiguration = 3
+ NumPanes = 3
+ Configuration = "(H (4 [30] 2 [40] 3))"
+ End
+ Begin PaneConfiguration = 4
+ NumPanes = 2
+ Configuration = "(H (1 [56] 3))"
+ End
+ Begin PaneConfiguration = 5
+ NumPanes = 2
+ Configuration = "(H (2 [66] 3))"
+ End
+ Begin PaneConfiguration = 6
+ NumPanes = 2
+ Configuration = "(H (4 [50] 3))"
+ End
+ Begin PaneConfiguration = 7
+ NumPanes = 1
+ Configuration = "(V (3))"
+ End
+ Begin PaneConfiguration = 8
+ NumPanes = 3
+ Configuration = "(H (1[56] 4[18] 2) )"
+ End
+ Begin PaneConfiguration = 9
+ NumPanes = 2
+ Configuration = "(H (1 [75] 4))"
+ End
+ Begin PaneConfiguration = 10
+ NumPanes = 2
+ Configuration = "(H (1[66] 2) )"
+ End
+ Begin PaneConfiguration = 11
+ NumPanes = 2
+ Configuration = "(H (4 [60] 2))"
+ End
+ Begin PaneConfiguration = 12
+ NumPanes = 1
+ Configuration = "(H (1) )"
+ End
+ Begin PaneConfiguration = 13
+ NumPanes = 1
+ Configuration = "(V (4))"
+ End
+ Begin PaneConfiguration = 14
+ NumPanes = 1
+ Configuration = "(V (2))"
+ End
+ ActivePaneConfig = 0
+ End
+ Begin DiagramPane =
+ Begin Origin =
+ Top = 0
+ Left = 0
+ End
+ Begin Tables =
+ Begin Table = "v_elencoIntervFilt"
+ Begin Extent =
+ Top = 6
+ Left = 38
+ Bottom = 136
+ Right = 240
+ End
+ DisplayFlags = 280
+ TopColumn = 0
+ End
+ End
+ End
+ Begin SQLPane =
+ End
+ Begin DataPane =
+ Begin ParameterDefaults = ""
+ End
+ End
+ Begin CriteriaPane =
+ Begin ColumnWidths = 11
+ Column = 1440
+ Alias = 900
+ Table = 1170
+ Output = 720
+ Append = 1400
+ NewValue = 1170
+ SortType = 1350
+ SortOrder = 1410
+ GroupBy = 1350
+ Filter = 1350
+ Or = 1350
+ Or = 1350
+ Or = 1350
+ End
+ End
+End
+', @level0type = N'SCHEMA', @level0name = N'dwh', @level1type = N'VIEW', @level1name = N'VDWH_ElencoInterventi';
+
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPaneCount', @value = 1, @level0type = N'SCHEMA', @level0name = N'dwh', @level1type = N'VIEW', @level1name = N'VDWH_ElencoInterventi';
+
diff --git a/Projects/GimDB/dwh/Views/VDWH_ImpiegoRisorse.sql b/Projects/GimDB/dwh/Views/VDWH_ImpiegoRisorse.sql
new file mode 100644
index 0000000..c74b39e
--- /dev/null
+++ b/Projects/GimDB/dwh/Views/VDWH_ImpiegoRisorse.sql
@@ -0,0 +1,17 @@
+
+CREATE VIEW [dwh].[VDWH_ImpiegoRisorse]
+AS
+ SELECT
+ -- ImRi.idxImpiego
+ ImRi.numIntMtz
+ ,ImRi.CodRisorsa
+ ,AnRi.DescrRisorsa
+ ,ImRi.QtaRisorsa
+ ,ImRi.CostoUnit
+ ,ImRi.TotImport
+ ,AnRi.UM
+ ,AnRi.Valuta
+ -- ,ImRi.Note
+ FROM dbo.ImpiegoRisorse AS ImRi
+ INNER JOIN dbo.AnagTipoRisorsa AS AnRi
+ ON ImRi.CodRisorsa = AnRi.CodRisorsa
diff --git a/Projects/GimDB/dwh/Views/VDWH_IntervOperatori.sql b/Projects/GimDB/dwh/Views/VDWH_IntervOperatori.sql
new file mode 100644
index 0000000..1b60524
--- /dev/null
+++ b/Projects/GimDB/dwh/Views/VDWH_IntervOperatori.sql
@@ -0,0 +1,147 @@
+
+CREATE VIEW [dwh].[VDWH_IntervOperatori]
+AS
+SELECT
+ dbo.InterventoOpMtz.numIntMtz
+ ,dbo.InterventoOpMtz.durataMinuti
+ ,dbo.AnagrOperMtz.matrOp
+ ,dbo.AnagrOperMtz.Cognome
+ ,dbo.AnagrOperMtz.Nome
+FROM dbo.AnagrOperMtz
+INNER JOIN dbo.InterventoOpMtz ON dbo.AnagrOperMtz.matrOp = dbo.InterventoOpMtz.matrOp
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPane1', @value = N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
+Begin DesignProperties =
+ Begin PaneConfigurations =
+ Begin PaneConfiguration = 0
+ NumPanes = 4
+ Configuration = "(H (1[40] 4[20] 2[20] 3) )"
+ End
+ Begin PaneConfiguration = 1
+ NumPanes = 3
+ Configuration = "(H (1 [50] 4 [25] 3))"
+ End
+ Begin PaneConfiguration = 2
+ NumPanes = 3
+ Configuration = "(H (1 [50] 2 [25] 3))"
+ End
+ Begin PaneConfiguration = 3
+ NumPanes = 3
+ Configuration = "(H (4 [30] 2 [40] 3))"
+ End
+ Begin PaneConfiguration = 4
+ NumPanes = 2
+ Configuration = "(H (1 [56] 3))"
+ End
+ Begin PaneConfiguration = 5
+ NumPanes = 2
+ Configuration = "(H (2 [66] 3))"
+ End
+ Begin PaneConfiguration = 6
+ NumPanes = 2
+ Configuration = "(H (4 [50] 3))"
+ End
+ Begin PaneConfiguration = 7
+ NumPanes = 1
+ Configuration = "(V (3))"
+ End
+ Begin PaneConfiguration = 8
+ NumPanes = 3
+ Configuration = "(H (1[56] 4[18] 2) )"
+ End
+ Begin PaneConfiguration = 9
+ NumPanes = 2
+ Configuration = "(H (1 [75] 4))"
+ End
+ Begin PaneConfiguration = 10
+ NumPanes = 2
+ Configuration = "(H (1[66] 2) )"
+ End
+ Begin PaneConfiguration = 11
+ NumPanes = 2
+ Configuration = "(H (4 [60] 2))"
+ End
+ Begin PaneConfiguration = 12
+ NumPanes = 1
+ Configuration = "(H (1) )"
+ End
+ Begin PaneConfiguration = 13
+ NumPanes = 1
+ Configuration = "(V (4))"
+ End
+ Begin PaneConfiguration = 14
+ NumPanes = 1
+ Configuration = "(V (2))"
+ End
+ ActivePaneConfig = 0
+ End
+ Begin DiagramPane =
+ Begin Origin =
+ Top = 0
+ Left = 0
+ End
+ Begin Tables =
+ Begin Table = "AnagrOperMtz"
+ Begin Extent =
+ Top = 6
+ Left = 38
+ Bottom = 119
+ Right = 208
+ End
+ DisplayFlags = 280
+ TopColumn = 0
+ End
+ Begin Table = "InterventoOpMtz"
+ Begin Extent =
+ Top = 6
+ Left = 246
+ Bottom = 141
+ Right = 416
+ End
+ DisplayFlags = 280
+ TopColumn = 0
+ End
+ End
+ End
+ Begin SQLPane =
+ End
+ Begin DataPane =
+ Begin ParameterDefaults = ""
+ End
+ Begin ColumnWidths = 9
+ Width = 284
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ Width = 1500
+ End
+ End
+ Begin CriteriaPane =
+ Begin ColumnWidths = 11
+ Column = 1440
+ Alias = 900
+ Table = 1170
+ Output = 720
+ Append = 1400
+ NewValue = 1170
+ SortType = 1350
+ SortOrder = 1410
+ GroupBy = 1350
+ Filter = 1350
+ Or = 1350
+ Or = 1350
+ Or = 1350
+ End
+ End
+End
+', @level0type = N'SCHEMA', @level0name = N'dwh', @level1type = N'VIEW', @level1name = N'VDWH_IntervOperatori';
+
+
+GO
+EXECUTE sp_addextendedproperty @name = N'MS_DiagramPaneCount', @value = 1, @level0type = N'SCHEMA', @level0name = N'dwh', @level1type = N'VIEW', @level1name = N'VDWH_IntervOperatori';
+
diff --git a/Projects/GimDB/export/Views/v_allData.sql b/Projects/GimDB/export/Views/v_allData.sql
new file mode 100644
index 0000000..2aad597
--- /dev/null
+++ b/Projects/GimDB/export/Views/v_allData.sql
@@ -0,0 +1,52 @@
+CREATE VIEW export.v_allData
+AS
+
+SELECT InterventiMtz.numIntMtz
+ , CAST(InterventiMtz.dataLav AS DATE) as dataLav
+ , InterventiMtz.turnoLav
+ , InterventiMtz.matr
+ , InterventiMtz.richiesta
+ , AnagImpianti.codImpianto
+ , AnagImpianti.nomeImpianto
+ , AnagMacchine.codMacchina
+ , AnagMacchine.nomeMacchina
+ , InterventiMtz.descrizione
+ , InterventiMtz.inizioIntervento
+ , InterventiMtz.fineIntervento
+ , ISNULL(InterventiMtz.descrizioneIntervento, 'n.d. (report mtz)') AS descrizioneIntervento
+ , ISNULL(AnagCausali.descrCausale, 'n.d. (causale)') AS descrCausale
+ , ROUND(CAST(ISNULL(v_interventiErogati.totMinErogati, 0) AS FLOAT) / 60, 2) AS minErogati
+ , CAST(ISNULL(vri.TotImport, 0) AS DECIMAL(9, 3)) AS ImportoTot
+ , dbo.f_diffOreLavorative(InterventiMtz.inizioIntervento, InterventiMtz.fineIntervento, InterventiMtz.idxMacchina) AS durataMtz
+ , CASE (isFermo)
+ WHEN 1
+ THEN dbo.f_diffOreLavorative(dbo.InterventiMtz.guasto, dbo.InterventiMtz.fineIntervento, InterventiMtz.idxMacchina)
+ WHEN 0
+ THEN dbo.f_diffOreLavorative(dbo.InterventiMtz.inizioIntervento, dbo.InterventiMtz.fineIntervento, InterventiMtz.idxMacchina)
+ END AS durataOff
+ , InterventiMtz.guasto
+ , InterventiMtz.idxStato
+ , InterventiMtz.idxImpianto
+ , InterventiMtz.idxMacchina
+ , InterventiMtz.isFermo
+ , InterventiMtz.scheduled
+FROM InterventiMtz
+INNER JOIN AnagAmbitoGuasto
+ ON InterventiMtz.idxAmbito = AnagAmbitoGuasto.idxAmbito
+INNER JOIN AnagImpianti
+ ON InterventiMtz.idxImpianto = AnagImpianti.idxImpianto
+INNER JOIN AnagMacchine
+ ON InterventiMtz.idxMacchina = AnagMacchine.idxMacchina
+INNER JOIN AnagTipoGuasto
+ ON InterventiMtz.idxTipo = AnagTipoGuasto.idxTipo
+INNER JOIN AnagPriorita
+ ON InterventiMtz.idxPriorita = AnagPriorita.idxPriorita
+INNER JOIN AnagStati
+ ON InterventiMtz.idxStato = AnagStati.idxStato
+LEFT JOIN v_interventiErogati
+ ON InterventiMtz.numIntMtz = v_interventiErogati.numIntMtz
+LEFT JOIN v_risorseImpiegate AS vri
+ ON InterventiMtz.numIntMtz = vri.numIntMtz
+LEFT JOIN AnagCausali
+ ON InterventiMtz.idxCausale = AnagCausali.idxCausale
+--ORDER BY InterventiMtz.numIntMtz DESC
diff --git a/Projects/GimDB/voc/Stored Procedures/stp_getByLingua.sql b/Projects/GimDB/voc/Stored Procedures/stp_getByLingua.sql
new file mode 100644
index 0000000..c0cee69
--- /dev/null
+++ b/Projects/GimDB/voc/Stored Procedures/stp_getByLingua.sql
@@ -0,0 +1,9 @@
+create PROCEDURE voc.stp_getByLingua
+(
+ @Lingua nvarchar(3)
+)
+AS
+ SET NOCOUNT ON;
+SELECT Lingua, Lemma, Traduzione
+FROM Vocabolario
+WHERE (Lingua = @Lingua)
diff --git a/Projects/GimDB/voc/Stored Procedures/stp_getByLinguaLemmaLike.sql b/Projects/GimDB/voc/Stored Procedures/stp_getByLinguaLemmaLike.sql
new file mode 100644
index 0000000..3a71d6d
--- /dev/null
+++ b/Projects/GimDB/voc/Stored Procedures/stp_getByLinguaLemmaLike.sql
@@ -0,0 +1,33 @@
+/*************************************
+* STORED PROCEDURE stp_getByLemmaLike
+*
+* elenco record da ricerca LIKE su lemma
+*
+* mod : 2014.04.28
+* aut : S.E. Locatelli
+**************************************/
+create PROCEDURE voc.stp_getByLinguaLemmaLike
+(
+ @Lingua NVARCHAR(3),
+ @search NVARCHAR(50)
+)
+AS
+
+SET NOCOUNT ON;
+SELECT Lingua, Lemma
+ ,CASE WHEN @Lingua = 'LB' THEN CONVERT(NVARCHAR(500),Lemma)
+ ELSE Traduzione END
+ AS Traduzione -- la traduzione corrisponde ai campi/lemmi x i report
+FROM Vocabolario
+WHERE (Lemma LIKE @search + '%')
+ AND ( Lingua = CASE WHEN @Lingua = 'LB' -- se richiede le Label dei campi estraggo i lemmi in inglese
+ THEN 'EN'
+ ELSE @Lingua
+ END )
+
+/* OLD
+SELECT Lingua, Lemma, Traduzione
+FROM Vocabolario
+WHERE (Lemma LIKE @search + '%')
+ AND (Lingua = @Lingua)
+*/
diff --git a/Projects/GimDB/voc/Stored Procedures/stp_insNewLemma.sql b/Projects/GimDB/voc/Stored Procedures/stp_insNewLemma.sql
new file mode 100644
index 0000000..bbb96ea
--- /dev/null
+++ b/Projects/GimDB/voc/Stored Procedures/stp_insNewLemma.sql
@@ -0,0 +1,33 @@
+/*************************************
+* STORED PROCEDURE stp_insNewLemma
+*
+* inseriemtno lemma vocabolario
+*
+* mod : 14/05/2012
+* aut : S.E. Locatelli
+**************************************/
+create PROCEDURE voc.stp_insNewLemma
+(
+ @lemma NVARCHAR(50),
+ @traduzione NVARCHAR(500),
+ @OverWrite CHAR(1) = 'Y' -- Y/N Per forzarne inserimento anche se già presente
+)
+AS
+
+-- elimino se c'era già e se richiesto...
+IF @OverWrite = 'Y'
+BEGIN
+ DELETE FROM Vocabolario
+ WHERE lemma = @lemma
+END
+
+-- inserisco x tutte le lingue attive...
+INSERT INTO Vocabolario
+SELECT lingua, @lemma, @traduzione
+FROM Lingue
+
+SELECT *
+FROM Vocabolario
+WHERE lemma = @lemma
+
+RETURN
diff --git a/Projects/GimDB/voc/Stored Procedures/stp_updateQuery.sql b/Projects/GimDB/voc/Stored Procedures/stp_updateQuery.sql
new file mode 100644
index 0000000..0cd7005
--- /dev/null
+++ b/Projects/GimDB/voc/Stored Procedures/stp_updateQuery.sql
@@ -0,0 +1,9 @@
+create PROCEDURE voc.stp_updateQuery
+(
+ @Traduzione nvarchar(500),
+ @Original_Lingua nvarchar(3),
+ @Original_Lemma nvarchar(50)
+)
+AS
+ SET NOCOUNT OFF;
+UPDATE [dbo].[Vocabolario] SET [Traduzione] = @Traduzione WHERE ([Lingua] = @Original_Lingua) AND ([Lemma] = @Original_Lemma)
diff --git a/Projects/GimDB/voc/Stored Procedures/stp_upsertLemma.sql b/Projects/GimDB/voc/Stored Procedures/stp_upsertLemma.sql
new file mode 100644
index 0000000..7c666d5
--- /dev/null
+++ b/Projects/GimDB/voc/Stored Procedures/stp_upsertLemma.sql
@@ -0,0 +1,28 @@
+/*************************************
+* STORED PROCEDURE stp_upsertLemma
+*
+* upsert record lemma
+*
+* mod : 14/05/2012
+* aut : S.E. Locatelli
+**************************************/
+create PROCEDURE voc.stp_upsertLemma
+(
+ @Lingua NVARCHAR(3),
+ @Lemma NVARCHAR(50),
+ @Traduzione NVARCHAR(500)
+)
+AS
+
+-- effettuo merge x upsert!
+
+ MERGE Vocabolario AS target
+ USING (SELECT @Lingua, @Lemma, @Traduzione) AS source (Lingua, Lemma, Traduzione)
+ ON (target.Lingua = source.Lingua AND target.Lemma = source.Lemma)
+ WHEN MATCHED THEN
+ UPDATE SET Traduzione = source.traduzione
+ WHEN NOT MATCHED THEN
+ INSERT (Lingua, Lemma, Traduzione)
+ VALUES (source.Lingua, source.Lemma, source.Traduzione);
+
+RETURN
diff --git a/Projects/GimDB/voc/Stored Procedures/stp_voUpdateLemmiReport.sql b/Projects/GimDB/voc/Stored Procedures/stp_voUpdateLemmiReport.sql
new file mode 100644
index 0000000..5f3a90a
--- /dev/null
+++ b/Projects/GimDB/voc/Stored Procedures/stp_voUpdateLemmiReport.sql
@@ -0,0 +1,33 @@
+-- =============================================
+-- Author: Samuele Locatelli
+-- Create date: 2014.05.09
+-- Description: riallinea le traduzioni dei report ai termini corrispondenti a video
+-- =============================================
+create PROCEDURE voc.stp_voUpdateLemmiReport
+AS
+BEGIN
+ -- SET NOCOUNT ON added to prevent extra result sets from
+ -- interfering with SELECT statements.
+ SET NOCOUNT ON;
+
+ -- mostro situazione iniziale
+ SELECT *
+ FROM Vocabolario v1
+ inner join vocabolario v ON replace(v1.Lemma, 'C2P_prt1_','') = v.Lemma AND v1.Lingua = v.Lingua
+ WHERE v1.lemma LIKE 'C2P_prt1_%'
+
+ -- update!
+ UPDATE v1
+ SET traduzione = v.traduzione
+ FROM Vocabolario v1
+ INNER JOIN vocabolario v ON replace(v1.Lemma, 'C2P_prt1_','') = v.Lemma AND v1.Lingua = v.Lingua
+ WHERE v1.lemma LIKE 'C2P_prt1_%'
+
+
+ -- mostro situazione finale
+ SELECT *
+ FROM Vocabolario v1
+ inner join vocabolario v ON replace(v1.Lemma, 'C2P_prt1_','') = v.Lemma AND v1.Lingua = v.Lingua
+ WHERE v1.lemma LIKE 'C2P_prt1_%'
+
+END