
IF NOT EXISTS (SELECT 1 FROM pal_Surface
WHERE name = 'WholesalerData')
BEGIN

SET IDENTITY_INSERT [dbo].[pal_Surface] ON 

INSERT INTO [dbo].[pal_Surface]
([recId]
,[name]
,[surface]
,[dateCreated]
,[isActive]
,[isModal]
,[isPublished]
,[isDefaultToForm]
,[isWizzard]
,[isComparable]
,[linkUser]
,[surfaceActionId]
,[columnCount]
,[isCapitalizeInput]
,[isLinkedSurface]
,[isDisableRequired])
VALUES
(4112
,'WholesalerData'
,'Wholesaler Data'	
,GETDATE()
,1
,0
,1
,0
,0
,0
,0
,0
,0
,0
,0
,0);
SET IDENTITY_INSERT [dbo].[pal_Surface] OFF 

INSERT INTO [dbo].[pal_SurfaceGridOptions]
([surfaceId]
,[allowAdd]
,[allowEdit]
,[allowRemove]
,[allowView]
,[allowSort]
,[allowFilter]
,[pagingCount]
,[surfaceGridEditTypeId]
,[isTabbed]
,[viewIcon]
,[allowExport]
,[allowColVis]
,[defaultSort]
,[allowClone]
,[editIcon]
,[showWizardStatus]
,[addAccessType]
,[editAccessType]
,[viewAccessType]
,[removeAccessType]
,[cloneAccessType]
,[showAggregate]
,[aggregateTitle]
,[allowBulkUpdate]
,[allowScroll]
,[fixedColumns]
,[useFooTable]
,[noBorders]
,[freezeHeader]
,[iconsAsText]
,[allowImport])
VALUES
(4112
,0
,0
,0
,0
,0
,0
,25
,1
,0
,'eye'
,0
,0	
,''
,0
,'edit'	
,0
,4
,4
,0
,4
,0
,0
,''
,0
,0
,0
,0
,0
,0
,0,
0);

SET IDENTITY_INSERT [dbo].[pal_SurfaceField] ON 

