﻿CREATE TABLE [dbo].[QuoteFull_Q] (
    [Vers]            VARCHAR (5)     NOT NULL,
    [QuoteType]       CHAR (1)        CONSTRAINT [DF_QuoteFull_Q_QuoteType] DEFAULT ('Q') NOT NULL,
    [CodQuote]        BIGINT          NOT NULL,
    [QuoteRev]        INT             NOT NULL,
    [IdxQState]       INT             CONSTRAINT [DF_QuoteFull_Q_IdxQState] DEFAULT ((0)) NOT NULL,
    [CodClient]       NVARCHAR (50)   NOT NULL,
    [ClientName]      NVARCHAR (250)  NOT NULL,
    [CodItem]         NVARCHAR (50)   NOT NULL,
    [CodItemGroup]    NVARCHAR (50)   NOT NULL,
    [RawMat]          NVARCHAR (50)   NOT NULL,
    [UnitWeight]      DECIMAL (9, 3)  NOT NULL,
    [BatchQty]        INT             NOT NULL,
    [CodInco]         NVARCHAR (5)    NOT NULL,
    [TranspZone]      NVARCHAR (50)   CONSTRAINT [DF_QuoteFull_Q_TranspZone] DEFAULT ('') NOT NULL,
    [KeyAM]           NVARCHAR (101)  NOT NULL,
    [Note]            NVARCHAR (2500) NOT NULL,
    [PriceOff]        DECIMAL (9, 6)  CONSTRAINT [DF_QuoteFull_Q_PriceOff] DEFAULT ((0)) NOT NULL,
    [CodClientAssoc]  NVARCHAR (100)  NULL,
    [ClientNameAssoc] NVARCHAR (100)  NULL,
    [ItemDescr]       NVARCHAR (100)  NULL,
    [CodifProfilo]    NVARCHAR (100)  NULL,
    [ClasseMerc]      NVARCHAR (100)  NULL,
    [TipoDies]        NVARCHAR (100)  NULL,
    [CodDiesGroup]    NVARCHAR (100)  NULL,
    [DiamDies]        DECIMAL (18, 6) CONSTRAINT [DF_QuoteFull_Q_DiamDies] DEFAULT ((0)) NOT NULL,
    [HoleNumDies]     INT             NULL,
    [DiesPrice]       DECIMAL (18, 6) CONSTRAINT [DF_QuoteFull_Q_DiesPrice] DEFAULT ((0)) NOT NULL,
    [DiesExpLife]     DECIMAL (18, 6) CONSTRAINT [DF_QuoteFull_Q_DiesExpLife] DEFAULT ((0)) NOT NULL,
    [DiesEOLife]      DECIMAL (18, 6) NOT NULL,
    [DiesByClass]     BIT             CONSTRAINT [DF_QuoteFull_Q_DiesByClass] DEFAULT ((0)) NOT NULL,
    [NumDiesInList]   DECIMAL (18, 6) NULL,
    [NumDiesExaust]   DECIMAL (18, 6) NULL,
    [CodPlant]        NVARCHAR (100)  NULL,
    [KeyAMIL]         NVARCHAR (100)  NULL,
    [KgTeo]           DECIMAL (18, 6) NULL,
    [NumSMED]         DECIMAL (18, 6) NULL,
    [QuotaMan]        DECIMAL (18, 6) NULL,
    [PRMWeight]       DECIMAL (18, 6) NULL,
    [PWeight]         DECIMAL (18, 6) NULL,
    [PTare]           DECIMAL (18, 6) NULL,
    [LivPackage]      NVARCHAR (100)  NULL,
    [LivPackageDett]  NVARCHAR (100)  NULL,
    [RawMatCost]      DECIMAL (18, 6) NOT NULL,
    [RawMatExtraCost] DECIMAL (18, 6) NOT NULL,
    [RawMatFullCost]  DECIMAL (18, 6) NULL,
    [CodPackag]       NVARCHAR (50)   NOT NULL,
    [PkgDesc]         NVARCHAR (100)  NULL,
    [FSR]             DECIMAL (18, 6) NULL,
    [ProvvCost]       DECIMAL (18, 6) NOT NULL,
    [EECost]          DECIMAL (18, 6) NOT NULL,
    [GasCost]         DECIMAL (18, 6) NOT NULL,
    [DiesCost]        DECIMAL (18, 6) NOT NULL,
    [PackCost]        DECIMAL (18, 6) NOT NULL,
    [TranspCost]      DECIMAL (18, 6) NOT NULL,
    [SellCost01]      DECIMAL (18, 6) NOT NULL,
    [RefCost01]       DECIMAL (18, 6) NOT NULL,
    [SellCost04]      DECIMAL (18, 6) NOT NULL,
    [RefCost04]       DECIMAL (18, 6) NOT NULL,
    [WSR01]           DECIMAL (9, 8)  NOT NULL,
    [MSR01]           DECIMAL (9, 8)  NOT NULL,
    [NetProd01]       DECIMAL (9, 3)  NOT NULL,
    [FC4UG01]         DECIMAL (9, 6)  NOT NULL,
    [VC4UG01]         DECIMAL (9, 6)  NOT NULL,
    [OH4UG01]         DECIMAL (9, 6)  NOT NULL,
    [SC4UG01]         DECIMAL (9, 6)  NOT NULL,
    [DSR]             DECIMAL (9, 8)  NULL,
    [NetProd04]       DECIMAL (9, 3)  NOT NULL,
    [FC4UG04]         DECIMAL (9, 6)  NOT NULL,
    [VC4UG04]         DECIMAL (9, 6)  NOT NULL,
    [FVC]             DECIMAL (18, 6) NULL,
    [Charge]          DECIMAL (9, 6)  NOT NULL,
    [valid]           BIT             CONSTRAINT [DF_QuoteFull_Q_valid] DEFAULT ((1)) NOT NULL,
    [errorScore]      INT             CONSTRAINT [DF_QuoteFull_Q_errorScore] DEFAULT ((0)) NOT NULL,
    CONSTRAINT [PK_QuoteFull_Q_1] PRIMARY KEY CLUSTERED ([QuoteType] ASC, [CodQuote] ASC, [QuoteRev] ASC)
);






GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Prezzo Offerto', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'QuoteFull_Q', @level2type = N'COLUMN', @level2name = N'PriceOff';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Stato offerta: 0 = D raft, 1 = C ompleted / in approvazione, 2 = A pprouved, 3 = R eleased', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'QuoteFull_Q', @level2type = N'COLUMN', @level2name = N'IdxQState';




GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Quotation', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'QuoteFull_Q';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Classificazione cliente (es zona, provincia...) x incrocio con tab costi trasporto', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'QuoteFull_Q', @level2type = N'COLUMN', @level2name = N'TranspZone';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'punteggio complessivo errori in procedure di calcolo', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'QuoteFull_Q', @level2type = N'COLUMN', @level2name = N'errorScore';

