247 lines
8.6 KiB
Transact-SQL
247 lines
8.6 KiB
Transact-SQL
CREATE VIEW ext.v_MarginReportRcd
|
|
AS
|
|
SELECT dbo.v_MarginReport.Vers, ext.RcdClient.CodClientRcd AS CodClient, ext.RcdItem.CodItemRcd AS CodItem, dbo.v_MarginReport.RawMat, dbo.v_MarginReport.BatchQty, dbo.v_MarginReport.CodInco,
|
|
ext.RcdItem.CodItemRcd + '-' + dbo.v_MarginReport.RawMat AS KeyAM, dbo.v_MarginReport.CodDiesGroup, dbo.v_MarginReport.DiesPrice, dbo.v_MarginReport.DiesExpLife, dbo.v_MarginReport.DiesEOLife,
|
|
dbo.v_MarginReport.DiesByClass, dbo.v_MarginReport.NumDiesInList, dbo.v_MarginReport.NumDiesExaust, ext.RcdPlants.CodPlantRcd AS CodPlant,
|
|
ext.RcdItem.CodItemRcd + '-' + dbo.v_MarginReport.RawMat + '-' + ext.RcdPlants.CodPlantRcd + '-' + RIGHT(dbo.v_MarginReport.KeyAMIL, 1) AS KeyAMIL, dbo.v_MarginReport.KgTeo,
|
|
dbo.v_MarginReport.NumSMED, dbo.v_MarginReport.QuotaMan, dbo.v_MarginReport.PWeight, dbo.v_MarginReport.PTare, dbo.v_MarginReport.LivPackage,
|
|
REPLACE(REPLACE(dbo.v_MarginReport.LivPackageDett, dbo.v_MarginReport.CodItem, ext.RcdItem.CodItemRcd), dbo.v_MarginReport.CodClient, ext.RcdClient.CodClientRcd) AS LivPackageDett,
|
|
dbo.v_MarginReport.RawMatCost, dbo.v_MarginReport.RawMatExtraCost, dbo.v_MarginReport.RawMatFullCost, dbo.v_MarginReport.CodPackag, dbo.v_MarginReport.FSR, dbo.v_MarginReport.ProvvCost,
|
|
dbo.v_MarginReport.EECost, dbo.v_MarginReport.GasCost, dbo.v_MarginReport.DiesCost, dbo.v_MarginReport.PackCost, dbo.v_MarginReport.TranspCost, dbo.v_MarginReport.SellCost01,
|
|
dbo.v_MarginReport.RefCost01, dbo.v_MarginReport.SellCost04, dbo.v_MarginReport.RefCost04, dbo.v_MarginReport.WSR01, dbo.v_MarginReport.MSR01, dbo.v_MarginReport.NetProd01,
|
|
dbo.v_MarginReport.FC4UG01, dbo.v_MarginReport.VC4UG01, dbo.v_MarginReport.OH4UG01, dbo.v_MarginReport.SC4UG01, dbo.v_MarginReport.DSR, dbo.v_MarginReport.NetProd04,
|
|
dbo.v_MarginReport.FC4UG04, dbo.v_MarginReport.VC4UG04, dbo.v_MarginReport.FVC, dbo.v_MarginReport.Charge, dbo.v_MarginReport.P_FVC, dbo.v_MarginReport.CPS, dbo.v_MarginReport.P_CPS,
|
|
dbo.v_MarginReport.P_FC4UG04, dbo.v_MarginReport.FullCost, dbo.v_MarginReport.P_FullCost, dbo.v_MarginReport.MinPrice, dbo.v_MarginReport.P_MinPrice, dbo.v_MarginReport.NetMar,
|
|
dbo.v_MarginReport.FCShield, dbo.v_MarginReport.PckSur, dbo.v_MarginReport.valid, dbo.v_MarginReport.errorScore, dbo.v_MarginReport.OrdDate, 'ORD' + REPLACE(REPLACE(dbo.v_MarginReport.OrdNum,
|
|
'11', '21'), '12', '22') AS OrdNum, dbo.v_MarginReport.OrdRow, dbo.v_MarginReport.OrdPrice, dbo.v_MarginReport.OrdTrasf, dbo.v_MarginReport.OrdQty
|
|
FROM dbo.v_MarginReport INNER JOIN
|
|
ext.RcdClient ON dbo.v_MarginReport.CodClient = ext.RcdClient.CodClient INNER JOIN
|
|
ext.RcdItem ON dbo.v_MarginReport.CodItem = ext.RcdItem.CodItem INNER JOIN
|
|
ext.RcdPlants ON dbo.v_MarginReport.CodPlant = ext.RcdPlants.CodPlant
|
|
GO
|
|
EXECUTE sp_addextendedproperty @name = N'MS_DiagramPaneCount', @value = 2, @level0type = N'SCHEMA', @level0name = N'ext', @level1type = N'VIEW', @level1name = N'v_MarginReportRcd';
|
|
|
|
|
|
GO
|
|
EXECUTE sp_addextendedproperty @name = N'MS_DiagramPane2', @value = N'= 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
|
|
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'ext', @level1type = N'VIEW', @level1name = N'v_MarginReportRcd';
|
|
|
|
|
|
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_MarginReport"
|
|
Begin Extent =
|
|
Top = 36
|
|
Left = 385
|
|
Bottom = 332
|
|
Right = 566
|
|
End
|
|
DisplayFlags = 280
|
|
TopColumn = 0
|
|
End
|
|
Begin Table = "RcdItem (ext)"
|
|
Begin Extent =
|
|
Top = 58
|
|
Left = 639
|
|
Bottom = 188
|
|
Right = 809
|
|
End
|
|
DisplayFlags = 280
|
|
TopColumn = 0
|
|
End
|
|
Begin Table = "RcdClient (ext)"
|
|
Begin Extent =
|
|
Top = 52
|
|
Left = 120
|
|
Bottom = 164
|
|
Right = 290
|
|
End
|
|
DisplayFlags = 280
|
|
TopColumn = 0
|
|
End
|
|
Begin Table = "RcdPlants (ext)"
|
|
Begin Extent =
|
|
Top = 195
|
|
Left = 132
|
|
Bottom = 291
|
|
Right = 302
|
|
End
|
|
DisplayFlags = 280
|
|
TopColumn = 0
|
|
End
|
|
End
|
|
End
|
|
Begin SQLPane =
|
|
End
|
|
Begin DataPane =
|
|
Begin ParameterDefaults = ""
|
|
End
|
|
Begin ColumnWidths = 76
|
|
Width = 284
|
|
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 = 3450
|
|
Width = 1500
|
|
Width = 1500
|
|
Width = 1500
|
|
Width = 1500
|
|
Width = 1500
|
|
Width = 1500
|
|
Width = 3960
|
|
Width ', @level0type = N'SCHEMA', @level0name = N'ext', @level1type = N'VIEW', @level1name = N'v_MarginReportRcd';
|
|
|