set xact_abort on
go

begin transaction
go

set ANSI_NULLS on
go

alter VIEW v_selUdcByPart
AS
SELECT        UDC AS value, ISNULL(RTRIM(UDC), '-') + ' - ' + ISNULL(RTRIM(Particolare), '...') + ' (' + ISNULL(RTRIM(DescParticolare), '') + ') ' + ISNULL(RTRIM(DisegnoGrezzo), '-') 
                         + ' pz. ' + ISNULL(CAST(Qta AS varchar), '0') AS label, Particolare AS conditio, IdxPosizione
FROM            dbo.ElencoCartellini
WHERE        (NOT (Particolare IS NULL)) AND (IdxPosizione >= 0)
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 = "ElencoCartellini"
            Begin Extent = 
               Top = 6
               Left = 38
               Bottom = 319
               Right = 208
            End
            DisplayFlags = 280
            TopColumn = 11
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
      Begin ColumnWidths = 9
         Width = 284
         Width = 1500
         Width = 8910
         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_selUdcByPart'
go

commit
go


set xact_abort on
go

begin transaction
go

set ANSI_NULLS on
go

/***************************************
* STORED stp_getUdcDetailFullCode
*
* ottiene l'elenco degli UDC con i dati significativi partendo da un codice UDC COMPLETO
*
* Steamware, S.E.L.
* mod: 2010.05.24
*
****************************************/
alter PROCEDURE stp_getUdcDetailFullCode
(
	@UDC VARCHAR(50),
	@CodCS VARCHAR(2)	
)
AS

SELECT        ec.UDC, ISNULL(ec.RagSociale, N'nd') AS RagSociale, ISNULL(ec.Particolare, N'nd') AS Particolare,
			  ISNULL(ec.DescParticolare, N'nd') AS DescParticolare, ISNULL(ec.DisegnoGrezzo, N'nd') AS DisegnoGrezzo, 
              ISNULL(ec.Esponente, N'nd') AS Esponente, ISNULL(ec.DescImpianto, N'nd') AS DescImpianto,
              ISNULL(ec.DataFus, N'') AS DataFus, ISNULL(ec.TurnoFus, 0) AS TurnoFus, ec.CodImballo, 
              ec.Qta,  ISNULL(AnagStatiProdotto.DescStato, N'nd') AS DescStato, ec.ModDate, 
              CASE WHEN(ec.IdxPosizione < 0)  THEN 'Consum' ELSE ISNULL(Blocchi.CodMag, N'nd') END AS CodMag, 
              ISNULL(Blocchi.CodBlocco, N'nd') AS CodBlocco, ISNULL(Celle.CodCella, N'nd') AS CodCella, ISNULL(dbo.Celle.IdxCella, 0) AS IdxCella,
              ISNULL(Celle.X, 0) AS X, ISNULL(Celle.Y, 0) AS Y, ISNULL(Celle.Z, 0) AS Z, ec.IdxPosizione
FROM          AnagStatiProdotto RIGHT OUTER JOIN
              ElencoCartellini ec ON AnagStatiProdotto.CodStato = ec.CodStato AND AnagStatiProdotto.CodStato = ec.CodStato 
              LEFT OUTER JOIN Celle INNER JOIN PosizioneUdcCorrente ON Celle.IdxCella = PosizioneUdcCorrente.IdxCella 
              AND Celle.IdxCella = PosizioneUdcCorrente.IdxCella AND Celle.IdxCella = PosizioneUdcCorrente.IdxCella 
              INNER JOIN Blocchi ON Celle.IdxBlocco = Blocchi.IdxBlocco INNER JOIN AnagMag ON Blocchi.CodMag = AnagMag.CodMag 
              AND Blocchi.CodCS = AnagMag.CodCS AND Blocchi.CodMag = AnagMag.CodMag AND Blocchi.CodCS = AnagMag.CodCS AND Blocchi.CodMag = AnagMag.CodMag 
              AND Blocchi.CodCS = AnagMag.CodCS ON ec.UDC = PosizioneUdcCorrente.UDC
WHERE        (ec.UDC = @UDC) AND (ec.CodCS = @CodCS)

RETURN
go

commit
go






-- registro versione...
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(286, GETDATE())
GO
