use [MainDataBase]
਍䜀伀ഀഀ

਍ⴀⴀ ⌀ᐄငᬄᔄᴄ᠄ᔄ ᨀḄᴄ℄∄ ᔄᤄᴄḄሄഄഀ
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_descriptions_descriptionType]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
਍䄀䰀吀䔀刀 吀䄀䈀䰀䔀 嬀搀戀漀崀⸀嬀搀攀猀挀爀椀瀀琀椀漀渀猀崀 䐀刀伀倀 䌀伀一匀吀刀䄀䤀一吀 䘀䬀开搀攀猀挀爀椀瀀琀椀漀渀猀开搀攀猀挀爀椀瀀琀椀漀渀吀礀瀀攀ഀഀ
GO
਍ഀഀ
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_documents_docType]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
਍䄀䰀吀䔀刀 吀䄀䈀䰀䔀 嬀搀戀漀崀⸀嬀搀漀挀甀洀攀渀琀猀崀 䐀刀伀倀 䌀伀一匀吀刀䄀䤀一吀 䘀䬀开搀漀挀甀洀攀渀琀猀开搀漀挀吀礀瀀攀ഀഀ
GO
਍ഀഀ
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_consignees_history]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
਍䄀䰀吀䔀刀 吀䄀䈀䰀䔀 嬀搀戀漀崀⸀嬀挀漀渀猀椀最渀攀攀猀崀 䐀刀伀倀 䌀伀一匀吀刀䄀䤀一吀 䘀䬀开挀漀渀猀椀最渀攀攀猀开栀椀猀琀漀爀礀ഀഀ
GO
਍ഀഀ
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_consignors_history]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
਍䄀䰀吀䔀刀 吀䄀䈀䰀䔀 嬀搀戀漀崀⸀嬀挀漀渀猀椀最渀漀爀猀崀 䐀刀伀倀 䌀伀一匀吀刀䄀䤀一吀 䘀䬀开挀漀渀猀椀最渀漀爀猀开栀椀猀琀漀爀礀ഀഀ
GO
਍ഀഀ
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_documents_history]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
਍䄀䰀吀䔀刀 吀䄀䈀䰀䔀 嬀搀戀漀崀⸀嬀搀漀挀甀洀攀渀琀猀崀 䐀刀伀倀 䌀伀一匀吀刀䄀䤀一吀 䘀䬀开搀漀挀甀洀攀渀琀猀开栀椀猀琀漀爀礀ഀഀ
GO
਍ഀഀ
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_consignees_invoices]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
਍䄀䰀吀䔀刀 吀䄀䈀䰀䔀 嬀搀戀漀崀⸀嬀挀漀渀猀椀最渀攀攀猀崀 䐀刀伀倀 䌀伀一匀吀刀䄀䤀一吀 䘀䬀开挀漀渀猀椀最渀攀攀猀开椀渀瘀漀椀挀攀猀ഀഀ
GO
਍ഀഀ
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_consignors_invoices]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
਍䄀䰀吀䔀刀 吀䄀䈀䰀䔀 嬀搀戀漀崀⸀嬀挀漀渀猀椀最渀漀爀猀崀 䐀刀伀倀 䌀伀一匀吀刀䄀䤀一吀 䘀䬀开挀漀渀猀椀最渀漀爀猀开椀渀瘀漀椀挀攀猀ഀഀ
GO
਍ഀഀ
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_documents_invoices]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
਍䄀䰀吀䔀刀 吀䄀䈀䰀䔀 嬀搀戀漀崀⸀嬀搀漀挀甀洀攀渀琀猀崀 䐀刀伀倀 䌀伀一匀吀刀䄀䤀一吀 䘀䬀开搀漀挀甀洀攀渀琀猀开椀渀瘀漀椀挀攀猀ഀഀ
GO
਍ഀഀ
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_invoices_history]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
਍䄀䰀吀䔀刀 吀䄀䈀䰀䔀 嬀搀戀漀崀⸀嬀椀渀瘀漀椀挀攀猀崀 䐀刀伀倀 䌀伀一匀吀刀䄀䤀一吀 䘀䬀开椀渀瘀漀椀挀攀猀开栀椀猀琀漀爀礀ഀഀ
GO
਍ഀഀ
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_roster_invoices]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
਍䄀䰀吀䔀刀 吀䄀䈀䰀䔀 嬀搀戀漀崀⸀嬀爀漀猀琀攀爀崀 䐀刀伀倀 䌀伀一匀吀刀䄀䤀一吀 䘀䬀开爀漀猀琀攀爀开椀渀瘀漀椀挀攀猀ഀഀ
GO
਍ഀഀ
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_roster_rateType]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
਍䄀䰀吀䔀刀 吀䄀䈀䰀䔀 嬀搀戀漀崀⸀嬀爀漀猀琀攀爀崀 䐀刀伀倀 䌀伀一匀吀刀䄀䤀一吀 䘀䬀开爀漀猀琀攀爀开爀愀琀攀吀礀瀀攀ഀഀ
GO
਍ഀഀ
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_descriptions_roster]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
਍䄀䰀吀䔀刀 吀䄀䈀䰀䔀 嬀搀戀漀崀⸀嬀搀攀猀挀爀椀瀀琀椀漀渀猀崀 䐀刀伀倀 䌀伀一匀吀刀䄀䤀一吀 䘀䬀开搀攀猀挀爀椀瀀琀椀漀渀猀开爀漀猀琀攀爀ഀഀ
GO
਍ഀഀ
-- УДАЛЕНИЕ ТРИГЕРОВ
਍椀昀 攀砀椀猀琀猀 ⠀猀攀氀攀挀琀 ⨀ 昀爀漀洀 搀戀漀⸀猀礀猀漀戀樀攀挀琀猀 眀栀攀爀攀 椀搀 㴀 漀戀樀攀挀琀开椀搀⠀一✀嬀搀戀漀崀⸀嬀栀椀猀琀漀爀礀䌀漀洀瀀氀攀洀攀渀琀崀✀⤀ 愀渀搀 伀䈀䨀䔀䌀吀倀刀伀倀䔀刀吀夀⠀椀搀Ⰰ 一✀䤀猀吀爀椀最最攀爀✀⤀ 㴀 ㄀⤀ഀഀ
drop trigger [dbo].[historyComplement]
਍䜀伀ഀഀ