INSERT [dbo].[pal_SurfaceField] ([recId], [surfaceId], [surfaceFieldName], [surfaceFieldDisplay], [surfaceFieldTypeId], [length], [required], [lookupCategory], [relationalFields], [relationalValues], [relationalOrderBy], [relationalSurface], [relationalObject], [parentId], [sequence], [isActive], [isGrid], [isFilter], [colSequence], [contentId], [defaultToCurrent], [isControlled], [controlledValue], [controlText], [isAutoPostback], [isHidden], [isReadOnly], [placeholder], [isUnique], [actionType], [action], [actionSource], [isComparable], [alternateView], [isHiddenFromWizzard], [surfaceDateTypeId], [isHiddenFromView], [actionValue], [surfaceFieldSize], [isLabelHidden], [isOnNewLine], [labelSize], [isHiddenFromForm], [accessLevel], [hasBottomBorder], [hasFullBorder], [defaultValue], [validationType], [enableBulkUpdate], [isCurrency], [isVerticalHeader], [gridSequence], [isGrouped], [isCloneable], [isCustomSource], [relationalWhere], [groupedDisplayCount]) 
VALUES (3236, 4112, N'WholesalerData', N'Wholesaler Data', 1, 0, 0, 0, N'', N'', N'', N'', N'', 0, 1, 1, 0, 0, 0, 0, 0, 0, N'', N'', 0, 0, 0, N'', 0, 0, 0, 0, 0, 0, 0, 0, 0, N'', 6, 0, 0, 4, 0, 1, 0, 0, N'', 0, 0, 0, 0, 0, 0, 0, 0, N'', 0)
INSERT [dbo].[pal_SurfaceField] ([recId], [surfaceId], [surfaceFieldName], [surfaceFieldDisplay], [surfaceFieldTypeId], [length], [required], [lookupCategory], [relationalFields], [relationalValues], [relationalOrderBy], [relationalSurface], [relationalObject], [parentId], [sequence], [isActive], [isGrid], [isFilter], [colSequence], [contentId], [defaultToCurrent], [isControlled], [controlledValue], [controlText], [isAutoPostback], [isHidden], [isReadOnly], [placeholder], [isUnique], [actionType], [action], [actionSource], [isComparable], [alternateView], [isHiddenFromWizzard], [surfaceDateTypeId], [isHiddenFromView], [actionValue], [surfaceFieldSize], [isLabelHidden], [isOnNewLine], [labelSize], [isHiddenFromForm], [accessLevel], [hasBottomBorder], [hasFullBorder], [defaultValue], [validationType], [enableBulkUpdate], [isCurrency], [isVerticalHeader], [gridSequence], [isGrouped], [isCloneable], [isCustomSource], [relationalWhere], [groupedDisplayCount])
VALUES (3237, 4112, N'WholesalerData_WholesalerData', N'Wholesaler Data', 2, 0, 0, 0, N'', N'', N'', N'', N'', 3236, 1, 1, 0, 0, 0, 0, 0, 0, N'', N'', 0, 0, 0, N'', 0, 0, 0, 0, 0, 0, 0, 0, 0, N'', 6, 0, 0, 4, 0, 1, 0, 0, N'', 0, 0, 0, 0, 1, 0, 0, 0, N'', 0)
INSERT [dbo].[pal_SurfaceField] ([recId], [surfaceId], [surfaceFieldName], [surfaceFieldDisplay], [surfaceFieldTypeId], [length], [required], [lookupCategory], [relationalFields], [relationalValues], [relationalOrderBy], [relationalSurface], [relationalObject], [parentId], [sequence], [isActive], [isGrid], [isFilter], [colSequence], [contentId], [defaultToCurrent], [isControlled], [controlledValue], [controlText], [isAutoPostback], [isHidden], [isReadOnly], [placeholder], [isUnique], [actionType], [action], [actionSource], [isComparable], [alternateView], [isHiddenFromWizzard], [surfaceDateTypeId], [isHiddenFromView], [actionValue], [surfaceFieldSize], [isLabelHidden], [isOnNewLine], [labelSize], [isHiddenFromForm], [accessLevel], [hasBottomBorder], [hasFullBorder], [defaultValue], [validationType], [enableBulkUpdate], [isCurrency], [isVerticalHeader], [gridSequence], [isGrouped], [isCloneable], [isCustomSource], [relationalWhere], [groupedDisplayCount]) 
VALUES (3238, 4112, N'WholesalerData_WholesalerData_FileName', N'File Name', 3, 0, 0, 0, N'', N'', N'', N'', N'', 3237, 1, 1, 1, 0, 0, 0, 0, 0, N'', N'', 0, 0, 0, N'', 0, 0, 0, 0, 0, 0, 0, 0, 0, N'', 3, 0, 0, 12, 0, 1, 0, 0, N'', 0, 0, 0, 0, 1, 0, 1, 0, N'', 0)
INSERT [dbo].[pal_SurfaceField] ([recId], [surfaceId], [surfaceFieldName], [surfaceFieldDisplay], [surfaceFieldTypeId], [length], [required], [lookupCategory], [relationalFields], [relationalValues], [relationalOrderBy], [relationalSurface], [relationalObject], [parentId], [sequence], [isActive], [isGrid], [isFilter], [colSequence], [contentId], [defaultToCurrent], [isControlled], [controlledValue], [controlText], [isAutoPostback], [isHidden], [isReadOnly], [placeholder], [isUnique], [actionType], [action], [actionSource], [isComparable], [alternateView], [isHiddenFromWizzard], [surfaceDateTypeId], [isHiddenFromView], [actionValue], [surfaceFieldSize], [isLabelHidden], [isOnNewLine], [labelSize], [isHiddenFromForm], [accessLevel], [hasBottomBorder], [hasFullBorder], [defaultValue], [validationType], [enableBulkUpdate], [isCurrency], [isVerticalHeader], [gridSequence], [isGrouped], [isCloneable], [isCustomSource], [relationalWhere], [groupedDisplayCount]) 
VALUES (3239, 4112, N'WholesalerData_WholesalerData_DateImported', N'Date Imported', 7, 0, 0, 0, N'', N'', N'', N'', N'', 3237, 4, 1, 1, 0, 0, 0, 1, 0, N'', N'Date', 0, 0, 1, N'', 0, 0, 0, 0, 0, 0, 0, 1, 0, N'', 3, 0, 0, 12, 0, 1, 0, 0, N'', 0, 0, 0, 0, 4, 0, 1, 0, N'', 0)
INSERT [dbo].[pal_SurfaceField] ([recId], [surfaceId], [surfaceFieldName], [surfaceFieldDisplay], [surfaceFieldTypeId], [length], [required], [lookupCategory], [relationalFields], [relationalValues], [relationalOrderBy], [relationalSurface], [relationalObject], [parentId], [sequence], [isActive], [isGrid], [isFilter], [colSequence], [contentId], [defaultToCurrent], [isControlled], [controlledValue], [controlText], [isAutoPostback], [isHidden], [isReadOnly], [placeholder], [isUnique], [actionType], [action], [actionSource], [isComparable], [alternateView], [isHiddenFromWizzard], [surfaceDateTypeId], [isHiddenFromView], [actionValue], [surfaceFieldSize], [isLabelHidden], [isOnNewLine], [labelSize], [isHiddenFromForm], [accessLevel], [hasBottomBorder], [hasFullBorder], [defaultValue], [validationType], [enableBulkUpdate], [isCurrency], [isVerticalHeader], [gridSequence], [isGrouped], [isCloneable], [isCustomSource], [relationalWhere], [groupedDisplayCount]) 
VALUES (3240, 4112, N'WholesalerData_WholesalerData_WholesalerCode', N'Wholesaler Code', 29, 0, 0, 0, N'3074', N'', N'', N'3036', N'', 3237, 1, 1, 0, 0, 0, 0, 0, 0, N'', N'', 0, 1, 0, N'', 0, 0, 0, 0, 0, 0, 0, 0, 0, N'', 3, 0, 0, 12, 0, 1, 0, 0, N'', 0, 0, 0, 0, 1, 0, 0, 0, N'', 0)
INSERT [dbo].[pal_SurfaceField] ([recId], [surfaceId], [surfaceFieldName], [surfaceFieldDisplay], [surfaceFieldTypeId], [length], [required], [lookupCategory], [relationalFields], [relationalValues], [relationalOrderBy], [relationalSurface], [relationalObject], [parentId], [sequence], [isActive], [isGrid], [isFilter], [colSequence], [contentId], [defaultToCurrent], [isControlled], [controlledValue], [controlText], [isAutoPostback], [isHidden], [isReadOnly], [placeholder], [isUnique], [actionType], [action], [actionSource], [isComparable], [alternateView], [isHiddenFromWizzard], [surfaceDateTypeId], [isHiddenFromView], [actionValue], [surfaceFieldSize], [isLabelHidden], [isOnNewLine], [labelSize], [isHiddenFromForm], [accessLevel], [hasBottomBorder], [hasFullBorder], [defaultValue], [validationType], [enableBulkUpdate], [isCurrency], [isVerticalHeader], [gridSequence], [isGrouped], [isCloneable], [isCustomSource], [relationalWhere], [groupedDisplayCount]) 
VALUES (3241, 4112, N'WholesalerData_WholesalerData_WholesalerUniqueName', N'Wholesaler Unique Name', 29, 0, 0, 0, N'1855', N'', N'', N'3036', N'', 3237, 1, 1, 0, 0, 0, 0, 0, 0, N'', N'', 0, 1, 0, N'', 0, 0, 0, 0, 0, 0, 0, 0, 0, N'', 3, 0, 0, 12, 0, 1, 0, 0, N'', 0, 0, 0, 0, 1, 0, 0, 0, N'', 0)
INSERT [dbo].[pal_SurfaceField] ([recId], [surfaceId], [surfaceFieldName], [surfaceFieldDisplay], [surfaceFieldTypeId], [length], [required], [lookupCategory], [relationalFields], [relationalValues], [relationalOrderBy], [relationalSurface], [relationalObject], [parentId], [sequence], [isActive], [isGrid], [isFilter], [colSequence], [contentId], [defaultToCurrent], [isControlled], [controlledValue], [controlText], [isAutoPostback], [isHidden], [isReadOnly], [placeholder], [isUnique], [actionType], [action], [actionSource], [isComparable], [alternateView], [isHiddenFromWizzard], [surfaceDateTypeId], [isHiddenFromView], [actionValue], [surfaceFieldSize], [isLabelHidden], [isOnNewLine], [labelSize], [isHiddenFromForm], [accessLevel], [hasBottomBorder], [hasFullBorder], [defaultValue], [validationType], [enableBulkUpdate], [isCurrency], [isVerticalHeader], [gridSequence], [isGrouped], [isCloneable], [isCustomSource], [relationalWhere], [groupedDisplayCount]) 
VALUES (3242, 4112, N'ParentSurfaceItemId', N'ParentSurfaceItemId', 4, 0, 0, 0, N'', N'', N'', N'Wholesalers', N'', 3237, 0, 1, 0, 0, 0, 0, 0, 0, N'', N'', 0, 1, 1, N'', 0, 0, 0, 0, 0, 0, 0, 0, 0, N'', 0, 0, 0, 0, 0, 0, 0, 0, N'', 0, 0, 0, 0, 0, 0, 0, 0, N'', 0)
INSERT [dbo].[pal_SurfaceField] ([recId], [surfaceId], [surfaceFieldName], [surfaceFieldDisplay], [surfaceFieldTypeId], [length], [required], [lookupCategory], [relationalFields], [relationalValues], [relationalOrderBy], [relationalSurface], [relationalObject], [parentId], [sequence], [isActive], [isGrid], [isFilter], [colSequence], [contentId], [defaultToCurrent], [isControlled], [controlledValue], [controlText], [isAutoPostback], [isHidden], [isReadOnly], [placeholder], [isUnique], [actionType], [action], [actionSource], [isComparable], [alternateView], [isHiddenFromWizzard], [surfaceDateTypeId], [isHiddenFromView], [actionValue], [surfaceFieldSize], [isLabelHidden], [isOnNewLine], [labelSize], [isHiddenFromForm], [accessLevel], [hasBottomBorder], [hasFullBorder], [defaultValue], [validationType], [enableBulkUpdate], [isCurrency], [isVerticalHeader], [gridSequence], [isGrouped], [isCloneable], [isCustomSource], [relationalWhere], [groupedDisplayCount]) 
VALUES (3243, 4112, N'WholesalerData_WholesalerData_ImportedBy', N'Imported By', 29, 0, 0, 0, N'32', N'', N'', N'user', N'', 3237, 3, 1, 1, 0, 0, 0, 0, 0, N'', N'', 0, 0, 0, N'', 0, 0, 0, 0, 0, 0, 0, 0, 0, N'', 3, 0, 0, 12, 0, 1, 0, 0, N'', 0, 0, 0, 0, 3, 0, 0, 0, N'', 0)
INSERT [dbo].[pal_SurfaceField] ([recId], [surfaceId], [surfaceFieldName], [surfaceFieldDisplay], [surfaceFieldTypeId], [length], [required], [lookupCategory], [relationalFields], [relationalValues], [relationalOrderBy], [relationalSurface], [relationalObject], [parentId], [sequence], [isActive], [isGrid], [isFilter], [colSequence], [contentId], [defaultToCurrent], [isControlled], [controlledValue], [controlText], [isAutoPostback], [isHidden], [isReadOnly], [placeholder], [isUnique], [actionType], [action], [actionSource], [isComparable], [alternateView], [isHiddenFromWizzard], [surfaceDateTypeId], [isHiddenFromView], [actionValue], [surfaceFieldSize], [isLabelHidden], [isOnNewLine], [labelSize], [isHiddenFromForm], [accessLevel], [hasBottomBorder], [hasFullBorder], [defaultValue], [validationType], [enableBulkUpdate], [isCurrency], [isVerticalHeader], [gridSequence], [isGrouped], [isCloneable], [isCustomSource], [relationalWhere], [groupedDisplayCount]) 
VALUES (3244, 4112, N'WholesalerData_WholesalerDataItems', N'Wholesaler Data Items', 2, 0, 0, 0, N'', N'', N'', N'', N'', 3236, 2, 1, 0, 0, 0, 0, 0, 0, N'', N'', 0, 0, 0, N'', 0, 0, 0, 0, 0, 0, 0, 0, 0, N'', 6, 0, 0, 4, 0, 1, 0, 0, N'', 0, 0, 0, 0, 2, 0, 0, 0, N'', 0)
INSERT [dbo].[pal_SurfaceField] ([recId], [surfaceId], [surfaceFieldName], [surfaceFieldDisplay], [surfaceFieldTypeId], [length], [required], [lookupCategory], [relationalFields], [relationalValues], [relationalOrderBy], [relationalSurface], [relationalObject], [parentId], [sequence], [isActive], [isGrid], [isFilter], [colSequence], [contentId], [defaultToCurrent], [isControlled], [controlledValue], [controlText], [isAutoPostback], [isHidden], [isReadOnly], [placeholder], [isUnique], [actionType], [action], [actionSource], [isComparable], [alternateView], [isHiddenFromWizzard], [surfaceDateTypeId], [isHiddenFromView], [actionValue], [surfaceFieldSize], [isLabelHidden], [isOnNewLine], [labelSize], [isHiddenFromForm], [accessLevel], [hasBottomBorder], [hasFullBorder], [defaultValue], [validationType], [enableBulkUpdate], [isCurrency], [isVerticalHeader], [gridSequence], [isGrouped], [isCloneable], [isCustomSource], [relationalWhere], [groupedDisplayCount]) 
VALUES (3245, 4112, N'WholesalerData_WholesalerDataItems_WholesalerDataItems', N'Wholesaler Data Items', 11, 0, 0, 0, N'', N'', N'', N'WholesalerDataItems', N'', 3244, 1, 1, 0, 0, 0, 0, 0, 0, N'', N'', 0, 0, 0, N'', 0, 0, 0, 0, 0, 0, 0, 0, 0, N'', 6, 1, 1, 12, 0, 1, 0, 0, N'', 0, 0, 0, 0, 1, 0, 0, 0, N'', 0)
INSERT [dbo].[pal_SurfaceField] ([recId], [surfaceId], [surfaceFieldName], [surfaceFieldDisplay], [surfaceFieldTypeId], [length], [required], [lookupCategory], [relationalFields], [relationalValues], [relationalOrderBy], [relationalSurface], [relationalObject], [parentId], [sequence], [isActive], [isGrid], [isFilter], [colSequence], [contentId], [defaultToCurrent], [isControlled], [controlledValue], [controlText], [isAutoPostback], [isHidden], [isReadOnly], [placeholder], [isUnique], [actionType], [action], [actionSource], [isComparable], [alternateView], [isHiddenFromWizzard], [surfaceDateTypeId], [isHiddenFromView], [actionValue], [surfaceFieldSize], [isLabelHidden], [isOnNewLine], [labelSize], [isHiddenFromForm], [accessLevel], [hasBottomBorder], [hasFullBorder], [defaultValue], [validationType], [enableBulkUpdate], [isCurrency], [isVerticalHeader], [gridSequence], [isGrouped], [isCloneable], [isCustomSource], [relationalWhere], [groupedDisplayCount])
VALUES (3246, 4112, N'WholesalerData_WholesalerData_AttachmentId', N'AttachmentId', 4, 0, 0, 0, N'', N'', N'', N'', N'', 3237, 1, 1, 0, 0, 0, 0, 0, 0, N'', N'', 0, 1, 0, N'', 0, 0, 0, 0, 0, 0, 0, 0, 0, N'', 3, 1, 0, 12, 0, 1, 0, 0, N'', 0, 0, 0, 0, 11, 0, 0, 0, N'', 0)

SET IDENTITY_INSERT [dbo].[pal_SurfaceField] OFF

CREATE TABLE [dbo].[publ_WholesalerData](
	[itemID] [int] NOT NULL,
	[isActive] [bit] NULL,
	[surfaceId] [int] NOT NULL,
	[ParentSurfaceItemId] [int] NULL,
	[WholesalerData_WholesalerData_WholesalerCode] [varchar](max) NULL,
	[WholesalerData_WholesalerData_WholesalerUniqueName] [varchar](max) NULL,
	[WholesalerData_WholesalerData_FileName] [varchar](max) NULL,
	[WholesalerData_WholesalerData_AttachmentId] [int] NULL,
	[WholesalerData_WholesalerData_ImportedBy] [varchar](max) NULL,
	[WholesalerData_WholesalerData_DateImported] [datetime] NULL,
	[recId] [int] IDENTITY(1,1) NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[recId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
END;
