CREATE TABLE [dbo].[ATConvertDefinition] (
	[Id] INT IDENTITY(1,1) NOT NULL,
	[ProcessID] INT NOT NULL,
	[TemplateId] INT NOT NULL,
	[SourceDocTypeId] INT NULL,
	[ExportDocTypeId] INT NULL,
	[MergeOrderId] INT NULL,
	[MergeDocs] BIT NULL,
	[KeepInMemory] BIT NULL,
	[CoverSheet] BIT NULL,
	[Barcodes] BIT NULL,
	[BarcodesFontId] INT NULL,
	[ReplaceDocument] BIT NOT NULL DEFAULT 0,
    CONSTRAINT [PK_ATConvertDefinition] PRIMARY KEY CLUSTERED ([Id]),
    CONSTRAINT [FK_ATExportDefinition_SourceDocTypeId] FOREIGN KEY ([SourceDocTypeId]) REFERENCES [dbo].[ATImportDocumentType]([Id]),
    CONSTRAINT [FK_ATExportDefinition_ExportDocTypeId] FOREIGN KEY ([ExportDocTypeId]) REFERENCES [dbo].[ATImportDocumentType]([Id]),
    CONSTRAINT [FK_ATExportDefinition_MergeOrderId] FOREIGN KEY ([MergeOrderId]) REFERENCES [dbo].[ATMergeOrder]([Id]),
    CONSTRAINT [FK_ATExportDefinition_BarcodesFontId] FOREIGN KEY ([BarcodesFontId]) REFERENCES [dbo].[ATBarcodeFont]([Id])
	)