਍ⴀⴀ ⌀ᐄငᬄᔄᴄ᠄ᔄ ∀ငᄄᬄ᠄☄ഄഀ
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[consignees]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
਍搀爀漀瀀 琀愀戀氀攀 嬀搀戀漀崀⸀嬀挀漀渀猀椀最渀攀攀猀崀ഀഀ
GO
਍ഀഀ
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[consignors]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
਍搀爀漀瀀 琀愀戀氀攀 嬀搀戀漀崀⸀嬀挀漀渀猀椀最渀漀爀猀崀ഀഀ
GO
਍ഀഀ
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[descriptionType]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
਍搀爀漀瀀 琀愀戀氀攀 嬀搀戀漀崀⸀嬀搀攀猀挀爀椀瀀琀椀漀渀吀礀瀀攀崀ഀഀ
GO
਍ഀഀ
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[descriptions]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
਍搀爀漀瀀 琀愀戀氀攀 嬀搀戀漀崀⸀嬀搀攀猀挀爀椀瀀琀椀漀渀猀崀ഀഀ
GO
਍ഀഀ
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[docType]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
਍搀爀漀瀀 琀愀戀氀攀 嬀搀戀漀崀⸀嬀搀漀挀吀礀瀀攀崀ഀഀ
GO
਍ഀഀ
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[documents]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
਍搀爀漀瀀 琀愀戀氀攀 嬀搀戀漀崀⸀嬀搀漀挀甀洀攀渀琀猀崀ഀഀ
GO
਍ഀഀ
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[history]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
਍搀爀漀瀀 琀愀戀氀攀 嬀搀戀漀崀⸀嬀栀椀猀琀漀爀礀崀ഀഀ
GO
਍ഀഀ
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[invoices]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
਍搀爀漀瀀 琀愀戀氀攀 嬀搀戀漀崀⸀嬀椀渀瘀漀椀挀攀猀崀ഀഀ
GO
਍ഀഀ
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[rateType]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
਍搀爀漀瀀 琀愀戀氀攀 嬀搀戀漀崀⸀嬀爀愀琀攀吀礀瀀攀崀ഀഀ
GO
਍ഀഀ
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[roster]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
਍搀爀漀瀀 琀愀戀氀攀 嬀搀戀漀崀⸀嬀爀漀猀琀攀爀崀ഀഀ
GO
਍ഀഀ
-- РЕДАКТИРОВАНИЕ СТОЛБЦОВ
਍䄀䰀吀䔀刀 吀䄀䈀䰀䔀 琀戀倀爀攀搀瀀爀 䄀䰀吀䔀刀 䌀伀䰀唀䴀一 匀琀䠀漀䘀氀 瘀愀爀挀栀愀爀⠀㄀㔀　⤀ 一唀䰀䰀ഀഀ

