
EXEC sys.sp_dropextendedproperty @name=N'MS_DiagramPaneCount' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_ListaTamanhos_ArtigoEncomenda'
GO

EXEC sys.sp_dropextendedproperty @name=N'MS_DiagramPane2' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_ListaTamanhos_ArtigoEncomenda'
GO

EXEC sys.sp_dropextendedproperty @name=N'MS_DiagramPane1' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_ListaTamanhos_ArtigoEncomenda'
GO

/****** Object:  View [dbo].[View_ListaTamanhos_ArtigoEncomenda]    Script Date: 07/12/2021 09:58:49 ******/
DROP VIEW [dbo].[View_ListaTamanhos_ArtigoEncomenda]
GO

/****** Object:  View [dbo].[View_ListaTamanhos_ArtigoEncomenda]    Script Date: 07/12/2021 09:58:49 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[View_ListaTamanhos_ArtigoEncomenda]
AS
SELECT        dbo.View_ListaArtigosEncomendaCliente.strCodSeccao, dbo.View_ListaArtigosEncomendaCliente.strAbrevTpDoc, dbo.View_ListaArtigosEncomendaCliente.strCodExercicio, dbo.View_ListaArtigosEncomendaCliente.intNumero, 
                         dbo.View_ListaArtigosEncomendaCliente.strNumero, dbo.View_ListaArtigosEncomendaCliente.CodDesenho, dbo.T99_0204_SubArtTam.StrCodArtigo, dbo.T01_Artigos.StrDescricao, dbo.T01_Artigos.IntId, 
                         dbo.T99_0204_SubArtTam.StrCodTpPeca, dbo.T03_Desenhos.StrDescricaoDesenho, LEFT(dbo.T99_0204_SubArtTam.StrCodSubArtigo, LEN(dbo.T99_0204_SubArtTam.StrCodSubArtigo) - 3) AS CodPeca, 
                         dbo.T02_SubArtigos.StrCodCor, dbo.T99_0204_SubArtTam.StrCodTamanho, dbo.T99_0204_SubArtTam.StrCodSubArtigo, dbo.T01_Artigos.strTipo AS StrTipoArtigo, dbo.T99_0204_SubArtTam.fltPesoReferencia
FROM            dbo.View_ListaArtigosEncomendaCliente INNER JOIN
                         dbo.T99_0204_SubArtTam ON dbo.View_ListaArtigosEncomendaCliente.CodDesenho = dbo.T99_0204_SubArtTam.StrCodDesenho INNER JOIN
                         dbo.T01_Artigos ON dbo.T99_0204_SubArtTam.StrCodArtigo = dbo.T01_Artigos.StrCodigo INNER JOIN
                         dbo.T03_Desenhos ON dbo.T99_0204_SubArtTam.StrCodDesenho = dbo.T03_Desenhos.StrCodDesenho AND dbo.T99_0204_SubArtTam.StrCodArtigoCliente = dbo.T03_Desenhos.StrCodArtigoCliente INNER JOIN
                         dbo.T02_SubArtigos ON dbo.T01_Artigos.StrCodigo = dbo.T02_SubArtigos.StrCodArtigoPai
GROUP BY dbo.View_ListaArtigosEncomendaCliente.strCodSeccao, dbo.View_ListaArtigosEncomendaCliente.strAbrevTpDoc, dbo.View_ListaArtigosEncomendaCliente.strCodExercicio, dbo.View_ListaArtigosEncomendaCliente.intNumero, 
                         dbo.View_ListaArtigosEncomendaCliente.strNumero, dbo.View_ListaArtigosEncomendaCliente.CodDesenho, dbo.T99_0204_SubArtTam.StrCodArtigo, dbo.T01_Artigos.StrDescricao, dbo.T01_Artigos.IntId, 
                         dbo.T01_Artigos.BitActivo, dbo.T01_Artigos.BitFechado, dbo.T01_Artigos.BitEliminado, dbo.T99_0204_SubArtTam.StrCodTpPeca, dbo.T03_Desenhos.StrDescricaoDesenho, LEFT(dbo.T99_0204_SubArtTam.StrCodSubArtigo, 
                         LEN(dbo.T99_0204_SubArtTam.StrCodSubArtigo) - 3), dbo.T02_SubArtigos.StrCodCor, dbo.T99_0204_SubArtTam.StrCodTamanho, dbo.T99_0204_SubArtTam.StrCodSubArtigo, 
                         RIGHT(LEFT(dbo.View_ListaArtigosEncomendaCliente.strCodArtigo, 15), 1), dbo.T03_Desenhos.IntIdArtigoCliente, dbo.View_ListaArtigosEncomendaCliente.strCodArtigo, RIGHT(dbo.T99_0204_SubArtTam.StrCodSubArtigo, 4), 
                         dbo.T01_Artigos.strTipo, dbo.T99_0204_SubArtTam.fltPesoReferencia
HAVING        (dbo.T01_Artigos.BitActivo = 1) AND (dbo.T01_Artigos.BitFechado = 0) AND (dbo.T01_Artigos.BitEliminado IS NULL) AND (RIGHT(LEFT(dbo.View_ListaArtigosEncomendaCliente.strCodArtigo, 15), 1) = CONVERT(varchar, 
                         dbo.T03_Desenhos.IntIdArtigoCliente)) AND (RIGHT(dbo.T99_0204_SubArtTam.StrCodSubArtigo, 4) = RIGHT(dbo.View_ListaArtigosEncomendaCliente.strCodArtigo, 4))
GO

EXEC sys.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[64] 4[24] 2[3] 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 = "View_ListaArtigosEncomendaCliente"
            Begin Extent = 
               Top = 6
               Left = 38
               Bottom = 179
               Right = 208
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "T99_0204_SubArtTam"
            Begin Extent = 
               Top = 6
               Left = 246
               Bottom = 347
               Right = 437
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "T01_Artigos"
            Begin Extent = 
               Top = 6
               Left = 718
               Bottom = 305
               Right = 896
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "T03_Desenhos"
            Begin Extent = 
               Top = 104
               Left = 493
               Bottom = 332
               Right = 691
            End
            DisplayFlags = 280
            TopColumn = 7
         End
         Begin Table = "T02_SubArtigos"
            Begin Extent = 
               Top = 7
               Left = 980
               Bottom = 373
               Right = 1160
            End
            DisplayFlags = 280
            TopColumn = 5
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
      Begin ColumnWidths = 18
         Width = 284
         Width = 825
         Width = 855
         Width = 915
         Width = 465
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1260
         Width = 720
         Width = 945
         Width = 2985
         Width =' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_ListaTamanhos_ArtigoEncomenda'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane2', @value=N' 1845
         Width = 1035
         Width = 675
         Width = 1830
         Width = 2250
         Width = 1500
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 12
         Column = 4575
         Alias = 4395
         Table = 3630
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 4935
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_ListaTamanhos_ArtigoEncomenda'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=2 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_ListaTamanhos_ArtigoEncomenda'
GO


