ТНВЭД
Материал из wiki.standart-n.ru
Версия от 17:34, 17 августа 2018; Olgav (обсуждение | вклад)
Содержание
Новая вспомогательная таблица TNVED
/******************************************************************************/ /*** Generated by IBExpert 16.08.2018 12:21:47 ***/ /******************************************************************************/ /******************************************************************************/ /*** Following SET SQL DIALECT is just for the Database Comparer ***/ /******************************************************************************/ SET SQL DIALECT 3; /******************************************************************************/ /*** Tables ***/ /******************************************************************************/ CREATE TABLE TNVED ( TNVEDCODE DM_TEXT NOT NULL /* DM_TEXT = VARCHAR(250) */, BARCODE DM_TEXT NOT NULL /* DM_TEXT = VARCHAR(250) */, SNAME DM_TEXT NOT NULL /* DM_TEXT = VARCHAR(250) */ ); /******************************************************************************/ /*** Primary keys ***/ /******************************************************************************/ ALTER TABLE TNVED ADD CONSTRAINT PK_TNVED PRIMARY KEY (TNVEDCODE, BARCODE, SNAME); /******************************************************************************/ /*** Indices ***/ /******************************************************************************/ CREATE INDEX TNVED_IDX1 ON TNVED (TNVEDCODE); CREATE INDEX TNVED_IDX2 ON TNVED (BARCODE); CREATE INDEX TNVED_IDX3 ON TNVED (SNAME); /******************************************************************************/ /*** Privileges ***/ /******************************************************************************/
Выполнить файл tnved.sql
Заполняем коды
EXECUTE BLOCK AS declare variable b dm_text; declare variable t dm_text; declare variable ware_id dm_uuid; BEGIN for select t.barcode,t.tnvedcode from tnved t into :b,:t do begin for select id from wares where barcode containing :b into :ware_id do update or insert into ATTRIBUTE_DETAIL(ATTR_SID,ATTR_LINKID,ATTR_SVALUE) values ('TNVEDCODE',:ware_id,:t) matching (ATTR_SID,ATTR_LINKID); end END;
Обновить менеджер до версии не ниже 273.75
У тех клиентов где код тнвэд в таблице wares
EXECUTE BLOCK AS declare variable t dm_text; declare variable w dm_text; BEGIN for select edizm,ware_id from vw_parts where coalesce(trim(edizm),'') <>'' into :t,:w do update or insert into ATTRIBUTE_DETAIL(ATTR_SID,ATTR_LINKID,ATTR_SVALUE) values ('UNITNOMENCLATURE',:w,:t) matching (ATTR_SID,ATTR_LINKID); END; EXECUTE BLOCK AS declare variable t dm_text; declare variable w dm_text; BEGIN for select tnvedcode,id from wares where coalesce(trim(tnvedcode),'') <>'' into :t,:w do update or insert into ATTRIBUTE_DETAIL(ATTR_SID,ATTR_LINKID,ATTR_SVALUE) values ('TNVEDCODE',:w,:t) matching (ATTR_SID,ATTR_LINKID); END;