USE [mag_pbi]
GO

/****** Object:  Schema [analytics]    Script Date: 2026-02-22 11:02:26 ******/
CREATE SCHEMA [analytics]
GO
/****** Object:  Schema [artem]    Script Date: 2026-02-22 11:02:26 ******/
CREATE SCHEMA [artem]
GO
/****** Object:  Schema [ostatki]    Script Date: 2026-02-22 11:02:26 ******/
CREATE SCHEMA [ostatki]
GO
/****** Object:  Schema [pbi]    Script Date: 2026-02-22 11:02:26 ******/
CREATE SCHEMA [pbi]
GO
/****** Object:  Schema [pbiProd]    Script Date: 2026-02-22 11:02:26 ******/
CREATE SCHEMA [pbiProd]
GO
/****** Object:  Schema [sebest]    Script Date: 2026-02-22 11:02:26 ******/
CREATE SCHEMA [sebest]
GO
/****** Object:  Schema [stg]    Script Date: 2026-02-22 11:02:26 ******/
CREATE SCHEMA [stg]
GO

/****** Object:  Table [analytics].[deficit_money_request]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [analytics].[deficit_money_request](
	[id] [int] NULL IDENTITY(1,1),
	[scenario_id] [int] NULL,
	[manufacturer_id] [int] NULL,
	[contractor_1c_id] [varbinary(16)] NULL,
	[manufacturer_name] [nvarchar(255)] NULL,
	[contractor_name] [nvarchar(255)] NULL,
	[arrival_month] [date] NULL,
	[amount_rub] [numeric(19,4)] NULL,
	[amount_usd] [numeric(19,4)] NULL,
	[currency] [nvarchar(10)] NULL,
	[order_qty_total] [numeric(18,3)] NULL,
	[sku_count] [int] NULL,
	[updated_at] [datetime2(0)] NULL,
PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [analytics].[deficit_proposal]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [analytics].[deficit_proposal](
	[id] [int] NULL IDENTITY(1,1),
	[scenario_id] [int] NULL,
	[group_name] [nvarchar(100)] NULL,
	[1c_id] [binary(16)] NULL,
	[code] [nvarchar(100)] NULL,
	[place_month] [date] NULL,
	[arrival_month] [date] NULL,
	[demand_window_C] [decimal(18,3)] NULL,
	[projected_stock_at_T] [decimal(18,3)] NULL,
	[order_qty] [decimal(18,3)] NULL,
	[updated_at] [datetime2(0)] NULL,
PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [analytics].[forecast]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [analytics].[forecast](
	[id] [int] NULL IDENTITY(1,1),
	[scenario_id] [int] NULL,
	[1c_id] [binary(16)] NULL,
	[code] [nvarchar(36)] NULL,
	[month] [date] NULL,
	[value] [decimal(18,3)] NULL,
	[updated_at] [datetime2(0)] NULL,
	[updated_by] [nvarchar(128)] NULL,
	[opt] [decimal(18,3)] NULL,
	[mp] [decimal(18,3)] NULL,
PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [analytics].[forecast_history]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [analytics].[forecast_history](
	[id] [int] NULL IDENTITY(1,1),
	[forecast_id] [int] NULL,
	[scenario_id] [int] NULL,
	[1c_id] [binary(16)] NULL,
	[code] [nvarchar(36)] NULL,
	[month] [date] NULL,
	[old_value] [decimal(18,3)] NULL,
	[new_value] [decimal(18,3)] NULL,
	[changed_at] [datetime2(0)] NULL,
	[changed_by] [nvarchar(128)] NULL,
PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [analytics].[forecast_scenarios]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [analytics].[forecast_scenarios](
	[scenario_id] [int] NULL IDENTITY(1,1),
	[name] [nvarchar(200)] NULL,
	[description] [nvarchar(1000)] NULL,
	[created_at] [datetime2(0)] NULL,
	[created_by] [nvarchar(128)] NULL,
	[params_json] [nvarchar(max)] NULL,
	[active] [bit] NULL,
PRIMARY KEY CLUSTERED 
(
	[scenario_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [analytics].[load_log_w_ostatok_da_net]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [analytics].[load_log_w_ostatok_da_net](
	[id] [int] NULL IDENTITY(1,1),
	[load_time] [datetime] NULL,
	[days_back] [int] NULL,
	[rows_updated] [int] NULL,
	[duration_sec] [int] NULL,
	[created_at] [datetime] NULL,
PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [analytics].[manufacturer_counterparty_map]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [analytics].[manufacturer_counterparty_map](
	[id] [int] NULL IDENTITY(1,1),
	[manufacturer_id] [int] NULL,
	[contractor_1c_id] [binary(16)] NULL,
PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [analytics].[manufacturer_payment_stage]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [analytics].[manufacturer_payment_stage](
	[id] [int] NULL IDENTITY(1,1),
	[manufacturer_id] [int] NULL,
	[name] [nvarchar(255)] NULL,
	[days] [int] NULL,
	[percent] [decimal(9,4)] NULL,
	[sort_order] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [analytics].[manufacturers]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [analytics].[manufacturers](
	[id] [int] NULL IDENTITY(1,1),
	[manufacturer] [nvarchar(max)] NULL,
	[days_of_sales] [int] NULL,
	[logistics_days] [int] NULL,
	[roic_norm] [decimal(12,4)] NULL,
PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [analytics].[sales_weekly_features]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [analytics].[sales_weekly_features](
	[sku_id] [varbinary(16)] NULL,
	[week_start] [date] NULL,
	[qty_week] [decimal(18,4)] NULL,
	[availability_rate] [decimal(6,4)] NULL,
	[year_num] [int] NULL,
	[month_num] [tinyint] NULL,
	[iso_week] [tinyint] NULL,
	[quarter_num] [tinyint] NULL,
	[dow_monday1] [tinyint] NULL,
	[category_l1] [nvarchar(200)] NULL,
	[minAvailableQty] [decimal(18,4)] NULL,
	[lag_w1] [decimal(18,4)] NULL,
	[lag_w2] [decimal(18,4)] NULL,
	[lag_w4] [decimal(18,4)] NULL,
	[lag_w12] [decimal(18,4)] NULL,
	[lag_w26] [decimal(18,4)] NULL,
	[lag_w52] [decimal(18,4)] NULL,
	[ma4] [decimal(18,4)] NULL,
	[ma12] [decimal(18,4)] NULL,
	[created_at] [datetime2(7)] NULL,
PRIMARY KEY CLUSTERED 
(
	[sku_id] ASC,
	[week_start] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [analytics].[seasonality_groups]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [analytics].[seasonality_groups](
	[g] [varchar(255)] NULL,
	[g1] [varchar(255)] NULL,
	[month] [tinyint] NULL,
	[koef] [numeric(38,23)] NULL) ON [PRIMARY]
GO
/****** Object:  Table [analytics].[seasonality_groups_summ_1]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [analytics].[seasonality_groups_summ_1](
	[g] [varchar(255)] NULL,
	[g1] [varchar(255)] NULL,
	[month] [tinyint] NULL,
	[koef] [numeric(38,23)] NULL) ON [PRIMARY]
GO
/****** Object:  Table [analytics].[stock_balance]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [analytics].[stock_balance](
	[Дата] [date] NULL,
	[artic_id] [nvarchar(36)] NULL,
	[1c_id] [binary(16)] NULL,
	[code] [nchar(11)] NULL,
	[Остаток склад шт] [numeric(38,3)] NULL,
	[Остаток склад упак] [numeric(38,12)] NULL,
	[Остаток склад руб] [numeric(26,7)] NULL,
	[Остаток склад м3] [numeric(26,7)] NULL,
	[Остаток МП, шт] [numeric(26,7)] NULL,
	[Остаток МП, руб] [numeric(26,7)] NULL,
	[Остаток склад + МП, шт] [numeric(26,7)] NULL,
	[Остаток склад + МП, руб] [numeric(26,7)] NULL,
	[Остаток склад + в пути + произв., упак] [numeric(26,7)] NULL,
	[Остаток склад + в пути + произв., руб] [numeric(26,7)] NULL,
	[Остаток склад + МП + в пути + произв., упак] [numeric(26,7)] NULL,
	[Остаток склад + МП + в пути + произв., руб] [numeric(26,7)] NULL) ON [PRIMARY]
GO
/****** Object:  Table [analytics].[stock_plan_by_arrival]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [analytics].[stock_plan_by_arrival](
	[scenario_id] [int] NULL,
	[arrival_month] [date] NULL,
	[1c_id] [binary(16)] NULL,
	[code] [nvarchar(36)] NULL,
	[opening_qty] [decimal(18,3)] NULL,
	[inbound_confirmed] [decimal(18,3)] NULL,
	[inbound_deficit] [decimal(18,3)] NULL,
	[forecast_demand] [decimal(18,3)] NULL,
	[closing_qty] [decimal(18,3)] NULL,
	[updated_at] [datetime2(0)] NULL,
PRIMARY KEY CLUSTERED 
(
	[scenario_id] ASC,
	[arrival_month] ASC,
	[1c_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [analytics].[аналитика за 365 дн.]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [analytics].[аналитика за 365 дн.](
	[1c_id] [binary(16)] NULL,
	[Code] [nchar(11)] NULL,
	[Продано шт] [numeric(38,3)] NULL,
	[Продажи шт / день] [numeric(38,6)] NULL,
	[Остаток дней продаж] [numeric(38,6)] NULL,
	[Продажи / год, руб.] [decimal(38,2)] NULL,
	[учетная сумма / год, руб.] [decimal(38,2)] NULL,
	[ТН / год, руб.] [decimal(38,2)] NULL,
	[Стоимость МП год, руб.] [decimal(38,2)] NULL,
	[%ТН год, руб.] [decimal(38,2)] NULL,
	[Дней в продаже / год] [bigint] NULL,
	[Дней в продаже / квартал] [bigint] NULL,
	[Продажи / квартал, руб.] [decimal(38,2)] NULL,
	[учетная сумма / квартал, руб.] [decimal(38,2)] NULL,
	[ТН / квартал, руб.] [decimal(38,2)] NULL,
	[ТН / месяц, руб.] [decimal(38,6)] NULL,
	[Оплаченный остаток] [decimal(38,2)] NULL,
	[Рентабельность / год] [decimal(38,6)] NULL,
	[Рентабельность / квартал] [decimal(38,6)] NULL,
	[Рентабельность / будущий год] [decimal(38,6)] NULL,
	[Рентабельность по остатку / год] [decimal(38,6)] NULL,
	[Рентабельность по остатку / квартал] [decimal(38,6)] NULL,
	[Рентабельность по остатку / будущий год] [decimal(38,6)] NULL) ON [PRIMARY]
GO
/****** Object:  Table [analytics].[прогноз из excel]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [analytics].[прогноз из excel](
	[ut_code] [nvarchar(50)] NULL,
	[type] [nvarchar(10)] NULL,
	[forecast_month] [date] NULL,
	[forecast_value] [float] NULL,
	[user_name] [nvarchar(255)] NULL,
	[updated_at] [datetime] NULL) ON [PRIMARY]
GO
/****** Object:  Table [analytics].[срез учетных цен]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [analytics].[срез учетных цен](
	[1c_id] [binary(16)] NULL,
	[artic_id] [nvarchar(36)] NULL,
	[Учетная цена] [numeric(21,9)] NULL,
	[Учетная цена USD2+2] [numeric(21,9)] NULL,
	[Период] [nvarchar(4000)] NULL,
	[количество] [numeric(21,9)] NULL) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Turnover]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Turnover](
	[id] [int] NULL IDENTITY(1,1),
	[dt] [datetime] NULL,
	[ProductID] [int] NULL,
	[StorehouseID] [int] NULL,
	[Operation] [int] NULL,
	[Quantity] [int] NULL) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[content_rating]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[content_rating](
	[code] [varchar(50)] NULL,
	[ozon] [int] NULL,
	[wb] [int] NULL,
	[magok] [int] NULL) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[grades_quartal]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[grades_quartal](
	[name] [nvarchar(50)] NULL,
	[quartal] [nvarchar(50)] NULL,
	[subject] [nvarchar(50)] NULL,
	[grade] [int] NULL) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[lineage_edges]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[lineage_edges](
	[db_name] [nvarchar(128)] NULL,
	[from_schema] [nvarchar(128)] NULL,
	[from_object] [nvarchar(128)] NULL,
	[from_type] [nvarchar(60)] NULL,
	[to_schema] [nvarchar(128)] NULL,
	[to_object] [nvarchar(128)] NULL,
	[to_type] [nvarchar(60)] NULL,
	[edge_source] [varchar(27)] NULL) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[lineage_objects]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[lineage_objects](
	[db_name] [nvarchar(128)] NULL,
	[schema_name] [nvarchar(128)] NULL,
	[object_name] [nvarchar(128)] NULL,
	[object_type] [char(2)] NULL,
	[object_type_desc] [nvarchar(60)] NULL,
	[create_date] [datetime] NULL,
	[modify_date] [datetime] NULL) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[order_source]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[order_source](
	[order_id] [nvarchar(50)] NULL,
	[source] [nvarchar(50)] NULL,
	[campaign] [nvarchar(max)] NULL,
	[banner_group] [nvarchar(max)] NULL,
	[phrase_or_cond] [nvarchar(max)] NULL,
	[product_quantity] [nvarchar(50)] NULL,
	[product_price] [nvarchar(50)] NULL,
	[product_quantity_json] [nvarchar(max)] NULL,
	[product_price_json] [nvarchar(max)] NULL,
	[campaign_name] [nvarchar(500)] NULL,
	[banner_group_name] [nvarchar(500)] NULL) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[site_product]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[site_product](
	[code] [nvarchar(50)] NULL,
	[name] [nvarchar(255)] NULL,
	[active] [bit] NULL,
	[quantity] [int] NULL,
	[price] [decimal(18,2)] NULL,
PRIMARY KEY CLUSTERED 
(
	[code] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[yandex_direct_criteria_stats]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[yandex_direct_criteria_stats](
	[id] [int] NULL IDENTITY(1,1),
	[date] [date] NULL,
	[campaign_name] [nvarchar(500)] NULL,
	[campaign_id] [nvarchar(50)] NULL,
	[adgroup_name] [nvarchar(500)] NULL,
	[adgroup_id] [nvarchar(50)] NULL,
	[criterion] [nvarchar(1000)] NULL,
	[criterion_id] [nvarchar(50)] NULL,
	[impressions] [int] NULL,
	[clicks] [int] NULL,
	[ctr] [decimal(10,4)] NULL,
	[cost] [decimal(18,2)] NULL,
	[avg_cpc] [decimal(18,2)] NULL,
	[created_at] [datetime] NULL,
	[updated_at] [datetime] NULL,
PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [pbiProd].[GroupsOfNomenclature]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [pbiProd].[GroupsOfNomenclature](
	[artic_id] [nchar(36)] NULL,
	[2k] [int] NULL,
	[4k] [int] NULL,
	[6k] [int] NULL,
	[8k] [int] NULL,
	[10k] [int] NULL,
	[15k] [int] NULL,
	[20k] [int] NULL,
	[upload] [int] NULL) ON [PRIMARY]
GO
/****** Object:  Table [pbiProd].[Логирование]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [pbiProd].[Логирование](
	[Инфо] [nvarchar(8)] NULL,
	[Период] [datetime2(0)] NULL) ON [PRIMARY]
GO
/****** Object:  Table [pbiProd].[НоменклатураВПроизводствеПоУровням]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [pbiProd].[НоменклатураВПроизводствеПоУровням](
	[id] [int] NULL IDENTITY(1,1),
	[1c_id] [binary(16)] NULL,
	[УровеньПроизводства] [numeric(2,0)] NULL,
	[RowNum] [numeric(6,0)] NULL,
PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [pbiProd].[СебестоимостьДо2022]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [pbiProd].[СебестоимостьДо2022](
	[id] [int] NULL IDENTITY(1,1),
	[Период] [datetime2(0)] NULL,
	[Статья] [varchar(255)] NULL,
	[Вид операции] [varchar(255)] NULL,
	[Хоз операция] [varchar(255)] NULL,
	[Организация] [varchar(255)] NULL,
	[Партнер] [varchar(255)] NULL,
	[Контрагент] [varchar(255)] NULL,
	[Менеджер] [varchar(255)] NULL,
	[Тип документа] [varchar(255)] NULL,
	[Номер документа] [varchar(255)] NULL,
	[Валюта документа] [varchar(255)] NULL,
	[Ценовая группа] [varchar(255)] NULL,
	[1c_document_id] [binary(16)] NULL,
	[1c_id] [binary(16)] NULL,
	[artic_id] [nvarchar(36)] NULL,
	[Количество] [numeric(15,3)] NULL,
	[Сумма] [numeric(38,15)] NULL,
	[СуммаБезНДС] [numeric(38,15)] NULL,
	[СуммаРучнойСкидки] [numeric(38,15)] NULL,
	[СуммаАвтоСкидки] [numeric(38,15)] NULL,
	[Закупка] [numeric(38,15)] NULL,
	[Закупка, usd2] [numeric(38,15)] NULL,
	[Курс usd2] [numeric(15,3)] NULL,
	[Курс usd] [numeric(15,3)] NULL,
	[Таможня] [numeric(38,15)] NULL,
	[ЕАЭС] [numeric(38,15)] NULL,
	[Учетная цена] [numeric(38,15)] NULL,
	[Учетная цена USD2+2] [numeric(38,15)] NULL,
	[Заказ закрыт] [datetime] NULL,
	[Номер заказа] [nchar(11)] NULL,
	[Маркетинг] [numeric(38,15)] NULL,
	[Доставка] [numeric(38,15)] NULL,
	[НДС] [numeric(38,15)] NULL,
	[Производство] [numeric(38,15)] NULL,
	[ЗатратыМП] [numeric(38,15)] NULL,
	[PartnerId] [nvarchar(36)] NULL,
	[Учетная стоимость] [numeric(38,15)] NULL,
	[Учетная стоимость USD2+2] [numeric(38,15)] NULL,
	[Номер регистратора] [nchar(10)] NULL,
PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [pbiProd].[СебестоимостьИтогиДо2022]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [pbiProd].[СебестоимостьИтогиДо2022](
	[id] [int] NULL IDENTITY(1,1),
	[artic_id] [nvarchar(36)] NULL,
	[Количество] [numeric(15,3)] NULL,
	[Сумма] [numeric(38,15)] NULL,
	[СуммаБезНДС] [numeric(38,15)] NULL,
	[СуммаРучнойСкидки] [numeric(38,15)] NULL,
	[СуммаАвтоСкидки] [numeric(38,15)] NULL,
	[Закупка] [numeric(38,15)] NULL,
	[Закупка, usd2] [numeric(38,15)] NULL,
	[Таможня] [numeric(38,15)] NULL,
	[ЕАЭС] [numeric(38,15)] NULL,
	[Учетная цена] [numeric(38,15)] NULL,
	[Учетная цена USD2+2] [numeric(38,15)] NULL,
	[Доставка] [numeric(38,15)] NULL,
	[НДС] [numeric(38,15)] NULL,
	[Сборка] [numeric(38,15)] NULL,
	[ЗатратыМП] [numeric(38,15)] NULL,
	[Учетная стоимость] [numeric(38,15)] NULL,
	[Учетная стоимость USD2+2] [numeric(38,15)] NULL,
	[1c_id] [binary(16)] NULL,
PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [pbiProd].[СебестоимостьОт2022]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [pbiProd].[СебестоимостьОт2022](
	[id] [int] NULL IDENTITY(1,1),
	[Период] [datetime2(0)] NULL,
	[Статья] [varchar(50)] NULL,
	[Вид операции] [varchar(25)] NULL,
	[Хоз операция] [varchar(50)] NULL,
	[Организация] [varchar(255)] NULL,
	[Партнер] [varchar(255)] NULL,
	[Контрагент] [varchar(255)] NULL,
	[Менеджер] [varchar(255)] NULL,
	[Тип документа] [varchar(50)] NULL,
	[Номер документа] [varchar(25)] NULL,
	[Валюта документа] [varchar(25)] NULL,
	[Ценовая группа] [varchar(25)] NULL,
	[1c_document_id] [binary(16)] NULL,
	[1c_id] [binary(16)] NULL,
	[artic_id] [nvarchar(36)] NULL,
	[Количество] [numeric(15,3)] NULL,
	[Сумма] [numeric(21,9)] NULL,
	[СуммаБезНДС] [numeric(21,9)] NULL,
	[СуммаРучнойСкидки] [numeric(21,9)] NULL,
	[СуммаАвтоСкидки] [numeric(21,9)] NULL,
	[Закупка] [numeric(21,9)] NULL,
	[Закупка, usd2] [numeric(21,9)] NULL,
	[Курс usd2] [numeric(15,3)] NULL,
	[Курс usd] [numeric(15,3)] NULL,
	[Таможня] [numeric(21,9)] NULL,
	[ЕАЭС] [numeric(21,9)] NULL,
	[Учетная цена] [numeric(21,9)] NULL,
	[Учетная цена USD2+2] [numeric(21,9)] NULL,
	[Заказ закрыт] [datetime] NULL,
	[Номер заказа] [nchar(11)] NULL,
	[Маркетинг] [numeric(21,9)] NULL,
	[Доставка] [numeric(21,9)] NULL,
	[НДС] [numeric(21,9)] NULL,
	[Производство] [numeric(21,9)] NULL,
	[ЗатратыМП] [numeric(21,9)] NULL,
	[PartnerId] [nvarchar(36)] NULL,
	[Учетная стоимость] [numeric(21,9)] NULL,
	[Учетная стоимость USD2+2] [numeric(21,9)] NULL,
	[Номер регистратора] [nchar(10)] NULL,
	[ЗатратыСкладХранение] [numeric(21,9)] NULL,
	[ЗатратыСкладЗарплата] [numeric(21,9)] NULL,
	[Приемка] [numeric(21,9)] NULL,
	[АтсМаркировка] [numeric(21,9)] NULL,
	[ВремяВыполненияМинут] [numeric(21,9)] NULL,
	[СборкаЗаказа] [numeric(21,9)] NULL,
	[Доставка USD2+2] [numeric(21,9)] NULL,
	[НДС USD2+2] [numeric(21,9)] NULL,
	[Таможня USD2+2] [numeric(21,9)] NULL,
	[Производство USD2+2] [numeric(21,9)] NULL,
	[КоличествоУпаковок] [numeric(15,3)] NULL,
	[Сумма скидки] [numeric(21,9)] NULL,
	[Сумма скидки USD2+2] [numeric(21,9)] NULL,
	[Доп расходы] [numeric(21,9)] NULL,
	[Доп расходы USD2+2] [numeric(21,9)] NULL,
PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [pbiProd].[СебестоимостьПроизводствоОт2022]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [pbiProd].[СебестоимостьПроизводствоОт2022](
	[id] [int] NULL IDENTITY(1,1),
	[Период] [datetime2(0)] NULL,
	[1c_id] [binary(16)] NULL,
	[artic_id] [nvarchar(36)] NULL,
	[Учетная цена] [numeric(21,9)] NULL,
	[Учетная цена USD2+2] [numeric(21,9)] NULL,
PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [pbiProd].[СебестоимостьСводныйОт2022]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [pbiProd].[СебестоимостьСводныйОт2022](
	[id] [int] NULL IDENTITY(1,1),
	[Период] [datetime2(0)] NULL,
	[Статья] [varchar(50)] NULL,
	[Вид операции] [varchar(25)] NULL,
	[Хоз операция] [varchar(50)] NULL,
	[Организация] [varchar(255)] NULL,
	[Партнер] [varchar(255)] NULL,
	[Контрагент] [varchar(255)] NULL,
	[Менеджер] [varchar(255)] NULL,
	[Тип документа] [varchar(50)] NULL,
	[Номер документа] [varchar(25)] NULL,
	[Валюта документа] [varchar(25)] NULL,
	[Ценовая группа] [varchar(25)] NULL,
	[1c_document_id] [binary(16)] NULL,
	[1c_id] [binary(16)] NULL,
	[artic_id] [nvarchar(36)] NULL,
	[Количество] [numeric(15,3)] NULL,
	[Сумма] [numeric(21,9)] NULL,
	[СуммаБезНДС] [numeric(21,9)] NULL,
	[СуммаРучнойСкидки] [numeric(21,9)] NULL,
	[СуммаАвтоСкидки] [numeric(21,9)] NULL,
	[Закупка] [numeric(21,9)] NULL,
	[Закупка, usd2] [numeric(21,9)] NULL,
	[Курс usd2] [numeric(15,3)] NULL,
	[Курс usd] [numeric(15,3)] NULL,
	[Таможня] [numeric(21,9)] NULL,
	[ЕАЭС] [numeric(21,9)] NULL,
	[Учетная цена] [numeric(21,9)] NULL,
	[Учетная цена USD2+2] [numeric(21,9)] NULL,
	[Заказ закрыт] [datetime] NULL,
	[Номер заказа] [nchar(11)] NULL,
	[Маркетинг] [numeric(21,9)] NULL,
	[Доставка] [numeric(21,9)] NULL,
	[НДС] [numeric(21,9)] NULL,
	[Производство] [numeric(21,9)] NULL,
	[ЗатратыМП] [numeric(21,9)] NULL,
	[PartnerId] [nvarchar(36)] NULL,
	[Учетная стоимость] [numeric(21,9)] NULL,
	[Учетная стоимость USD2+2] [numeric(21,9)] NULL,
	[Номер регистратора] [nchar(10)] NULL,
	[Code] [nchar(11)] NULL,
	[ЗатратыСкладХранение] [numeric(21,9)] NULL,
	[Приемка] [numeric(21,9)] NULL,
	[АтсМаркировка] [numeric(21,9)] NULL,
	[ВремяВыполненияМинут] [numeric(21,9)] NULL,
	[СборкаЗаказа] [numeric(21,9)] NULL,
	[КоличествоУпаковок] [numeric(15,3)] NULL,
	[Сумма скидки] [numeric(21,9)] NULL,
	[Сумма скидки USD2+2] [numeric(21,9)] NULL,
	[Доп расходы] [numeric(21,9)] NULL,
	[Доп расходы USD2+2] [numeric(21,9)] NULL,
PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [pbiProd].[СебестоимостьСводныйОт2022_copy_2025-03-26]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [pbiProd].[СебестоимостьСводныйОт2022_copy_2025-03-26](
	[id] [int] NULL IDENTITY(1,1),
	[Период] [datetime2(0)] NULL,
	[Статья] [varchar(50)] NULL,
	[Вид операции] [varchar(25)] NULL,
	[Хоз операция] [varchar(50)] NULL,
	[Организация] [varchar(255)] NULL,
	[Партнер] [varchar(255)] NULL,
	[Контрагент] [varchar(255)] NULL,
	[Менеджер] [varchar(255)] NULL,
	[Тип документа] [varchar(50)] NULL,
	[Номер документа] [varchar(25)] NULL,
	[Валюта документа] [varchar(25)] NULL,
	[Ценовая группа] [varchar(25)] NULL,
	[1c_document_id] [binary(16)] NULL,
	[1c_id] [binary(16)] NULL,
	[artic_id] [nvarchar(36)] NULL,
	[Количество] [numeric(15,3)] NULL,
	[Сумма] [numeric(21,9)] NULL,
	[СуммаБезНДС] [numeric(21,9)] NULL,
	[СуммаРучнойСкидки] [numeric(21,9)] NULL,
	[СуммаАвтоСкидки] [numeric(21,9)] NULL,
	[Закупка] [numeric(21,9)] NULL,
	[Закупка, usd2] [numeric(21,9)] NULL,
	[Курс usd2] [numeric(15,3)] NULL,
	[Курс usd] [numeric(15,3)] NULL,
	[Таможня] [numeric(21,9)] NULL,
	[ЕАЭС] [numeric(21,9)] NULL,
	[Учетная цена] [numeric(21,9)] NULL,
	[Учетная цена USD2+2] [numeric(21,9)] NULL,
	[Заказ закрыт] [datetime] NULL,
	[Номер заказа] [nchar(11)] NULL,
	[Маркетинг] [numeric(21,9)] NULL,
	[Доставка] [numeric(21,9)] NULL,
	[НДС] [numeric(21,9)] NULL,
	[Производство] [numeric(21,9)] NULL,
	[ЗатратыМП] [numeric(21,9)] NULL,
	[PartnerId] [nvarchar(36)] NULL,
	[Учетная стоимость] [numeric(21,9)] NULL,
	[Учетная стоимость USD2+2] [numeric(21,9)] NULL,
	[Номер регистратора] [nchar(10)] NULL,
	[Code] [nchar(11)] NULL,
	[ЗатратыСкладХранение] [numeric(21,9)] NULL,
	[Приемка] [numeric(21,9)] NULL,
	[АтсМаркировка] [numeric(21,9)] NULL,
	[ВремяВыполненияМинут] [numeric(21,9)] NULL,
	[СборкаЗаказа] [numeric(21,9)] NULL,
	[КоличествоУпаковок] [numeric(15,3)] NULL) ON [PRIMARY]
GO
/****** Object:  Table [pbiProd].[СебестоимостьСводныйОт2022_copy_for_pbi]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [pbiProd].[СебестоимостьСводныйОт2022_copy_for_pbi](
	[id] [int] NULL,
	[Период] [datetime2(0)] NULL,
	[Статья] [varchar(50)] NULL,
	[Вид операции] [varchar(25)] NULL,
	[Хоз операция] [varchar(50)] NULL,
	[Организация] [varchar(255)] NULL,
	[Партнер] [varchar(255)] NULL,
	[Контрагент] [varchar(255)] NULL,
	[Менеджер] [varchar(255)] NULL,
	[Тип документа] [varchar(50)] NULL,
	[Номер документа] [varchar(25)] NULL,
	[Валюта документа] [varchar(25)] NULL,
	[Ценовая группа] [varchar(25)] NULL,
	[1c_document_id] [binary(16)] NULL,
	[1c_id] [binary(16)] NULL,
	[artic_id] [nvarchar(36)] NULL,
	[Количество] [numeric(15,3)] NULL,
	[Сумма] [numeric(21,9)] NULL,
	[СуммаБезНДС] [numeric(21,9)] NULL,
	[СуммаРучнойСкидки] [numeric(21,9)] NULL,
	[СуммаАвтоСкидки] [numeric(21,9)] NULL,
	[Закупка] [numeric(21,9)] NULL,
	[Закупка, usd2] [numeric(21,9)] NULL,
	[Курс usd2] [numeric(15,3)] NULL,
	[Курс usd] [numeric(15,3)] NULL,
	[Таможня] [numeric(21,9)] NULL,
	[ЕАЭС] [numeric(21,9)] NULL,
	[Учетная цена] [numeric(21,9)] NULL,
	[Учетная цена USD2+2] [numeric(21,9)] NULL,
	[Заказ закрыт] [datetime] NULL,
	[Номер заказа] [nchar(11)] NULL,
	[Маркетинг] [numeric(21,9)] NULL,
	[Доставка] [numeric(21,9)] NULL,
	[НДС] [numeric(21,9)] NULL,
	[Производство] [numeric(21,9)] NULL,
	[ЗатратыМП] [numeric(21,9)] NULL,
	[PartnerId] [nvarchar(36)] NULL,
	[Учетная стоимость] [numeric(21,9)] NULL,
	[Учетная стоимость USD2+2] [numeric(21,9)] NULL,
	[Номер регистратора] [nchar(10)] NULL,
	[Code] [nchar(11)] NULL,
	[ЗатратыСкладХранение] [numeric(21,9)] NULL,
	[Приемка] [numeric(21,9)] NULL,
	[АтсМаркировка] [numeric(21,9)] NULL,
	[ВремяВыполненияМинут] [numeric(21,9)] NULL,
	[СборкаЗаказа] [numeric(21,9)] NULL,
	[КоличествоУпаковок] [numeric(15,3)] NULL,
	[Сумма скидки] [numeric(21,9)] NULL,
	[Сумма скидки USD2+2] [numeric(21,9)] NULL,
	[Доп расходы] [numeric(21,9)] NULL,
	[Доп расходы USD2+2] [numeric(21,9)] NULL,
	[Учетная сумма, руб] [decimal(21,9)] NULL,
	[Учетная сумма, usd] [decimal(21,9)] NULL,
	[Источник заказа] [nvarchar(50)] NULL) ON [PRIMARY]
GO
/****** Object:  Table [pbiProd].[УчетнаяЦенаПоСебестоимости]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [pbiProd].[УчетнаяЦенаПоСебестоимости](
	[artic_id] [nvarchar(36)] NULL,
	[Учетная цена] [numeric(15,6)] NULL,
	[Учетная цена USD2+2] [numeric(15,9)] NULL,
	[Период] [datetime2(0)] NULL) ON [PRIMARY]
GO
/****** Object:  Table [pbi].[Turnover]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [pbi].[Turnover](
	[id] [int] NULL IDENTITY(1,1),
	[dt] [datetime] NULL,
	[ProductID] [int] NULL,
	[StorehouseID] [int] NULL,
	[Operation] [int] NULL,
	[Quantity] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [pbi].[content_rating]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [pbi].[content_rating](
	[code] [varchar(50)] NULL,
	[ozon] [int] NULL,
	[wb] [int] NULL,
	[wb_by_ozon] [int] NULL,
	[magok] [int] NULL) ON [PRIMARY]
GO
/****** Object:  Table [pbi].[direct_adv_costs]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [pbi].[direct_adv_costs](
	[Дата] [datetime2(0)] NULL,
	[Кампания] [nvarchar(255)] NULL,
	[N кампании] [nvarchar(50)] NULL,
	[Группа] [nvarchar(255)] NULL,
	[N группы] [nvarchar(50)] NULL,
	[Условия показа] [nvarchar(255)] NULL,
	[N условия показа] [nvarchar(50)] NULL,
	[Показы] [int] NULL,
	[Клики] [int] NULL,
	[CTR, %] [decimal(18,2)] NULL,
	[Расход, руб] [decimal(18,2)] NULL,
	[Ср. цена клика, руб] [decimal(18,2)] NULL) ON [PRIMARY]
GO
/****** Object:  Table [pbi].[direct_orders]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [pbi].[direct_orders](
	[Кампания] [nvarchar(255)] NULL,
	[Группа] [nvarchar(255)] NULL,
	[Условия показа] [nvarchar(255)] NULL,
	[ID покупки] [nvarchar(50)] NULL,
	[Количество покупок] [int] NULL,
	[Доход, руб] [decimal(18,2)] NULL) ON [PRIMARY]
GO
/****** Object:  Table [pbi].[enums]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [pbi].[enums](
	[_IDRref] [binary(16)] NULL,
	[value] [nvarchar(150)] NULL,
	[enum] [nvarchar(50)] NULL) ON [PRIMARY]
GO
/****** Object:  Table [pbi].[groups]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [pbi].[groups](
	[_Description] [varchar(255)] NULL,
	[g] [varchar(255)] NULL,
	[g1] [varchar(255)] NULL,
	[g2] [varchar(255)] NULL,
	[g3] [varchar(255)] NULL,
	[group_id] [nvarchar(36)] NULL,
	[_ParentIDRRef] [nvarchar(36)] NULL,
	[lvl] [int] NULL,
	[path] [varchar(255)] NULL,
	[code] [nchar(11)] NULL,
	[1c_id] [binary(16)] NULL,
	[план] [float] NULL,
	[first group] [nvarchar(36)] NULL) ON [PRIMARY]
GO
/****** Object:  Table [pbi].[nomenclatureVolumeStorehouse]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [pbi].[nomenclatureVolumeStorehouse](
	[Период] [datetime2(0)] NULL,
	[balance] [numeric(15,5)] NULL,
	[1c_id] [binary(16)] NULL,
	[storehouse] [binary(16)] NULL,
	[volume] [numeric(15,5)] NULL,
	[totalVolume] [numeric(15,5)] NULL) ON [PRIMARY]
GO
/****** Object:  Table [pbi].[nomenclature]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [pbi].[nomenclature](
	[artic_id] [nvarchar(36)] NULL,
	[1c_id] [binary(16)] NULL,
	[code] [nchar(11)] NULL,
	[cenovaya_gruppa] [varchar(12)] NULL,
	[description] [nvarchar(150)] NULL,
	[artic] [nvarchar(50)] NULL,
	[vid_nomen] [binary(16)] NULL,
	[Производитель] [nvarchar(max)] NULL,
	[group_id] [nvarchar(36)] NULL,
	[1c_group] [binary(16)] NULL,
	[card] [nvarchar(max)] NULL,
	[photo] [nvarchar(max)] NULL,
	[base] [int] NULL,
	[Знаменатель веса] [numeric(15,3)] NULL,
	[Числитель веса] [numeric(15,4)] NULL,
	[Знаменатель объема] [numeric(15,3)] NULL,
	[Числитель объема] [numeric(15,6)] NULL,
	[Количество упак в коробе] [numeric(10,0)] NULL,
	[Количество упак в кванте] [numeric(10,0)] NULL,
	[id magok] [nvarchar(15)] NULL,
	[Товарныйменеджера] [nvarchar(1024)] NULL,
	[МенеджерПоЗакупкам2] [nvarchar(1024)] NULL,
	[РуководительНаправления] [nvarchar(1024)] NULL,
	[Менеджер OZON] [nvarchar(1024)] NULL,
	[Менеджер WB] [nvarchar(1024)] NULL,
	[АБС статус] [nvarchar(1024)] NULL,
	[АБС план] [nvarchar(1024)] NULL,
	[ABC Парето] [nvarchar(1024)] NULL,
	[XYZ статус 12м] [nvarchar(1024)] NULL,
	[Комментарий для матрицы] [nvarchar(1024)] NULL,
	[Коллекция] [nvarchar(1024)] NULL,
	[Ценовой сегмент Магок] [nvarchar(1024)] NULL,
	[Ценовой сегмент МП] [nvarchar(1024)] NULL,
	[Кол-во упак в заказе Магок] [nvarchar(1024)] NULL,
	[Бренд] [nvarchar(1024)] NULL,
	[Тип товара] [nvarchar(1024)] NULL,
	[Метка] [nvarchar(1024)] NULL,
	[Ширина, мм] [nvarchar(1024)] NULL,
	[Цвет] [nvarchar(1024)] NULL,
	[Номер цвета] [nvarchar(1024)] NULL,
	[Тип шнура] [nvarchar(1024)] NULL,
	[Тип плетения] [nvarchar(1024)] NULL,
	[Размер] [nvarchar(1024)] NULL,
	[Особенность] [nvarchar(1024)] NULL,
	[Форма] [nvarchar(1024)] NULL,
	[Ширина] [nvarchar(1024)] NULL,
	[Формат упаковки] [nvarchar(1024)] NULL,
	[Макс. запас] [nvarchar(1024)] NULL,
	[Мин. запас] [nvarchar(1024)] NULL,
	[QTY PACKS] [nvarchar(1024)] NULL,
	[Да/Нет Собственное пр-во] [nvarchar(1024)] NULL,
	[ID OZON] [nvarchar(1024)] NULL,
	[ID WB] [nvarchar(1024)] NULL,
	[WB] [nvarchar(1024)] NULL,
	[Ozon] [nvarchar(1024)] NULL,
	[СТМ] [nvarchar(1024)] NULL,
	[Выгружать на я.маркет] [nvarchar(1024)] NULL,
	[Выгружать в Google Merchant] [nvarchar(1024)] NULL,
	[Товар МП] [nvarchar(1024)] NULL,
	[Неликвид] [nvarchar(1024)] NULL,
	[Статус] [nvarchar(1024)] NULL,
	[Сквозной цвет] [nvarchar(1024)] NULL,
	[Базовая упаковка] [numeric(15,3)] NULL,
	[Качество контента Ozon] [int] NULL,
	[Качество контента WB] [int] NULL,
	[Качество контента WB by Ozon] [int] NULL,
	[Качество контента Magok] [int] NULL,
	[Вид номенклатуры] [nvarchar(50)] NULL,
	[max_year_quantity] [numeric(38,3)] NULL,
	[max_quarter_quantity] [numeric(38,3)] NULL,
	[Цена учетная, руб] [decimal(18,7)] NULL,
	[Цена учетная, usd] [decimal(18,7)] NULL,
	[СредниеМесячныеПродажи] [float] NULL,
	[СКО_МесячныхПродаж] [float] NULL,
	[minAvailableQty] [decimal(18,4)] NULL) ON [PRIMARY]
GO
/****** Object:  Table [pbi].[ostatki]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [pbi].[ostatki](
	[artic_id] [nvarchar(36)] NULL,
	[1c_id] [binary(16)] NULL,
	[Code] [nchar(11)] NULL,
	[sklad] [nvarchar(50)] NULL,
	[Категория склада] [varchar(15)] NULL,
	[upakovok] [numeric(38,12)] NULL,
	[quantity] [numeric(26,3)] NULL,
	[upakovka] [numeric(15,3)] NULL,
	[date] [datetime2(0)] NULL,
	[Учетная цена по себест] [numeric(38,15)] NULL,
	[Учетная цена по себест, usd2+2] [numeric(38,15)] NULL,
	[Учетная цена, старое] [numeric(38,15)] NULL,
	[upakovok_ship] [numeric(38,15)] NULL,
	[quantity_ship] [numeric(38,15)] NULL) ON [PRIMARY]
GO
/****** Object:  Table [pbi].[ostatki_mp]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [pbi].[ostatki_mp](
	[Дата] [date] NULL,
	[Узел] [nvarchar(100)] NULL,
	[artic_id] [nvarchar(36)] NULL,
	[id_внешний] [nvarchar(36)] NULL,
	[Остаток МП, упак] [decimal(18,3)] NULL,
	[Доступно МП, упак] [decimal(18,3)] NULL,
	[Остаток МП, шт] [decimal(18,3)] NULL) ON [PRIMARY]
GO
/****** Object:  Table [pbi].[ostatki_short]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [pbi].[ostatki_short](
	[artic_id] [nvarchar(36)] NULL,
	[1c_id] [binary(16)] NULL,
	[Code] [nchar(11)] NULL,
	[sklad] [nvarchar(50)] NULL,
	[Категория склада] [varchar(15)] NULL,
	[upakovok] [numeric(38,12)] NULL,
	[quantity] [numeric(38,3)] NULL,
	[upakovka] [numeric(38,6)] NULL,
	[date] [datetime] NULL,
	[Учетная цена, старое] [numeric(38,15)] NULL,
	[upakovok_ship] [numeric(38,15)] NULL,
	[quantity_ship] [numeric(38,15)] NULL) ON [PRIMARY]
GO
/****** Object:  Table [pbi].[pricelist]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [pbi].[pricelist](
	[Цена] [numeric(15,6)] NULL,
	[Вид цены] [nvarchar(50)] NULL,
	[1c_id] [binary(16)] NULL,
	[artic_id] [nvarchar(36)] NULL,
	[Дата] [datetime2(0)] NULL,
	[_Period] [datetime2(0)] NULL) ON [PRIMARY]
GO
/****** Object:  Table [pbi].[w_ostatok_da_net]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [pbi].[w_ostatok_da_net](
	[dt] [date] NULL,
	[_IDRREF] [binary(16)] NULL,
	[artic_id] [nvarchar(36)] NULL,
	[minAvailableQty] [decimal(18,4)] NULL,
	[ostatok] [numeric(15,6)] NULL,
	[quantity] [numeric(15,6)] NULL,
	[upakovok] [numeric(15,6)] NULL,
	[sellable_stock] [decimal(18,6)] NULL,
	[quantity_mp] [numeric(15,6)] NULL,
	[upakovok_mp] [numeric(15,6)] NULL,
	[dostupno_upakovok_mp] [numeric(15,6)] NULL,
	[ostatok_mp] [numeric(15,6)] NULL,
	[ostatok_all] [numeric(15,6)] NULL) ON [PRIMARY]
GO
/****** Object:  Table [pbi].[Себестоимость2023]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [pbi].[Себестоимость2023](
	[id] [int] NULL IDENTITY(1,1),
	[Период] [datetime2(0)] NULL,
	[Статья] [varchar(255)] NULL,
	[Вид операции] [varchar(255)] NULL,
	[Хоз операция] [varchar(255)] NULL,
	[Организация] [varchar(255)] NULL,
	[Партнер] [varchar(255)] NULL,
	[Контрагент] [varchar(255)] NULL,
	[Менеджер] [varchar(255)] NULL,
	[Тип документа] [varchar(255)] NULL,
	[Номер документа] [varchar(255)] NULL,
	[Валюта документа] [varchar(255)] NULL,
	[Ценовая группа] [varchar(255)] NULL,
	[1c_document_id] [binary(16)] NULL,
	[1c_id] [binary(16)] NULL,
	[artic_id] [nvarchar(36)] NULL,
	[Количество] [numeric(15,3)] NULL,
	[Сумма] [numeric(38,15)] NULL,
	[СуммаБезНДС] [numeric(38,15)] NULL,
	[СуммаРучнойСкидки] [numeric(38,15)] NULL,
	[СуммаАвтоСкидки] [numeric(38,15)] NULL,
	[Закупка] [numeric(38,15)] NULL,
	[Закупка, usd2] [numeric(38,15)] NULL,
	[Курс usd2] [numeric(15,3)] NULL,
	[Курс usd] [numeric(15,3)] NULL,
	[Таможня] [numeric(38,15)] NULL,
	[ЕАЭС] [numeric(38,15)] NULL,
	[Учетная цена] [numeric(38,15)] NULL,
	[Учетная цена USD2+2] [numeric(38,15)] NULL,
	[Заказ закрыт] [datetime] NULL,
	[Номер заказа] [nchar(11)] NULL,
	[Маркетинг] [numeric(38,15)] NULL,
	[Доставка] [numeric(38,15)] NULL,
	[НДС] [numeric(38,15)] NULL,
	[Сборка] [numeric(38,15)] NULL,
	[ЗатратыМП] [numeric(38,15)] NULL,
	[PartnerId] [nvarchar(36)] NULL,
	[Учетная стоимость] [numeric(38,15)] NULL,
	[Учетная стоимость USD2+2] [numeric(38,15)] NULL,
	[Номер регистратора] [nchar(10)] NULL,
	[ЗатратыСкладХранение] [numeric(38,15)] NULL,
	[ЗатратыСкладЗарплата] [numeric(38,15)] NULL,
	[Приемка] [numeric(38,15)] NULL,
	[АтсМаркировка] [numeric(38,15)] NULL,
	[ВремяВыполненияМинут] [numeric(38,15)] NULL,
	[СборкаЗаказа] [numeric(38,15)] NULL,
PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [pbi].[Себестоимость2024]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [pbi].[Себестоимость2024](
	[id] [int] NULL IDENTITY(1,1),
	[Период] [datetime2(0)] NULL,
	[Статья] [varchar(255)] NULL,
	[Вид операции] [varchar(255)] NULL,
	[Хоз операция] [varchar(255)] NULL,
	[Организация] [varchar(255)] NULL,
	[Партнер] [varchar(255)] NULL,
	[Контрагент] [varchar(255)] NULL,
	[Менеджер] [varchar(255)] NULL,
	[Тип документа] [varchar(255)] NULL,
	[Номер документа] [varchar(255)] NULL,
	[Валюта документа] [varchar(255)] NULL,
	[Ценовая группа] [varchar(255)] NULL,
	[1c_document_id] [binary(16)] NULL,
	[1c_id] [binary(16)] NULL,
	[artic_id] [nvarchar(36)] NULL,
	[Количество] [numeric(15,3)] NULL,
	[Сумма] [numeric(38,15)] NULL,
	[СуммаБезНДС] [numeric(38,15)] NULL,
	[СуммаРучнойСкидки] [numeric(38,15)] NULL,
	[СуммаАвтоСкидки] [numeric(38,15)] NULL,
	[Закупка] [numeric(38,15)] NULL,
	[Закупка, usd2] [numeric(38,15)] NULL,
	[Курс usd2] [numeric(15,3)] NULL,
	[Курс usd] [numeric(15,3)] NULL,
	[Таможня] [numeric(38,15)] NULL,
	[ЕАЭС] [numeric(38,15)] NULL,
	[Учетная цена] [numeric(38,15)] NULL,
	[Учетная цена USD2+2] [numeric(38,15)] NULL,
	[Заказ закрыт] [datetime] NULL,
	[Номер заказа] [nchar(11)] NULL,
	[Маркетинг] [numeric(38,15)] NULL,
	[Доставка] [numeric(38,15)] NULL,
	[НДС] [numeric(38,15)] NULL,
	[Сборка] [numeric(38,15)] NULL,
	[ЗатратыМП] [numeric(38,15)] NULL,
	[PartnerId] [nvarchar(36)] NULL,
	[Учетная стоимость] [numeric(38,15)] NULL,
	[Учетная стоимость USD2+2] [numeric(38,15)] NULL,
	[Номер регистратора] [nchar(10)] NULL,
	[ЗатратыСкладХранение] [numeric(38,15)] NULL,
	[ЗатратыСкладЗарплата] [numeric(38,15)] NULL,
	[Приемка] [numeric(38,15)] NULL,
	[АтсМаркировка] [numeric(38,15)] NULL,
	[ВремяВыполненияМинут] [numeric(38,15)] NULL,
	[СборкаЗаказа] [numeric(38,15)] NULL,
PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [pbi].[Себестоимость]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [pbi].[Себестоимость](
	[id] [int] NULL IDENTITY(1,1),
	[Период] [datetime2(0)] NULL,
	[Статья] [varchar(255)] NULL,
	[Вид операции] [varchar(255)] NULL,
	[Хоз операция] [varchar(255)] NULL,
	[Организация] [varchar(255)] NULL,
	[Партнер] [varchar(255)] NULL,
	[Контрагент] [varchar(255)] NULL,
	[Менеджер] [varchar(255)] NULL,
	[Тип документа] [varchar(255)] NULL,
	[Номер документа] [varchar(255)] NULL,
	[Валюта документа] [varchar(255)] NULL,
	[Ценовая группа] [varchar(255)] NULL,
	[1c_document_id] [binary(16)] NULL,
	[1c_id] [binary(16)] NULL,
	[artic_id] [nvarchar(36)] NULL,
	[Количество] [numeric(15,3)] NULL,
	[Сумма] [numeric(38,15)] NULL,
	[СуммаБезНДС] [numeric(38,15)] NULL,
	[СуммаРучнойСкидки] [numeric(38,15)] NULL,
	[СуммаАвтоСкидки] [numeric(38,15)] NULL,
	[Закупка] [numeric(38,15)] NULL,
	[Закупка, usd2] [numeric(38,15)] NULL,
	[Курс usd2] [numeric(15,3)] NULL,
	[Курс usd] [numeric(15,3)] NULL,
	[Таможня] [numeric(38,15)] NULL,
	[ЕАЭС] [numeric(38,15)] NULL,
	[Учетная цена] [numeric(38,15)] NULL,
	[Учетная цена USD2+2] [numeric(38,15)] NULL,
	[Заказ закрыт] [datetime] NULL,
	[Номер заказа] [nchar(11)] NULL,
	[Маркетинг] [numeric(38,15)] NULL,
	[Доставка] [numeric(38,15)] NULL,
	[НДС] [numeric(38,15)] NULL,
	[Сборка] [numeric(38,15)] NULL,
	[ЗатратыМП] [numeric(38,15)] NULL,
	[PartnerId] [nvarchar(36)] NULL,
	[Учетная стоимость] [numeric(38,15)] NULL,
	[Учетная стоимость USD2+2] [numeric(38,15)] NULL,
	[Номер регистратора] [nchar(10)] NULL,
PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [pbi].[СебестоимостьДо2022Тест]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [pbi].[СебестоимостьДо2022Тест](
	[id] [int] NULL IDENTITY(1,1),
	[Период] [datetime2(0)] NULL,
	[Статья] [varchar(255)] NULL,
	[Вид операции] [varchar(255)] NULL,
	[Хоз операция] [varchar(255)] NULL,
	[Организация] [varchar(255)] NULL,
	[Партнер] [varchar(255)] NULL,
	[Контрагент] [varchar(255)] NULL,
	[Менеджер] [varchar(255)] NULL,
	[Тип документа] [varchar(255)] NULL,
	[Номер документа] [varchar(255)] NULL,
	[Валюта документа] [varchar(255)] NULL,
	[Ценовая группа] [varchar(255)] NULL,
	[1c_document_id] [binary(16)] NULL,
	[1c_id] [binary(16)] NULL,
	[artic_id] [nvarchar(36)] NULL,
	[Количество] [numeric(15,3)] NULL,
	[Сумма] [numeric(38,15)] NULL,
	[СуммаБезНДС] [numeric(38,15)] NULL,
	[СуммаРучнойСкидки] [numeric(38,15)] NULL,
	[СуммаАвтоСкидки] [numeric(38,15)] NULL,
	[Закупка] [numeric(38,15)] NULL,
	[Закупка, usd2] [numeric(38,15)] NULL,
	[Курс usd2] [numeric(15,3)] NULL,
	[Курс usd] [numeric(15,3)] NULL,
	[Таможня] [numeric(38,15)] NULL,
	[ЕАЭС] [numeric(38,15)] NULL,
	[Учетная цена] [numeric(38,15)] NULL,
	[Учетная цена USD2+2] [numeric(38,15)] NULL,
	[Заказ закрыт] [datetime] NULL,
	[Номер заказа] [nchar(11)] NULL,
	[Маркетинг] [numeric(38,15)] NULL,
	[Доставка] [numeric(38,15)] NULL,
	[НДС] [numeric(38,15)] NULL,
	[Производство] [numeric(38,15)] NULL,
	[ЗатратыМП] [numeric(38,15)] NULL,
	[PartnerId] [nvarchar(36)] NULL,
	[Учетная стоимость] [numeric(38,15)] NULL,
	[Учетная стоимость USD2+2] [numeric(38,15)] NULL,
	[Номер регистратора] [nchar(10)] NULL,
PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [pbi].[СебестоимостьПродажи]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [pbi].[СебестоимостьПродажи](
	[id] [int] NULL IDENTITY(1,1),
	[1c_document_id] [binary(16)] NULL,
	[1c_id] [binary(16)] NULL,
	[artic_id] [nvarchar(36)] NULL,
	[Количество] [numeric(15,3)] NULL,
	[Сумма] [numeric(38,15)] NULL,
	[СуммаБезНДС] [numeric(38,15)] NULL,
	[СуммаРучнойСкидки] [numeric(38,15)] NULL,
	[СуммаАвтоСкидки] [numeric(38,15)] NULL,
	[Закупка] [numeric(38,15)] NULL,
	[Закупка, usd2] [numeric(38,15)] NULL,
	[Таможня] [numeric(38,15)] NULL,
	[ЕАЭС] [numeric(38,15)] NULL,
	[Учетная цена] [numeric(38,15)] NULL,
	[Учетная цена USD2+2] [numeric(38,15)] NULL,
	[Маркетинг] [numeric(38,15)] NULL,
	[Доставка] [numeric(38,15)] NULL,
	[НДС] [numeric(38,15)] NULL,
	[Сборка] [numeric(38,15)] NULL,
	[ЗатратыМП] [numeric(38,15)] NULL,
	[PartnerId] [nvarchar(36)] NULL,
	[Учетная стоимость] [numeric(38,15)] NULL,
	[Учетная стоимость USD2+2] [numeric(38,15)] NULL,
	[sebes_id] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [pbi].[СебестоимостьПродажиОт2022]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [pbi].[СебестоимостьПродажиОт2022](
	[id] [int] NULL IDENTITY(1,1),
	[1c_document_id] [binary(16)] NULL,
	[1c_id] [binary(16)] NULL,
	[artic_id] [nvarchar(36)] NULL,
	[Количество] [numeric(15,3)] NULL,
	[Сумма] [numeric(38,15)] NULL,
	[СуммаБезНДС] [numeric(38,15)] NULL,
	[СуммаРучнойСкидки] [numeric(38,15)] NULL,
	[СуммаАвтоСкидки] [numeric(38,15)] NULL,
	[Закупка] [numeric(38,15)] NULL,
	[Закупка, usd2] [numeric(38,15)] NULL,
	[Таможня] [numeric(38,15)] NULL,
	[ЕАЭС] [numeric(38,15)] NULL,
	[Учетная цена] [numeric(38,15)] NULL,
	[Учетная цена USD2+2] [numeric(38,15)] NULL,
	[Маркетинг] [numeric(38,15)] NULL,
	[Доставка] [numeric(38,15)] NULL,
	[НДС] [numeric(38,15)] NULL,
	[Сборка] [numeric(38,15)] NULL,
	[ЗатратыМП] [numeric(38,15)] NULL,
	[PartnerId] [nvarchar(36)] NULL,
	[Учетная стоимость] [numeric(38,15)] NULL,
	[Учетная стоимость USD2+2] [numeric(38,15)] NULL,
	[sebes_id] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [pbi].[СебестоимостьПродажиТест]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [pbi].[СебестоимостьПродажиТест](
	[id] [int] NULL IDENTITY(1,1),
	[1c_document_id] [binary(16)] NULL,
	[1c_id] [binary(16)] NULL,
	[artic_id] [nvarchar(36)] NULL,
	[Количество] [numeric(15,3)] NULL,
	[Сумма] [numeric(38,15)] NULL,
	[СуммаБезНДС] [numeric(38,15)] NULL,
	[СуммаРучнойСкидки] [numeric(38,15)] NULL,
	[СуммаАвтоСкидки] [numeric(38,15)] NULL,
	[Закупка] [numeric(38,15)] NULL,
	[Закупка, usd2] [numeric(38,15)] NULL,
	[Таможня] [numeric(38,15)] NULL,
	[ЕАЭС] [numeric(38,15)] NULL,
	[Учетная цена] [numeric(38,15)] NULL,
	[Учетная цена USD2+2] [numeric(38,15)] NULL,
	[Маркетинг] [numeric(38,15)] NULL,
	[Доставка] [numeric(38,15)] NULL,
	[НДС] [numeric(38,15)] NULL,
	[Сборка] [numeric(38,15)] NULL,
	[ЗатратыМП] [numeric(38,15)] NULL,
	[PartnerId] [nvarchar(36)] NULL,
	[Учетная стоимость] [numeric(38,15)] NULL,
	[Учетная стоимость USD2+2] [numeric(38,15)] NULL,
	[sebes_id] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [pbi].[СебестоимостьСводныйОт2022Тестовый]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [pbi].[СебестоимостьСводныйОт2022Тестовый](
	[id] [int] NULL IDENTITY(1,1),
	[Период] [datetime2(0)] NULL,
	[Статья] [varchar(255)] NULL,
	[Вид операции] [varchar(255)] NULL,
	[Хоз операция] [varchar(255)] NULL,
	[Организация] [varchar(255)] NULL,
	[Партнер] [varchar(255)] NULL,
	[Контрагент] [varchar(255)] NULL,
	[Менеджер] [varchar(255)] NULL,
	[Тип документа] [varchar(255)] NULL,
	[Номер документа] [varchar(255)] NULL,
	[Валюта документа] [varchar(255)] NULL,
	[Ценовая группа] [varchar(255)] NULL,
	[1c_document_id] [binary(16)] NULL,
	[1c_id] [binary(16)] NULL,
	[artic_id] [nvarchar(36)] NULL,
	[Количество] [numeric(15,3)] NULL,
	[Сумма] [numeric(38,15)] NULL,
	[СуммаБезНДС] [numeric(38,15)] NULL,
	[СуммаРучнойСкидки] [numeric(38,15)] NULL,
	[СуммаАвтоСкидки] [numeric(38,15)] NULL,
	[Закупка] [numeric(38,15)] NULL,
	[Закупка, usd2] [numeric(38,15)] NULL,
	[Курс usd2] [numeric(15,3)] NULL,
	[Курс usd] [numeric(15,3)] NULL,
	[Таможня] [numeric(38,15)] NULL,
	[ЕАЭС] [numeric(38,15)] NULL,
	[Учетная цена] [numeric(38,15)] NULL,
	[Учетная цена USD2+2] [numeric(38,15)] NULL,
	[Заказ закрыт] [datetime] NULL,
	[Номер заказа] [nchar(11)] NULL,
	[Маркетинг] [numeric(38,15)] NULL,
	[Доставка] [numeric(38,15)] NULL,
	[НДС] [numeric(38,15)] NULL,
	[Сборка] [numeric(38,15)] NULL,
	[ЗатратыМП] [numeric(38,15)] NULL,
	[PartnerId] [nvarchar(36)] NULL,
	[Учетная стоимость] [numeric(38,15)] NULL,
	[Учетная стоимость USD2+2] [numeric(38,15)] NULL,
	[Номер регистратора] [nchar(10)] NULL,
	[Code] [nchar(11)] NULL,
	[ЗатратыСкладХранение] [numeric(38,15)] NULL,
	[Приемка] [numeric(38,15)] NULL,
	[АтсМаркировка] [numeric(38,15)] NULL,
	[ВремяВыполненияМинут] [numeric(38,15)] NULL,
	[СборкаЗаказа] [numeric(38,15)] NULL,
PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [pbi].[СебестоимостьТест]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [pbi].[СебестоимостьТест](
	[id] [int] NULL IDENTITY(1,1),
	[Период] [datetime2(0)] NULL,
	[Статья] [varchar(255)] NULL,
	[Вид операции] [varchar(255)] NULL,
	[Хоз операция] [varchar(255)] NULL,
	[Организация] [varchar(255)] NULL,
	[Партнер] [varchar(255)] NULL,
	[Контрагент] [varchar(255)] NULL,
	[Менеджер] [varchar(255)] NULL,
	[Тип документа] [varchar(255)] NULL,
	[Номер документа] [varchar(255)] NULL,
	[Валюта документа] [varchar(255)] NULL,
	[Ценовая группа] [varchar(255)] NULL,
	[1c_document_id] [binary(16)] NULL,
	[1c_id] [binary(16)] NULL,
	[artic_id] [nvarchar(36)] NULL,
	[Количество] [numeric(15,3)] NULL,
	[Сумма] [numeric(38,15)] NULL,
	[СуммаБезНДС] [numeric(38,15)] NULL,
	[СуммаРучнойСкидки] [numeric(38,15)] NULL,
	[СуммаАвтоСкидки] [numeric(38,15)] NULL,
	[Закупка] [numeric(38,15)] NULL,
	[Закупка, usd2] [numeric(38,15)] NULL,
	[Курс usd2] [numeric(15,3)] NULL,
	[Курс usd] [numeric(15,3)] NULL,
	[Таможня] [numeric(38,15)] NULL,
	[ЕАЭС] [numeric(38,15)] NULL,
	[Учетная цена] [numeric(38,15)] NULL,
	[Учетная цена USD2+2] [numeric(38,15)] NULL,
	[Заказ закрыт] [datetime] NULL,
	[Номер заказа] [nchar(11)] NULL,
	[Маркетинг] [numeric(38,15)] NULL,
	[Доставка] [numeric(38,15)] NULL,
	[НДС] [numeric(38,15)] NULL,
	[Сборка] [numeric(38,15)] NULL,
	[ЗатратыМП] [numeric(38,15)] NULL,
	[PartnerId] [nvarchar(36)] NULL,
	[Учетная стоимость] [numeric(38,15)] NULL,
	[Учетная стоимость USD2+2] [numeric(38,15)] NULL,
	[Номер регистратора] [nchar(10)] NULL,
PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [stg].[forecast_load]    Script Date: 2026-02-22 11:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [stg].[forecast_load](
	[1c_id] [nvarchar(100)] NULL,
	[code] [nvarchar(100)] NULL,
	[month] [nvarchar(50)] NULL,
	[value] [nvarchar(100)] NULL,
	[user_name] [nvarchar(200)] NULL,
	[updated_at] [nvarchar(100)] NULL) ON [PRIMARY]
GO