Anda di halaman 1dari 4

IF OBJECT_ID ('dbo.

FocusedQ_QuoteDesign') IS NOT NULL


DROP TABLE dbo.FocusedQ_QuoteDesign
GO

CREATE TABLE dbo.FocusedQ_QuoteDesign


(
QuoteDesignId BIGINT IDENTITY NOT NULL,
QuoteId BIGINT NOT NULL,
VendorId BIGINT NULL,
DesignUniqueId VARCHAR (50) NULL,
FormulaName NVARCHAR (100) NULL,
FormulaExpression NVARCHAR (100) NULL,
FormulaResult NVARCHAR (100) NULL,
DesignDescription NVARCHAR (100) NULL,
DesignValue NVARCHAR (100) NULL,
DesignUnit NVARCHAR (100) NULL,
DesignImage1 NVARCHAR (100) NULL,
DesignImage2 NVARCHAR (100) NULL,
DesignImage3 NVARCHAR (100) NULL,
CONSTRAINT PK_Focusq_QuoteDesignId PRIMARY KEY (QuoteDesignId)
)
GO

IF OBJECT_ID ('dbo.FocusedQ_QuoteDesignItem') IS NOT NULL


DROP TABLE dbo.FocusedQ_QuoteDesignItem
GO

CREATE TABLE dbo.FocusedQ_QuoteDesignItem


(
ProductId BIGINT IDENTITY NOT NULL,
QuoteId BIGINT NOT NULL,
QuoteDesignId BIGINT NOT NULL,
VendorId BIGINT NULL,
ItemSrNo INT NULL,
ItemSkuNumber NVARCHAR (200) NULL,
ItemName NVARCHAR (200) NULL,
ItemDescription NVARCHAR (500) NULL,
ItemQuantity NUMERIC (18,2) NULL,
ItemFormula NVARCHAR (500) NULL,
ItemPrice NUMERIC (18,2) DEFAULT ((0)) NULL,
ItemTotal NUMERIC (18,2) DEFAULT ((0)) NULL,
ItemColor NVARCHAR (500) NULL,
ItemRetailPrice NUMERIC (18,2) DEFAULT ((0)) NULL,
ItemTradePrice NUMERIC (18,2) DEFAULT ((0)) NULL,
ItemLoyalityPrice NUMERIC (18,2) DEFAULT ((0)) NULL,
CONSTRAINT PK_FocusedQ_QuoteDesignItem_Id PRIMARY KEY (ProductId)
)
GO

IF OBJECT_ID ('dbo.FocusedQ_QuoteProduct') IS NOT NULL


DROP TABLE dbo.FocusedQ_QuoteProduct
GO

CREATE TABLE dbo.FocusedQ_QuoteProduct


(
QuoteProductId BIGINT IDENTITY NOT NULL,
QuoteId BIGINT NOT NULL,
VendorId BIGINT NULL,
ProductUniqueId VARCHAR (50) NULL,
FormulaName NVARCHAR (100) NULL,
FormulaExpression NVARCHAR (100) NULL,
FormulaResult NVARCHAR (100) NULL,
DesignDescription NVARCHAR (100) NULL,
DesignValue NVARCHAR (100) NULL,
DesignUnit NVARCHAR (100) NULL,
DesignImage1 NVARCHAR (100) NULL,
DesignImage2 NVARCHAR (100) NULL,
DesignImage3 NVARCHAR (100) NULL,
CONSTRAINT PK_FocusedQ_QuoteProductId PRIMARY KEY (QuoteProductId)
)
GO

IF OBJECT_ID ('dbo.FocusedQ_QuoteProductItem') IS NOT NULL


DROP TABLE dbo.FocusedQ_QuoteProductItem
GO

CREATE TABLE dbo.FocusedQ_QuoteProductItem


(
ProductId BIGINT IDENTITY NOT NULL,
QuoteId BIGINT NOT NULL,
QuoteProductId BIGINT NOT NULL,
VendorId BIGINT NULL,
ItemSrNo INT NULL,
ItemSkuNumber NVARCHAR (200) NULL,
ItemName NVARCHAR (200) NULL,
ItemDescription NVARCHAR (500) NULL,
ItemQuantity NUMERIC (18,2) NULL,
ItemFormula NVARCHAR (500) NULL,
ItemPrice NUMERIC (18,2) DEFAULT ((0)) NULL,
ItemTotal NUMERIC (18,2) DEFAULT ((0)) NULL,
ItemColor NVARCHAR (500) NULL,
ItemRetailPrice NUMERIC (18,2) DEFAULT ((0)) NULL,
ItemTradePrice NUMERIC (18,2) DEFAULT ((0)) NULL,
ItemLoyalityPrice NUMERIC (18,2) DEFAULT ((0)) NULL,
CONSTRAINT PK_FocusedQ_QuoteProductItem_Id PRIMARY KEY (ProductId)
)
GO

IF OBJECT_ID ('dbo.FocusedQ_QuoteQuestion') IS NOT NULL


DROP TABLE dbo.FocusedQ_QuoteQuestion
GO

CREATE TABLE dbo.FocusedQ_QuoteQuestion


(
QuestionId BIGINT IDENTITY NOT NULL,
QuoteId BIGINT NOT NULL,
QuestionText NVARCHAR (100) NOT NULL,
DefaultUnit VARCHAR (50) NOT NULL,
UnitType NVARCHAR (100) NOT NULL,
IsActive BIT DEFAULT ((0)) NULL,
CONSTRAINT PK_Focusq_QuestionId PRIMARY KEY (QuestionId)
)
GO

IF OBJECT_ID ('dbo.FocusedQ_QuoteSupplier') IS NOT NULL


DROP TABLE dbo.FocusedQ_QuoteSupplier
GO
CREATE TABLE dbo.FocusedQ_QuoteSupplier
(
SupplierId BIGINT IDENTITY NOT NULL,
SupplierUniqueId VARCHAR (50) NOT NULL,
QuoteId BIGINT NOT NULL,
SupplierName NVARCHAR (1000) NULL,
Website NVARCHAR (500) NULL,
StreetAddress NVARCHAR (1000) NULL,
PhoneNumber NVARCHAR (100) NULL,
City NVARCHAR (100) NULL,
Province NVARCHAR (100) NULL,
PostalCode NVARCHAR (100) NULL,
Country NVARCHAR (100) NULL,
EmailAddress NVARCHAR (500) NULL,
EntryTimeStamp DATETIME NULL,
CONSTRAINT PK_FocusedQ_QuoteSupplierId PRIMARY KEY (SupplierId)
)
GO

IF OBJECT_ID ('dbo.FocusedQ_QuoteTemplate') IS NOT NULL


DROP TABLE dbo.FocusedQ_QuoteTemplate
GO

CREATE TABLE dbo.FocusedQ_QuoteTemplate


(
QuoteTemplateId BIGINT IDENTITY NOT NULL,
QuoteUniqueId NVARCHAR (40) NOT NULL,
UserId BIGINT NOT NULL,
ServiceId BIGINT NOT NULL,
QuoteImage NVARCHAR (200) NOT NULL,
QuoteName NVARCHAR (200) NOT NULL,
BusinessAccountType NVARCHAR (200) NOT NULL,
IndustryType NVARCHAR (200) NOT NULL,
UserIdType NVARCHAR (200) NOT NULL,
QuoteNo NVARCHAR (50) NOT NULL,
QuoteType NVARCHAR (200) NOT NULL,
QuoteSrNo BIGINT NOT NULL,
QDate DATETIME NULL,
IsActive BIT DEFAULT ((0)) NULL,
CONSTRAINT PK_Focusq_QuoteTemplateId PRIMARY KEY (QuoteTemplateId)
)
GO

IF OBJECT_ID ('dbo.FocusedQ_Services') IS NOT NULL


DROP TABLE dbo.FocusedQ_Services
GO

CREATE TABLE dbo.FocusedQ_Services


(
ServiceId BIGINT IDENTITY NOT NULL,
ServiceName NVARCHAR (100) NOT NULL,
ServiceCode NVARCHAR (100) NOT NULL,
IsActive BIT DEFAULT ((0)) NULL,
CONSTRAINT PK_Focusq_ServiceId PRIMARY KEY (ServiceId),
CONSTRAINT UK_Focusq_ServiceCode UNIQUE (ServiceCode),
CONSTRAINT UK_Focusq_ServiceName UNIQUE (ServiceName)
)
GO
IF OBJECT_ID ('dbo.FocusedQ_Users') IS NOT NULL
DROP TABLE dbo.FocusedQ_Users
GO

CREATE TABLE dbo.FocusedQ_Users


(
UserId BIGINT IDENTITY NOT NULL,
UniqueUserId NVARCHAR (40) NOT NULL,
BusinessType CHAR (2) NULL,
FirstName NVARCHAR (50) NULL,
LastName NVARCHAR (50) NULL,
FulName NVARCHAR (100) NULL,
EmailId NVARCHAR (100) NOT NULL,
Password NVARCHAR (250) NULL,
RoleId INT NOT NULL CHECK ([RoleId]=(3) OR [RoleId]=(2) OR
[RoleId]=(1)),
IsActive BIT NULL,
IsFirstTime BIT DEFAULT ((0)) NULL,
SaveQuote INT DEFAULT ((0)) NULL,
UserImage VARCHAR (200) NULL,
BusinessName NVARCHAR (250) NULL,
BusinessStreetAddress NVARCHAR (max) NULL,
Country NVARCHAR (100) NULL,
State NVARCHAR (100) NULL,
City NVARCHAR (100) NULL,
ZipCode NVARCHAR (100) NULL,
BusinessHomePhoneNo NVARCHAR (100) NULL,
CellPhone NVARCHAR (100) NULL,
InteriorRenovation BIT NULL,
OutdoorConstruction BIT NULL,
ArchitecturePEng BIT NULL,
LawyerAndAccounting BIT NULL,
CleaningServices BIT NULL,
OtherServices BIT NULL,
EmployeeLessThan40 BIT NULL,
EmployeeBetween BIT NULL,
EmployeeMoreThan100 BIT NULL,
QuotesGiveIn1Month NVARCHAR (max) NULL,
AverageQuoteTime NVARCHAR (100) NULL,
QuotesCloseInEachMonth NVARCHAR (100) NULL,
OfferBenifitToEmployee BIT NULL,
OtherBusinessName NVARCHAR (100) NULL,
CONSTRAINT PK_Focusq_UsersId PRIMARY KEY (UserId),
CONSTRAINT UK_Focusq_Email UNIQUE (EmailId)
)
GO