਍ⴀⴀ ᐀Ḅᄄငሄᬄᔄᴄ᠄ᔄ ℀∄Ḅᬄᄄ☄Ḅሄഄഀ
if not exists (SELECT * FROM syscolumns WHERE (name = 'dependentPerson') AND (id = OBJECT_ID(N'[dbo].[tbPredpr]')))
਍䄀䰀吀䔀刀 吀䄀䈀䰀䔀 琀戀倀爀攀搀瀀爀 䄀䐀䐀 搀攀瀀攀渀搀攀渀琀倀攀爀猀漀渀 戀椀琀ഀഀ
GO
਍ഀഀ
if not exists (SELECT * FROM syscolumns WHERE (name = 'ResidentsOfOffshore') AND (id = OBJECT_ID(N'[dbo].[tbPredpr]')))
਍䄀䰀吀䔀刀 吀䄀䈀䰀䔀 琀戀倀爀攀搀瀀爀 䄀䐀䐀 刀攀猀椀搀攀渀琀猀伀昀伀昀昀猀栀漀爀攀 戀椀琀ഀഀ
GO
਍ഀഀ
if not exists (SELECT * FROM syscolumns WHERE (name = 'BigCompany') AND (id = OBJECT_ID(N'[dbo].[tbPredpr]')))
਍䄀䰀吀䔀刀 吀䄀䈀䰀䔀 琀戀倀爀攀搀瀀爀 䄀䐀䐀 䈀椀最䌀漀洀瀀愀渀礀 戀椀琀ഀഀ
GO
਍ഀഀ
if not exists (SELECT * FROM syscolumns WHERE (name = 'kodVed') AND (id = OBJECT_ID(N'[dbo].[SprVid]')))
਍䄀䰀吀䔀刀 吀䄀䈀䰀䔀 匀瀀爀嘀椀搀 䄀䐀䐀 欀漀搀嘀攀搀 瘀愀爀挀栀愀爀⠀㄀　⤀ 渀甀氀氀ഀഀ
GO
਍ഀഀ
if not exists(SELECT * FROM syscolumns WHERE (name = 'ESCFPriznak') AND (id = OBJECT_ID(N'[dbo].[tbGrOper]')))
਍   䄀䰀吀䔀刀 吀䄀䈀䰀䔀 琀戀䜀爀伀瀀攀爀 䄀䐀䐀 䔀匀䌀䘀倀爀椀稀渀愀欀 戀椀琀 搀攀昀愀甀氀琀⠀㄀⤀ഀഀ
GO
਍ഀഀ
if not exists(SELECT * FROM syscolumns WHERE (name = 'ESCFPriznakBuh') AND (id = OBJECT_ID(N'[dbo].[tbGrOper]')))
਍   䄀䰀吀䔀刀 吀䄀䈀䰀䔀 琀戀䜀爀伀瀀攀爀 䄀䐀䐀 䔀匀䌀䘀倀爀椀稀渀愀欀䈀甀栀 戀椀琀 搀攀昀愀甀氀琀⠀㄀⤀ഀഀ
GO
਍ഀഀ
CREATE TABLE [dbo].[consignees] (
਍ऀ嬀椀搀匀攀渀搀攀爀崀 嬀猀洀愀氀氀椀渀琀崀 一伀吀 一唀䰀䰀 Ⰰഀഀ
	[compilingYear] [smallint] NOT NULL ,
਍ऀ嬀渀甀洀戀攀爀崀 嬀戀椀最椀渀琀崀 一伀吀 一唀䰀䰀 Ⰰഀഀ
	[idPredpr] [int] NOT NULL 
਍⤀ 伀一 嬀倀刀䤀䴀䄀刀夀崀ഀഀ
GO
਍ഀഀ
CREATE TABLE [dbo].[consignors] (
਍ऀ嬀椀搀匀攀渀搀攀爀崀 嬀猀洀愀氀氀椀渀琀崀 一伀吀 一唀䰀䰀 Ⰰഀഀ
	[compilingYear] [smallint] NOT NULL ,
਍ऀ嬀渀甀洀戀攀爀崀 嬀戀椀最椀渀琀崀 一伀吀 一唀䰀䰀 Ⰰഀഀ
	[idPredpr] [int] NOT NULL 
਍⤀ 伀一 嬀倀刀䤀䴀䄀刀夀崀ഀഀ
GO
਍ഀഀ
CREATE TABLE [dbo].[descriptionType] (
਍ऀ嬀椀搀䐀攀猀挀崀 嬀琀椀渀礀椀渀琀崀 一伀吀 一唀䰀䰀 Ⰰഀഀ
	[value] [varchar] (256) COLLATE SQL_Latin1_General_CP1251_CI_AS NOT NULL 
਍⤀ 伀一 嬀倀刀䤀䴀䄀刀夀崀ഀഀ
GO
਍ഀഀ
CREATE TABLE [dbo].[descriptions] (
਍ऀ嬀椀搀䐀攀猀挀崀 嬀琀椀渀礀椀渀琀崀 一伀吀 一唀䰀䰀 Ⰰഀഀ
	[idStr] [int] NOT NULL 
਍⤀ 伀一 嬀倀刀䤀䴀䄀刀夀崀ഀഀ
GO
਍ഀഀ
CREATE TABLE [dbo].[docType] (
਍ऀ嬀挀漀搀攀崀 嬀椀渀琀崀 一伀吀 一唀䰀䰀 Ⰰഀഀ
	[value] [varchar] (50) COLLATE SQL_Latin1_General_CP1251_CI_AS NOT NULL 
਍⤀ 伀一 嬀倀刀䤀䴀䄀刀夀崀ഀഀ
GO
਍ഀഀ
CREATE TABLE [dbo].[documents] (
਍ऀ嬀椀搀匀攀渀搀攀爀崀 嬀猀洀愀氀氀椀渀琀崀 一伀吀 一唀䰀䰀 Ⰰഀഀ
	[compilingYear] [smallint] NOT NULL ,
਍ऀ嬀渀甀洀戀攀爀崀 嬀戀椀最椀渀琀崀 一伀吀 一唀䰀䰀 Ⰰഀഀ
	[code] [int] NOT NULL ,
਍ऀ嬀搀漀挀䐀愀琀攀崀 嬀搀愀琀攀琀椀洀攀崀 一伀吀 一唀䰀䰀 Ⰰഀഀ
	[blankCode] [varchar] (50) COLLATE SQL_Latin1_General_CP1251_CI_AS NULL ,
਍ऀ嬀猀攀爀椀愀崀 嬀瘀愀爀挀栀愀爀崀 ⠀㈀㔀⤀ 䌀伀䰀䰀䄀吀䔀 匀儀䰀开䰀愀琀椀渀㄀开䜀攀渀攀爀愀氀开䌀倀㄀㈀㔀㄀开䌀䤀开䄀匀 一唀䰀䰀 Ⰰഀഀ
	[docNumber] [varchar] (50) COLLATE SQL_Latin1_General_CP1251_CI_AS NOT NULL ,
਍ऀ嬀瘀椀搀䐀漀挀崀 嬀琀椀渀礀椀渀琀崀 一伀吀 一唀䰀䰀Ⰰഀഀ
	[KodSkl] [int] NULL,
਍ऀ嬀椀搀倀爀攀搀瀀爀崀 嬀椀渀琀崀 一唀䰀䰀ഀഀ
) ON [PRIMARY]
਍䜀伀ഀഀ

਍䌀刀䔀䄀吀䔀 吀䄀䈀䰀䔀 嬀搀戀漀崀⸀嬀栀椀猀琀漀爀礀崀 ⠀ഀഀ
	[idSender] [smallint] NOT NULL ,
਍ऀ嬀挀漀洀瀀椀氀椀渀最夀攀愀爀崀 嬀猀洀愀氀氀椀渀琀崀 一伀吀 一唀䰀䰀 Ⰰഀഀ
	[number] [bigint] NOT NULL ,
਍ऀ嬀椀渀瘀匀琀愀琀甀猀崀 嬀琀椀渀礀椀渀琀崀 一唀䰀䰀Ⰰഀഀ
	[StatusDate] [datetime] NULL
਍⤀ 伀一 嬀倀刀䤀䴀䄀刀夀崀ഀഀ
GO
਍ഀഀ
CREATE TABLE [dbo].[invoices] (
਍ऀ嬀椀搀匀攀渀搀攀爀崀 嬀猀洀愀氀氀椀渀琀崀 一伀吀 一唀䰀䰀 Ⰰഀഀ
	[compilingYear] [smallint] NOT NULL ,
਍ऀ嬀渀甀洀戀攀爀崀 嬀戀椀最椀渀琀崀 一伀吀 一唀䰀䰀 Ⰰഀഀ
	[invoice] [varchar] (25) COLLATE SQL_Latin1_General_CP1251_CI_AS NULL ,
਍ऀ嬀搀愀琀攀䌀愀渀挀攀氀氀攀搀崀 嬀搀愀琀攀琀椀洀攀崀 一唀䰀䰀 Ⰰഀഀ
	[documentType] [tinyint] NOT NULL ,
਍ऀ嬀搀愀琀攀吀爀愀渀猀愀挀琀椀漀渀崀 嬀搀愀琀攀琀椀洀攀崀 一唀䰀䰀 Ⰰഀഀ
	[idProvider] [int] NULL ,
਍ऀ嬀瀀爀漀瘀椀搀攀爀匀琀愀琀甀猀崀 嬀琀椀渀礀椀渀琀崀 一唀䰀䰀 Ⰰഀഀ
	[specialDealGoods] [bit] NULL ,
਍ऀ嬀瀀爀椀渀挀椀瀀愀氀䤀搀崀 嬀猀洀愀氀氀椀渀琀崀 一唀䰀䰀 Ⰰഀഀ
	[principalYear] [smallint] NULL ,
਍ऀ嬀瀀爀椀渀挀椀瀀愀氀一甀洀戀攀爀崀 嬀戀椀最椀渀琀崀 一唀䰀䰀 Ⰰഀഀ
	[principalDate] [datetime] NULL ,
਍ऀ嬀瘀攀渀搀漀爀䤀搀崀 嬀猀洀愀氀氀椀渀琀崀 一唀䰀䰀 Ⰰഀഀ
	[vendorYear] [smallint] NULL ,
਍ऀ嬀瘀攀渀搀漀爀一甀洀戀攀爀崀 嬀戀椀最椀渀琀崀 一唀䰀䰀 Ⰰഀഀ
	[vendorDate] [datetime] NULL ,
਍ऀ嬀瀀䐀攀挀氀愀爀愀琀椀漀渀崀 嬀瘀愀爀挀栀愀爀崀 ⠀㈀㔀⤀ 䌀伀䰀䰀䄀吀䔀 匀儀䰀开䰀愀琀椀渀㄀开䜀攀渀攀爀愀氀开䌀倀㄀㈀㔀㄀开䌀䤀开䄀匀 一唀䰀䰀 Ⰰഀഀ
	[dateRelease] [datetime] NULL ,
਍ऀ嬀搀愀琀攀䄀挀琀甀愀氀䔀砀瀀漀爀琀崀 嬀搀愀琀攀琀椀洀攀崀 一唀䰀䰀 Ⰰഀഀ
	[pTaxesNumber] [varchar] (25) COLLATE SQL_Latin1_General_CP1251_CI_AS NULL ,
਍ऀ嬀瀀吀愀砀攀猀䐀愀琀攀崀 嬀搀愀琀攀琀椀洀攀崀 一唀䰀䰀 Ⰰഀഀ
	[idRecipient] [int] NULL ,
਍ऀ嬀爀攀挀椀瀀椀攀渀琀匀琀愀琀甀猀崀 嬀琀椀渀礀椀渀琀崀 一唀䰀䰀 Ⰰഀഀ
	[rDeclaration] [varchar] (25) COLLATE SQL_Latin1_General_CP1251_CI_AS NULL ,
਍ऀ嬀爀吀愀砀攀猀一甀洀戀攀爀崀 嬀瘀愀爀挀栀愀爀崀 ⠀㈀㔀⤀ 䌀伀䰀䰀䄀吀䔀 匀儀䰀开䰀愀琀椀渀㄀开䜀攀渀攀爀愀氀开䌀倀㄀㈀㔀㄀开䌀䤀开䄀匀 一唀䰀䰀 Ⰰഀഀ
	[rTaxesDate] [datetime] NULL ,
਍ऀ嬀搀愀琀攀䤀洀瀀漀爀琀崀 嬀搀愀琀攀琀椀洀攀崀 一唀䰀䰀 Ⰰഀഀ
	[contractNumber] [varchar] (100) COLLATE SQL_Latin1_General_CP1251_CI_AS NULL ,
਍ऀ嬀挀漀渀琀爀愀挀琀䐀愀琀攀崀 嬀搀愀琀攀琀椀洀攀崀 一唀䰀䰀 Ⰰഀഀ
	[description] [varchar] (512) COLLATE SQL_Latin1_General_CP1251_CI_AS NULL ,
਍ऀ嬀琀漀琀愀氀䌀漀猀琀嘀愀琀崀 嬀搀攀挀椀洀愀氀崀⠀㄀㠀Ⰰ ㌀⤀ 一伀吀 一唀䰀䰀 Ⰰഀഀ
	[totalExcise] [decimal](18, 3) NOT NULL ,
਍ऀ嬀琀漀琀愀氀嘀愀琀崀 嬀搀攀挀椀洀愀氀崀⠀㄀㠀Ⰰ ㌀⤀ 一伀吀 一唀䰀䰀 Ⰰഀഀ
	[totalCost] [decimal](18, 3) NOT NULL ,
਍ऀ嬀挀漀洀瀀氀攀琀攀搀崀 嬀戀椀琀崀 一唀䰀䰀 Ⰰഀഀ
	[Sv] [bit] NOT NULL DEFAULT(0)
਍⤀ 伀一 嬀倀刀䤀䴀䄀刀夀崀ഀഀ
GO
਍ഀഀ
CREATE TABLE [dbo].[rateType] (
਍ऀ嬀椀搀刀愀琀攀吀礀瀀攀崀 嬀琀椀渀礀椀渀琀崀 一伀吀 一唀䰀䰀 Ⰰഀഀ
	[value] [varchar] (10) COLLATE SQL_Latin1_General_CP1251_CI_AS NOT NULL 
਍⤀ 伀一 嬀倀刀䤀䴀䄀刀夀崀ഀഀ
GO
਍ഀഀ
CREATE TABLE [dbo].[roster] (
਍ऀ嬀椀搀匀攀渀搀攀爀崀 嬀猀洀愀氀氀椀渀琀崀 一伀吀 一唀䰀䰀 Ⰰഀഀ
	[compilingYear] [smallint] NOT NULL ,
਍ऀ嬀渀甀洀戀攀爀崀 嬀戀椀最椀渀琀崀 一伀吀 一唀䰀䰀 Ⰰഀഀ
	[pnt] [int] NULL ,
਍ऀ嬀椀搀匀琀爀崀 嬀椀渀琀崀 䤀䐀䔀一吀䤀吀夀 ⠀㄀Ⰰ ㄀⤀ 一伀吀 一唀䰀䰀 Ⰰഀഀ
	[itemNumber] [int] NULL ,
਍ऀ嬀渀愀洀攀崀 嬀瘀愀爀挀栀愀爀崀 ⠀㔀㄀㈀⤀ 䌀伀䰀䰀䄀吀䔀 匀儀䰀开䰀愀琀椀渀㄀开䜀攀渀攀爀愀氀开䌀倀㄀㈀㔀㄀开䌀䤀开䄀匀 一伀吀 一唀䰀䰀 Ⰰഀഀ
	[code] [varchar] (10) COLLATE SQL_Latin1_General_CP1251_CI_AS NULL ,
਍ऀ嬀挀漀搀攀开漀挀攀搀崀 嬀瘀愀爀挀栀愀爀崀 ⠀㔀⤀ 䌀伀䰀䰀䄀吀䔀 匀儀䰀开䰀愀琀椀渀㄀开䜀攀渀攀爀愀氀开䌀倀㄀㈀㔀㄀开䌀䤀开䄀匀 一唀䰀䰀 Ⰰഀഀ
	[units] [smallint] NULL ,
਍ऀ嬀挀漀甀渀琀崀 嬀搀攀挀椀洀愀氀崀⠀㄀㠀Ⰰ 㐀⤀ 一唀䰀䰀 Ⰰഀഀ
	[price] [decimal](18, 3) NULL ,
਍ऀ嬀挀漀猀琀崀 嬀搀攀挀椀洀愀氀崀⠀㄀㠀Ⰰ ㌀⤀ 一伀吀 一唀䰀䰀 Ⰰഀഀ
	[summaExcise] [decimal](18, 3) NULL ,
਍ऀ嬀爀愀琀攀崀 嬀搀攀挀椀洀愀氀崀⠀㔀Ⰰ ㌀⤀ 一唀䰀䰀 Ⰰഀഀ
	[idRateType] [tinyint] NULL ,
਍ऀ嬀猀甀洀洀愀嘀愀琀崀 嬀搀攀挀椀洀愀氀崀⠀㄀㠀Ⰰ ㌀⤀ 一伀吀 一唀䰀䰀 Ⰰഀഀ
	[costVat] [decimal](18, 3) NOT NULL 
਍⤀ 伀一 嬀倀刀䤀䴀䄀刀夀崀ഀഀ
GO
਍ഀഀ
ALTER TABLE [dbo].[consignees] WITH NOCHECK ADD 
਍ऀ䌀伀一匀吀刀䄀䤀一吀 嬀倀䬀开挀漀渀猀椀最渀攀攀猀崀 倀刀䤀䴀䄀刀夀 䬀䔀夀  䌀䰀唀匀吀䔀刀䔀䐀 ഀഀ
	(
਍ऀऀ嬀椀搀匀攀渀搀攀爀崀Ⰰഀഀ
		[compilingYear],
਍ऀऀ嬀渀甀洀戀攀爀崀Ⰰഀഀ
		[idPredpr]
਍ऀ⤀  伀一 嬀倀刀䤀䴀䄀刀夀崀 ഀഀ
GO
਍ഀഀ
ALTER TABLE [dbo].[consignors] WITH NOCHECK ADD 
਍ऀ䌀伀一匀吀刀䄀䤀一吀 嬀倀䬀开挀漀渀猀椀最渀漀爀猀崀 倀刀䤀䴀䄀刀夀 䬀䔀夀  䌀䰀唀匀吀䔀刀䔀䐀 ഀഀ
	(
਍ऀऀ嬀椀搀匀攀渀搀攀爀崀Ⰰഀഀ
		[compilingYear],
਍ऀऀ嬀渀甀洀戀攀爀崀Ⰰഀഀ
		[idPredpr]
਍ऀ⤀  伀一 嬀倀刀䤀䴀䄀刀夀崀 ഀഀ
GO
਍ഀഀ
ALTER TABLE [dbo].[descriptionType] WITH NOCHECK ADD 
਍ऀ䌀伀一匀吀刀䄀䤀一吀 嬀倀䬀开搀攀猀挀爀椀瀀琀椀漀渀吀礀瀀攀崀 倀刀䤀䴀䄀刀夀 䬀䔀夀  䌀䰀唀匀吀䔀刀䔀䐀 ഀഀ
	(
਍ऀऀ嬀椀搀䐀攀猀挀崀ഀഀ
	)  ON [PRIMARY] 
਍䜀伀ഀഀ

਍䄀䰀吀䔀刀 吀䄀䈀䰀䔀 嬀搀戀漀崀⸀嬀搀漀挀吀礀瀀攀崀 圀䤀吀䠀 一伀䌀䠀䔀䌀䬀 䄀䐀䐀 ഀഀ
	CONSTRAINT [PK_docType] PRIMARY KEY  CLUSTERED 
਍ऀ⠀ഀഀ
		[code]
਍ऀ⤀  伀一 嬀倀刀䤀䴀䄀刀夀崀 ഀഀ
GO
਍ഀഀ
ALTER TABLE [dbo].[documents] WITH NOCHECK ADD 
਍ऀ䌀伀一匀吀刀䄀䤀一吀 嬀䤀堀开搀漀挀甀洀攀渀琀猀崀 唀一䤀儀唀䔀  䌀䰀唀匀吀䔀刀䔀䐀 ഀഀ
	(
਍ऀऀ嬀椀搀匀攀渀搀攀爀崀Ⰰഀഀ
		[compilingYear],
਍ऀऀ嬀渀甀洀戀攀爀崀Ⰰഀഀ
		[docNumber],
਍ऀऀ嬀瘀椀搀䐀漀挀崀Ⰰഀഀ
		[KodSkl],
਍ऀऀ嬀椀搀倀爀攀搀瀀爀崀ഀഀ
	)  ON [PRIMARY] 
਍䜀伀ഀഀ

਍䄀䰀吀䔀刀 吀䄀䈀䰀䔀 嬀搀戀漀崀⸀嬀栀椀猀琀漀爀礀崀 圀䤀吀䠀 一伀䌀䠀䔀䌀䬀 䄀䐀䐀 ഀഀ
	CONSTRAINT [PK_history] PRIMARY KEY  CLUSTERED 
਍ऀ⠀ഀഀ
		[idSender],
਍ऀऀ嬀挀漀洀瀀椀氀椀渀最夀攀愀爀崀Ⰰഀഀ
		[number]
਍ऀ⤀  伀一 嬀倀刀䤀䴀䄀刀夀崀 ഀഀ
GO
਍ഀഀ
ALTER TABLE [dbo].[invoices] WITH NOCHECK ADD 
਍ऀ䌀伀一匀吀刀䄀䤀一吀 嬀倀䬀开椀渀瘀漀椀挀攀猀崀 倀刀䤀䴀䄀刀夀 䬀䔀夀  䌀䰀唀匀吀䔀刀䔀䐀 ഀഀ
	(
਍ऀऀ嬀椀搀匀攀渀搀攀爀崀Ⰰഀഀ
		[compilingYear],
਍ऀऀ嬀渀甀洀戀攀爀崀ഀഀ
	)  ON [PRIMARY] 
਍䜀伀ഀഀ

਍䄀䰀吀䔀刀 吀䄀䈀䰀䔀 嬀搀戀漀崀⸀嬀爀愀琀攀吀礀瀀攀崀 圀䤀吀䠀 一伀䌀䠀䔀䌀䬀 䄀䐀䐀 ഀഀ
	CONSTRAINT [PK_RateType] PRIMARY KEY  CLUSTERED 
਍ऀ⠀ഀഀ
		[idRateType]
਍ऀ⤀  伀一 嬀倀刀䤀䴀䄀刀夀崀 ഀഀ
GO
਍ഀഀ
ALTER TABLE [dbo].[roster] WITH NOCHECK ADD 
਍ऀ䌀伀一匀吀刀䄀䤀一吀 嬀倀䬀开爀漀猀琀攀爀崀 倀刀䤀䴀䄀刀夀 䬀䔀夀  䌀䰀唀匀吀䔀刀䔀䐀 ഀഀ
	(
਍ऀऀ嬀椀搀匀琀爀崀ഀഀ
	)  ON [PRIMARY] 
਍䜀伀ഀഀ

਍⼀⨀䄀䰀吀䔀刀 吀䄀䈀䰀䔀 嬀搀戀漀崀⸀嬀栀椀猀琀漀爀礀崀 䄀䐀䐀 ഀഀ
	CONSTRAINT [DF__history__invStat__5F0C59BC] DEFAULT (0) FOR [invStatus]
਍䜀伀⨀⼀ഀഀ

਍⼀⨀䄀䰀吀䔀刀 吀䄀䈀䰀䔀 嬀搀戀漀崀⸀嬀椀渀瘀漀椀挀攀猀崀 䄀䐀䐀 ഀഀ
	CONSTRAINT [DF__invoices__Sv__5D24114A] DEFAULT (0) FOR [Sv]
਍䜀伀⨀⼀ഀഀ

਍䄀䰀吀䔀刀 吀䄀䈀䰀䔀 嬀搀戀漀崀⸀嬀挀漀渀猀椀最渀攀攀猀崀 䄀䐀䐀 ഀഀ
	CONSTRAINT [FK_consignees_history] FOREIGN KEY 
਍ऀ⠀ഀഀ
		[idSender],
਍ऀऀ嬀挀漀洀瀀椀氀椀渀最夀攀愀爀崀Ⰰഀഀ
		[number]
਍ऀ⤀ 刀䔀䘀䔀刀䔀一䌀䔀匀 嬀搀戀漀崀⸀嬀栀椀猀琀漀爀礀崀 ⠀ഀഀ
		[idSender],
਍ऀऀ嬀挀漀洀瀀椀氀椀渀最夀攀愀爀崀Ⰰഀഀ
		[number]
਍ऀ⤀ 伀一 䐀䔀䰀䔀吀䔀 䌀䄀匀䌀䄀䐀䔀  伀一 唀倀䐀䄀吀䔀 䌀䄀匀䌀䄀䐀䔀 ഀഀ
GO
਍ഀഀ
ALTER TABLE [dbo].[consignors] ADD 
਍ऀ䌀伀一匀吀刀䄀䤀一吀 嬀䘀䬀开挀漀渀猀椀最渀漀爀猀开栀椀猀琀漀爀礀崀 䘀伀刀䔀䤀䜀一 䬀䔀夀 ഀഀ
	(
਍ऀऀ嬀椀搀匀攀渀搀攀爀崀Ⰰഀഀ
		[compilingYear],
਍ऀऀ嬀渀甀洀戀攀爀崀ഀഀ
	) REFERENCES [dbo].[history] (
਍ऀऀ嬀椀搀匀攀渀搀攀爀崀Ⰰഀഀ
		[compilingYear],
਍ऀऀ嬀渀甀洀戀攀爀崀ഀഀ
	) ON DELETE CASCADE  ON UPDATE CASCADE 
਍䜀伀ഀഀ

਍䄀䰀吀䔀刀 吀䄀䈀䰀䔀 嬀搀戀漀崀⸀嬀搀攀猀挀爀椀瀀琀椀漀渀猀崀 䄀䐀䐀 ഀഀ
	CONSTRAINT [FK_descriptions_descriptionType] FOREIGN KEY 
਍ऀ⠀ഀഀ
		[idDesc]
਍ऀ⤀ 刀䔀䘀䔀刀䔀一䌀䔀匀 嬀搀戀漀崀⸀嬀搀攀猀挀爀椀瀀琀椀漀渀吀礀瀀攀崀 ⠀ഀഀ
		[idDesc]
਍ऀ⤀Ⰰഀഀ
	CONSTRAINT [FK_descriptions_roster] FOREIGN KEY 
਍ऀ⠀ഀഀ
		[idStr]
਍ऀ⤀ 刀䔀䘀䔀刀䔀一䌀䔀匀 嬀搀戀漀崀⸀嬀爀漀猀琀攀爀崀 ⠀ഀഀ
		[idStr]
਍ऀ⤀ 伀一 䐀䔀䰀䔀吀䔀 䌀䄀匀䌀䄀䐀䔀  伀一 唀倀䐀䄀吀䔀 䌀䄀匀䌀䄀䐀䔀 ഀഀ
GO
਍ഀഀ
ALTER TABLE [dbo].[documents] ADD 
਍ऀ䌀伀一匀吀刀䄀䤀一吀 嬀䘀䬀开搀漀挀甀洀攀渀琀猀开搀漀挀吀礀瀀攀崀 䘀伀刀䔀䤀䜀一 䬀䔀夀 ഀഀ
	(
਍ऀऀ嬀挀漀搀攀崀ഀഀ
	) REFERENCES [dbo].[docType] (
਍ऀऀ嬀挀漀搀攀崀ഀഀ
	),
਍ऀ䌀伀一匀吀刀䄀䤀一吀 嬀䘀䬀开搀漀挀甀洀攀渀琀猀开栀椀猀琀漀爀礀崀 䘀伀刀䔀䤀䜀一 䬀䔀夀 ഀഀ
	(
਍ऀऀ嬀椀搀匀攀渀搀攀爀崀Ⰰഀഀ
		[compilingYear],
਍ऀऀ嬀渀甀洀戀攀爀崀ഀഀ
	) REFERENCES [dbo].[history] (
਍ऀऀ嬀椀搀匀攀渀搀攀爀崀Ⰰഀഀ
		[compilingYear],
਍ऀऀ嬀渀甀洀戀攀爀崀ഀഀ
	) ON DELETE CASCADE  ON UPDATE CASCADE 
਍䜀伀ഀഀ

਍䄀䰀吀䔀刀 吀䄀䈀䰀䔀 嬀搀戀漀崀⸀嬀椀渀瘀漀椀挀攀猀崀 䄀䐀䐀 ഀഀ
	CONSTRAINT [FK_invoices_history] FOREIGN KEY 
਍ऀ⠀ഀഀ
		[idSender],
਍ऀऀ嬀挀漀洀瀀椀氀椀渀最夀攀愀爀崀Ⰰഀഀ
		[number]
਍ऀ⤀ 刀䔀䘀䔀刀䔀一䌀䔀匀 嬀搀戀漀崀⸀嬀栀椀猀琀漀爀礀崀 ⠀ഀഀ
		[idSender],
਍ऀऀ嬀挀漀洀瀀椀氀椀渀最夀攀愀爀崀Ⰰഀഀ
		[number]
਍ऀ⤀ 伀一 䐀䔀䰀䔀吀䔀 䌀䄀匀䌀䄀䐀䔀  伀一 唀倀䐀䄀吀䔀 䌀䄀匀䌀䄀䐀䔀 ഀഀ
GO
਍ഀഀ
ALTER TABLE [dbo].[roster] ADD 
਍ऀ䌀伀一匀吀刀䄀䤀一吀 嬀䘀䬀开爀漀猀琀攀爀开椀渀瘀漀椀挀攀猀崀 䘀伀刀䔀䤀䜀一 䬀䔀夀 ഀഀ
	(
਍ऀऀ嬀椀搀匀攀渀搀攀爀崀Ⰰഀഀ
		[compilingYear],
਍ऀऀ嬀渀甀洀戀攀爀崀ഀഀ
	) REFERENCES [dbo].[invoices] (
਍ऀऀ嬀椀搀匀攀渀搀攀爀崀Ⰰഀഀ
		[compilingYear],
਍ऀऀ嬀渀甀洀戀攀爀崀ഀഀ
	) ON DELETE CASCADE  ON UPDATE CASCADE ,
਍ऀ䌀伀一匀吀刀䄀䤀一吀 嬀䘀䬀开爀漀猀琀攀爀开爀愀琀攀吀礀瀀攀崀 䘀伀刀䔀䤀䜀一 䬀䔀夀 ഀഀ
	(
਍ऀऀ嬀椀搀刀愀琀攀吀礀瀀攀崀ഀഀ
	) REFERENCES [dbo].[rateType] (
਍ऀऀ嬀椀搀刀愀琀攀吀礀瀀攀崀ഀഀ
	)
਍䜀伀ഀഀ
SET QUOTED_IDENTIFIER OFF 
਍䜀伀ഀഀ
SET ANSI_NULLS ON 
਍䜀伀ഀഀ

਍䌀刀䔀䄀吀䔀 吀刀䤀䜀䜀䔀刀 嬀栀椀猀琀漀爀礀䌀漀洀瀀氀攀洀攀渀琀崀 伀一 嬀搀戀漀崀⸀嬀椀渀瘀漀椀挀攀猀崀 ഀഀ
INSTEAD OF INSERT
਍䄀匀ഀഀ
IF NOT EXISTS(SELECT * FROM [dbo].[history] INNER JOIN inserted ON inserted.idSender = history.idSender AND inserted.compilingYear = history.compilingYear AND inserted.number = history.number)
਍䤀一匀䔀刀吀 䤀一吀伀 嬀搀戀漀崀⸀嬀栀椀猀琀漀爀礀崀 ⠀椀搀匀攀渀搀攀爀Ⰰ 挀漀洀瀀椀氀椀渀最夀攀愀爀Ⰰ 渀甀洀戀攀爀⤀ഀഀ
SELECT idSender, compilingYear, number FROM inserted
਍ഀഀ
INSERT INTO [dbo].[invoices]
਍匀䔀䰀䔀䌀吀 ⨀ 䘀刀伀䴀 椀渀猀攀爀琀攀搀ഀഀ

਍䜀伀ഀഀ
SET QUOTED_IDENTIFIER OFF 
਍䜀伀ഀഀ
SET ANSI_NULLS ON 
਍䜀伀ഀഀ

਍椀昀 渀漀琀 攀砀椀猀琀猀⠀匀䔀䰀䔀䌀吀 椀搀䜀爀伀瀀攀爀 䘀刀伀䴀 琀戀䜀爀伀瀀攀爀 圀䠀䔀刀䔀 䔀匀䌀䘀倀爀椀稀渀愀欀 椀猀 渀漀琀 渀甀氀氀⤀ഀഀ
   UPDATE tbGrOper SET ESCFPriznak = 1
਍䜀伀ഀഀ

਍唀倀䐀䄀吀䔀 琀戀䜀爀伀瀀攀爀 匀䔀吀 䔀匀䌀䘀倀爀椀稀渀愀欀㴀　 圀䠀䔀刀䔀 椀搀䜀爀伀瀀攀爀 椀渀 ഀഀ
(SELECT tbGrOper.idGrOper FROM tbDeist
਍䰀䔀䘀吀 䨀伀䤀一 琀戀䐀攀椀猀琀 琀戀䐀攀椀猀琀㈀ 伀一 琀戀䐀攀椀猀琀㈀⸀椀搀䐀攀椀猀琀倀愀爀 㴀 琀戀䐀攀椀猀琀⸀椀搀一愀洀攀䐀攀椀猀琀ഀഀ
LEFT JOIN tbGrOper ON tbGrOper.idNameDeist = tbDeist2.idNameDeist
਍圀䠀䔀刀䔀 琀戀䐀攀椀猀琀㈀⸀椀搀䐀攀椀猀琀倀愀爀 䤀匀 一伀吀 一唀䰀䰀 䄀一䐀 琀戀䐀攀椀猀琀㈀⸀一愀洀攀䐀攀椀猀琀 䰀䤀䬀䔀 ✀─ἀ䀄㠄䔄㸄㐄┄✀⤀ഀഀ
GO
਍ഀഀ
if not exists(SELECT idGrOper FROM tbGrOper WHERE ESCFPriznakBuh is not null)
਍   唀倀䐀䄀吀䔀 琀戀䜀爀伀瀀攀爀 匀䔀吀 䔀匀䌀䘀倀爀椀稀渀愀欀䈀甀栀 㴀 ㄀ഀഀ
GO
਍ഀഀ
UPDATE tbGrOper SET ESCFPriznakBuh=0 WHERE idGrOper in 
਍⠀匀䔀䰀䔀䌀吀 琀戀䜀爀伀瀀攀爀⸀椀搀䜀爀伀瀀攀爀 䘀刀伀䴀 琀戀䐀攀椀猀琀ഀഀ
LEFT JOIN tbDeist tbDeist2 ON tbDeist2.idDeistPar = tbDeist.idNameDeist
਍䰀䔀䘀吀 䨀伀䤀一 琀戀䜀爀伀瀀攀爀 伀一 琀戀䜀爀伀瀀攀爀⸀椀搀一愀洀攀䐀攀椀猀琀 㴀 琀戀䐀攀椀猀琀㈀⸀椀搀一愀洀攀䐀攀椀猀琀ഀഀ
WHERE tbDeist2.idDeistPar IS NOT NULL AND tbDeist2.NameDeist LIKE '%Приход%')
਍ഀഀ

਍䤀一匀䔀刀吀 䤀一吀伀 搀漀挀吀礀瀀攀 ⠀挀漀搀攀Ⰰ 瘀愀氀甀攀⤀ 嘀䄀䰀唀䔀匀 ⠀㘀　㈀Ⰰ ✀∀ᴄⴄ㈀✀⤀ഀഀ
INSERT INTO docType (code, value) VALUES (603, 'ТТН-1')
਍䤀一匀䔀刀吀 䤀一吀伀 搀漀挀吀礀瀀攀 ⠀挀漀搀攀Ⰰ 瘀愀氀甀攀⤀ 嘀䄀䰀唀䔀匀 ⠀㘀　㐀Ⰰ ✀∀∄ᴄⴄ㈀✀⤀ഀഀ
INSERT INTO docType (code, value) VALUES (605, 'ТТН-3')
਍䤀一匀䔀刀吀 䤀一吀伀 搀漀挀吀礀瀀攀 ⠀挀漀搀攀Ⰰ 瘀愀氀甀攀⤀ 嘀䄀䰀唀䔀匀 ⠀㘀　㄀Ⰰ ✀∀∄ᴄⴄ㐀✀⤀ഀഀ
INSERT INTO docType (code, value) VALUES (606, 'ТТН-5')
਍䤀一匀䔀刀吀 䤀一吀伀 搀漀挀吀礀瀀攀 ⠀挀漀搀攀Ⰰ 瘀愀氀甀攀⤀ 嘀䄀䰀唀䔀匀 ⠀㘀　㜀Ⰰ ✀∀∄ᴄⴄ㘀✀⤀ഀഀ
INSERT INTO docType (code, value) VALUES (608, 'ТТН-7')
਍䤀一匀䔀刀吀 䤀一吀伀 搀漀挀吀礀瀀攀 ⠀挀漀搀攀Ⰰ 瘀愀氀甀攀⤀ 嘀䄀䰀唀䔀匀 ⠀㘀　㤀Ⰰ ✀∀∄ᴄⴄ㠀✀⤀ഀഀ
INSERT INTO docType (code, value) VALUES (610, 'ТТН-9')
਍䤀一匀䔀刀吀 䤀一吀伀 搀漀挀吀礀瀀攀 ⠀挀漀搀攀Ⰰ 瘀愀氀甀攀⤀ 嘀䄀䰀唀䔀匀 ⠀㘀㄀㄀Ⰰ ✀∀∄ᴄⴄ㄀　✀⤀ഀഀ
INSERT INTO docType (code, value) VALUES (612, 'ТТН-11')
਍䤀一匀䔀刀吀 䤀一吀伀 搀漀挀吀礀瀀攀 ⠀挀漀搀攀Ⰰ 瘀愀氀甀攀⤀ 嘀䄀䰀唀䔀匀 ⠀㘀㄀㌀Ⰰ ✀∀∄ᴄⴄ㄀㈀✀⤀ഀഀ
INSERT INTO docType (code, value) VALUES (614, 'Электронная ТТН-1')
਍䤀一匀䔀刀吀 䤀一吀伀 搀漀挀吀礀瀀攀 ⠀挀漀搀攀Ⰰ 瘀愀氀甀攀⤀ 嘀䄀䰀唀䔀匀 ⠀㘀㄀㔀Ⰰ ✀ⴀ㬄㔄㨄䈄䀄㸄㴄㴄〄伄 ∀ᴄⴄ㈀✀⤀ഀഀ

਍䤀一匀䔀刀吀 䤀一吀伀 爀愀琀攀吀礀瀀攀 ⠀椀搀刀愀琀攀吀礀瀀攀Ⰰ 瘀愀氀甀攀⤀ 嘀䄀䰀唀䔀匀 ⠀㄀Ⰰ ✀䐀䔀䌀䤀䴀䄀䰀✀⤀ഀഀ
INSERT INTO rateType (idRateType, value) VALUES (2, 'ZERO')
਍䤀一匀䔀刀吀 䤀一吀伀 爀愀琀攀吀礀瀀攀 ⠀椀搀刀愀琀攀吀礀瀀攀Ⰰ 瘀愀氀甀攀⤀ 嘀䄀䰀唀䔀匀 ⠀㌀Ⰰ ✀一伀开嘀䄀吀✀⤀ഀഀ
INSERT INTO rateType (idRateType, value) VALUES (4, 'CALCULATED')
਍ഀഀ
INSERT INTO descriptionType (idDesc, value) VALUES (1, 'DEDUCTION_IN_FULL')
਍䤀一匀䔀刀吀 䤀一吀伀 搀攀猀挀爀椀瀀琀椀漀渀吀礀瀀攀 ⠀椀搀䐀攀猀挀Ⰰ 瘀愀氀甀攀⤀ 嘀䄀䰀唀䔀匀 ⠀㈀Ⰰ ✀嘀䄀吀开䔀堀䔀䴀倀吀䤀伀一✀⤀ഀഀ
INSERT INTO descriptionType (idDesc, value) VALUES (3, 'OUTSIDE_RB')
਍䤀一匀䔀刀吀 䤀一吀伀 搀攀猀挀爀椀瀀琀椀漀渀吀礀瀀攀 ⠀椀搀䐀攀猀挀Ⰰ 瘀愀氀甀攀⤀ 嘀䄀䰀唀䔀匀 ⠀㐀Ⰰ ✀䤀䴀倀伀刀吀开嘀䄀吀✀⤀ഀഀ
