Files
Samuele Locatelli 5d99b976a3 spostamento XPS_data
2017-01-31 14:34:55 +01:00

435 lines
10 KiB
Transact-SQL

set xact_abort on;
go
begin transaction;
go
alter table AnagStati add
PrioritaStato int;
go
set ANSI_NULLS on;
go
alter VIEW v_selStati
AS
SELECT CodStato AS value, DescrStato AS label, FamStato AS conditio, PrioritaStato
FROM dbo.AnagStati
go
exec sp_updateextendedproperty 'MS_DiagramPane1', '[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties =
Begin PaneConfigurations =
Begin PaneConfiguration = 0
NumPanes = 4
Configuration = "(H (1[41] 4[20] 2[7] 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 = 260
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
', 'SCHEMA', 'dbo', 'VIEW', 'v_selStati';
go
commit;
go
set xact_abort on
go
begin transaction
go
UPDATE dbo.AnagStati SET
PrioritaStato=99
WHERE CodStato=N'*'
UPDATE dbo.AnagStati SET
PrioritaStato=1
WHERE CodStato=N'01'
UPDATE dbo.AnagStati SET
PrioritaStato=2
WHERE CodStato=N'02'
UPDATE dbo.AnagStati SET
PrioritaStato=3
WHERE CodStato=N'03'
UPDATE dbo.AnagStati SET
PrioritaStato=4
WHERE CodStato=N'04'
UPDATE dbo.AnagStati SET
PrioritaStato=5
WHERE CodStato=N'05'
UPDATE dbo.AnagStati SET
PrioritaStato=6
WHERE CodStato=N'06'
UPDATE dbo.AnagStati SET
PrioritaStato=7
WHERE CodStato=N'07'
go
commit transaction
go
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
alter VIEW v_commesse
AS
SELECT TOP (100) PERCENT dbo.IstObj.IdxObj AS Cod, AnagStati_1.DescrStato AS Stato, ISNULL(dbo.AnagClienti.CodCliente, N'-') AS CodCliente,
ISNULL(dbo.AnagClienti.RagioneSociale, N'-') AS Cliente, ISNULL(dbo.IstObj.Note, N'-') AS descrizione, dbo.IstObj.Nome AS DDT, dbo.IstObj.DataRif AS DataDDT,
dbo.IstObj.DataCreaz AS DataArrivo, dbo.IstObj.Posizione, ISNULL(dbo.v_ULP_DDT.TotQta, 0) AS Qta, ISNULL(dbo.v_ULP_DDT.TotPeso, 0) AS Peso,
ISNULL(dbo.v_righeDDT.NumRighe, 0) AS Righe, ISNULL(dbo.v_ULP_DDT.NumRighe, 0) AS Colli, dbo.v_ULP_DDT.DueDate AS DataPrevista,
dbo.IstObj.ExtKey AS Ciclo, dbo.IstObj.CodStato, dbo.AnagStati.DescrStato AS minStato, AnagStati_2.DescrStato AS maxStato,
dbo.v_ULP_DDT.minStato AS minCodStato, dbo.v_ULP_DDT.maxStato AS maxCodStato
FROM dbo.AnagStati INNER JOIN
dbo.v_ULP_DDT ON dbo.AnagStati.CodStato = dbo.v_ULP_DDT.minStato INNER JOIN
dbo.AnagStati AS AnagStati_2 ON dbo.v_ULP_DDT.maxStato = AnagStati_2.CodStato RIGHT OUTER JOIN
dbo.IstObj LEFT OUTER JOIN
dbo.AnagClienti ON dbo.IstObj.CodCliente = dbo.AnagClienti.CodCliente LEFT OUTER JOIN
dbo.AnagStati AS AnagStati_1 ON dbo.IstObj.CodStato = AnagStati_1.CodStato LEFT OUTER JOIN
dbo.v_righeDDT ON dbo.IstObj.IdxObj = dbo.v_righeDDT.IdxObjMamma ON dbo.v_ULP_DDT.IdxObjMamma = dbo.IstObj.IdxObj
WHERE (dbo.IstObj.IdxObjMamma IS NULL) AND (dbo.IstObj.Livello = 1)
ORDER BY DataArrivo DESC
go
commit;
go
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
alter VIEW v_selClienti
AS
SELECT TOP (100) PERCENT CodCliente AS value, CodCliente + ' - ' + RagioneSociale AS label
FROM dbo.AnagClienti
ORDER BY label
go
exec sp_updateextendedproperty 'MS_DiagramPane1', '[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 = "AnagClienti"
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
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
', 'SCHEMA', 'dbo', 'VIEW', 'v_selClienti';
go
commit;
go
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
/***************************************
* STORED stp_IstObjUpdateMag
*
* gestione update dati commessa a livello magazzino
*
* Steamware, S.E.L.
* mod: 2012.02.03
*
****************************************/
create PROCEDURE stp_IstObjUpdateMag
(
@Original_Cod NVARCHAR(50),
@CodCliente NVARCHAR(50),
@Ciclo NVARCHAR(50), -- ExtKey
@DataDDT DATETIME, -- DataRif
@DDT NVARCHAR(50), -- nome
@UserName NVARCHAR(50), -- UserMod
@Descrizione NVARCHAR(50) -- Note
)
AS
UPDATE IstObj
SET CodCliente = @CodCliente,
ExtKey = @Ciclo,
DataRif = @DataDDT,
Nome = @DDT,
UserMod = @UserName,
DataMod = GETDATE(),
Note = @Descrizione
WHERE (IdxObj = @Original_Cod)
RETURN
go
/***************************************
* STORED stp_selStatiMinMax
*
* cerca stati x priorità minima e max
*
* Steamware, S.E.L.
* mod: 2012.02.03
*
****************************************/
create PROCEDURE stp_selStatiMinMax
(
@PrioritaStatoMin INT,
@PrioritaStatoMax INT
)
AS
SELECT value, label, PrioritaStato as conditio
FROM v_selStati
WHERE (PrioritaStato Between @PrioritaStatoMin AND @PrioritaStatoMax)
RETURN
go
commit;
go
create table LogUpdateDb(
Versione int not null constraint PK_LogUpdateDb primary key,
Data datetime
);
go
-- registro versione...
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(130, GETDATE())
GO