ТНВЭД — различия между версиями
Olgav  (обсуждение | вклад)  (Новая страница: «- В глобальной базе в таблицу wares добавляем поле TNVEDCODE.  ALTER TABLE WARES ADD TNVEDCODE DM_TEXT; - Для всех св…»)  | 
				Olgav  (обсуждение | вклад)   | 
				||
| Строка 1: | Строка 1: | ||
| − | + | * В глобальной базе в таблицу wares добавляем поле TNVEDCODE.    | |
| + |  <nowiki>  | ||
ALTER TABLE WARES ADD TNVEDCODE DM_TEXT;  | ALTER TABLE WARES ADD TNVEDCODE DM_TEXT;  | ||
| − | + |  </nowiki>  | |
| − | + | * Для всех сводных баз и локальных по g$tasks так же отправляем создание новой колонки  | |
| − | + | * В vw_doc_detail добавить колонку TNVEDCODE. Заполнять значением из wares. Распространить изменение по g$tasks на все локальные базы.  | |
| + | * Предзаполнение    | ||
SET SQL DIALECT 3;  | SET SQL DIALECT 3;  | ||
CREATE TABLE TNVED ( TNVEDCODE  DM_TEXT NOT NULL /* DM_TEXT = VARCHAR(250) */,  | CREATE TABLE TNVED ( TNVEDCODE  DM_TEXT NOT NULL /* DM_TEXT = VARCHAR(250) */,  | ||
| Строка 11: | Строка 13: | ||
CREATE INDEX TNVED_IDX1 ON TNVED (BARCODE);  | CREATE INDEX TNVED_IDX1 ON TNVED (BARCODE);  | ||
| − | + | * Выполнить файл tnved.sql  | |
| − | + | * Заполняем коды    | |
update wares w set tnvedcode=(select first 1  t.tnvedcode from tnved t where t.barcode=w.barcode)  where  exists  (select first 1  t.tnvedcode from tnved t where t.barcode=w.barcode)  | update wares w set tnvedcode=(select first 1  t.tnvedcode from tnved t where t.barcode=w.barcode)  where  exists  (select first 1  t.tnvedcode from tnved t where t.barcode=w.barcode)  | ||
update wares w set tnvedcode=(select first 1  t.tnvedcode from tnved t where t.sname=w.sname) where  exists  (select first 1  t.tnvedcode from tnved t where t.sname=w.sname) and coalesce(trim(w.tnvedcode),'')=''  | update wares w set tnvedcode=(select first 1  t.tnvedcode from tnved t where t.sname=w.sname) where  exists  (select first 1  t.tnvedcode from tnved t where t.sname=w.sname) and coalesce(trim(w.tnvedcode),'')=''  | ||
update wares w set tnvedcode=(select first 1 ww.tnvedcode from wares ww where ww.name_id=w.name_id and ww.tnvedcode is not null )  where exists  (select first 1 ww.tnvedcode from wares ww  where ww.name_id=w.name_id and ww.tnvedcode is not null )  and w.tnvedcode is null  | update wares w set tnvedcode=(select first 1 ww.tnvedcode from wares ww where ww.name_id=w.name_id and ww.tnvedcode is not null )  where exists  (select first 1 ww.tnvedcode from wares ww  where ww.name_id=w.name_id and ww.tnvedcode is not null )  and w.tnvedcode is null  | ||
| − | + | * Обновить менеджер до версии 273,64  | |
Версия 09:29, 16 августа 2018
- В глобальной базе в таблицу wares добавляем поле TNVEDCODE.
 
ALTER TABLE WARES ADD TNVEDCODE DM_TEXT;
- Для всех сводных баз и локальных по g$tasks так же отправляем создание новой колонки
 - В vw_doc_detail добавить колонку TNVEDCODE. Заполнять значением из wares. Распространить изменение по g$tasks на все локальные базы.
 - Предзаполнение
 
SET SQL DIALECT 3; CREATE TABLE TNVED ( TNVEDCODE DM_TEXT NOT NULL /* DM_TEXT = VARCHAR(250) */,
BARCODE DM_TEXT NOT NULL /* DM_TEXT = VARCHAR(250) */, SNAME DM_TEXT1024 /* DM_TEXT1024 = VARCHAR(1024) */
); CREATE INDEX TNVED_IDX1 ON TNVED (BARCODE);
- Выполнить файл tnved.sql
 - Заполняем коды
 
update wares w set tnvedcode=(select first 1 t.tnvedcode from tnved t where t.barcode=w.barcode) where exists (select first 1 t.tnvedcode from tnved t where t.barcode=w.barcode) update wares w set tnvedcode=(select first 1 t.tnvedcode from tnved t where t.sname=w.sname) where exists (select first 1 t.tnvedcode from tnved t where t.sname=w.sname) and coalesce(trim(w.tnvedcode),)= update wares w set tnvedcode=(select first 1 ww.tnvedcode from wares ww where ww.name_id=w.name_id and ww.tnvedcode is not null ) where exists (select first 1 ww.tnvedcode from wares ww where ww.name_id=w.name_id and ww.tnvedcode is not null ) and w.tnvedcode is null
- Обновить менеджер до версии 273,64