﻿CREATE TABLE [dbo].[QuoteWorkExt] (
    [QuoteType] CHAR (1)       CONSTRAINT [DF_QuoteWorkExt_QuoteType] DEFAULT ('Q') NOT NULL,
    [CodQuote]  BIGINT         NOT NULL,
    [QuoteRev]  INT            CONSTRAINT [DF_QuoteWorkExt_QuoteRev] DEFAULT ((0)) NOT NULL,
    [NumWE]     INT            NOT NULL,
    [EWC4UG]    DECIMAL (9, 6) CONSTRAINT [DF_QuoteWorkExt_FC4UG] DEFAULT ((0)) NOT NULL,
    [UM]        NVARCHAR (50)  CONSTRAINT [DF_QuoteWorkExt_EWC4UG1] DEFAULT ((0)) NOT NULL,
    [valid]     BIT            CONSTRAINT [DF_QuoteWorkExt_valid] DEFAULT ((1)) NOT NULL,
    CONSTRAINT [PK_QuoteWorkExt] PRIMARY KEY CLUSTERED ([QuoteRev] ASC, [QuoteType] ASC, [CodQuote] ASC, [NumWE] ASC),
    CONSTRAINT [FK_QuoteWorkExt_QuoteList] FOREIGN KEY ([QuoteType], [CodQuote], [QuoteRev]) REFERENCES [dbo].[QuoteList] ([QuoteType], [CodQuote], [QuoteRev]) ON UPDATE CASCADE
);


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'tipo di preventivo: Q = quote, S = simulation', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'QuoteWorkExt', @level2type = N'COLUMN', @level2name = N'QuoteType';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'numero nel formato yyMMddnnnn dove nnn è incrementale giornaliero', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'QuoteWorkExt', @level2type = N'COLUMN', @level2name = N'CodQuote';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'progressivo interno', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'QuoteWorkExt', @level2type = N'COLUMN', @level2name = N'NumWE';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'External Work Cost FOR Unit of Good, quota dei costi fissi per unità di prodotto finito (Copertura Costo Struttura e Linea)', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'QuoteWorkExt', @level2type = N'COLUMN', @level2name = N'EWC4UG';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Unità di misura di riferimento per il costo', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'QuoteWorkExt', @level2type = N'COLUMN', @level2name = N'UM';

