Установка механизма деления через фасовку. — различия между версиями
Материал из wiki.standart-n.ru
Aleksnick (обсуждение | вклад) |
Aleksnick (обсуждение | вклад) |
||
Строка 19: | Строка 19: | ||
== Меняем Views == | == Меняем Views == | ||
− | + | ===VW_DOC_DETAIL=== | |
RATIO, | RATIO, | ||
PRICE_RATIO | PRICE_RATIO | ||
Строка 27: | Строка 27: | ||
p.barcode)) as dm_id),1)), 1) | p.barcode)) as dm_id),1)), 1) | ||
− | + | ===VW_DOC_DETAIL_ACTIVE=== | |
RATIO, | RATIO, | ||
REALQUANT_RATIO, | REALQUANT_RATIO, | ||
Строка 39: | Строка 39: | ||
da.barcode)) as dm_id),1)), 1) | da.barcode)) as dm_id),1)), 1) | ||
− | + | ===VW_DOC_DETAIL_KASSA=== | |
RATIO, | RATIO, | ||
REALQUANT_RATIO, | REALQUANT_RATIO, | ||
Строка 48: | Строка 48: | ||
p.price/iif ((coalesce(cast((select first 1 svalue from pr_getattribute('RATIO', p.barcode)) as dm_id),1) > 0), abs(coalesce(cast((select first 1 svalue from pr_getattribute('RATIO', p.barcode)) as dm_id),1)), 1) | p.price/iif ((coalesce(cast((select first 1 svalue from pr_getattribute('RATIO', p.barcode)) as dm_id),1) > 0), abs(coalesce(cast((select first 1 svalue from pr_getattribute('RATIO', p.barcode)) as dm_id),1)), 1) | ||
− | + | ===VW_WAREBASE=== | |
RATIO, | RATIO, | ||
PRICE_RATIO | PRICE_RATIO | ||
Строка 56: | Строка 56: | ||
wb.barcode)) as dm_id),1)), 1) | wb.barcode)) as dm_id),1)), 1) | ||
− | + | ===VW_WAREBASE_KASSA=== | |
RATIO | RATIO | ||
как | как |
Текущая версия на 17:46, 10 июля 2015
Содержание
Вставляем новый атрибут Ratio.
UPDATE OR INSERT INTO ATTRIBUTES (ATTR_SID, ATTR_LINKFIELDNAME, ATTR_TYPE, STATUS) VALUES ('RATIO', 'barcode', 1, 0) matching (ATTR_SID);
Вставляем новый тип документа "Фасовка"
INSERT INTO DOC_TYPES (ID, CAPTION, BASE_TYPE, STATINI, REPORTS, VTYPE) VALUES ((select max(id)+1 from doc_types), 'Фасовка', 3, '[main] FixedAgent=-2
[dbf] inipath=dbf.ini
[freereport] enabled=1 caption=Печать пакета документов report_id=103', NULL, 3);
Меняем Views
VW_DOC_DETAIL
RATIO, PRICE_RATIO
как
(select svalue from pr_getattribute('RATIO', p.barcode)), p.price/iif ((coalesce(cast((select first 1 svalue from pr_getattribute('RATIO', p.barcode)) as dm_id),1) > 0), abs(coalesce(cast((select first 1 svalue from pr_getattribute('RATIO', p.barcode)) as dm_id),1)), 1)
VW_DOC_DETAIL_ACTIVE
RATIO, REALQUANT_RATIO, PRICE_RATIO
как
(select svalue from pr_getattribute('RATIO', da.barcode)), iif ((coalesce(cast((select first 1 svalue from pr_getattribute('RATIO', da.barcode)) as dm_id),1) > 0), abs(coalesce(cast((select first 1 svalue from pr_getattribute('RATIO', da.barcode)) as dm_id),1)*quant), abs(quant)), price/iif ((coalesce(cast((select first 1 svalue from pr_getattribute('RATIO', da.barcode)) as dm_id),1) > 0), abs(coalesce(cast((select first 1 svalue from pr_getattribute('RATIO', da.barcode)) as dm_id),1)), 1)
VW_DOC_DETAIL_KASSA
RATIO, REALQUANT_RATIO, PRICE_RATIO
как
(select svalue from pr_getattribute('RATIO', p.barcode)), iif ((coalesce(cast((select first 1 svalue from pr_getattribute('RATIO', p.barcode)) as dm_id),1) > 0), abs(coalesce(cast((select first 1 svalue from pr_getattribute('RATIO', p.barcode)) as dm_id),1)*dt.quant), abs(dt.quant)), p.price/iif ((coalesce(cast((select first 1 svalue from pr_getattribute('RATIO', p.barcode)) as dm_id),1) > 0), abs(coalesce(cast((select first 1 svalue from pr_getattribute('RATIO', p.barcode)) as dm_id),1)), 1)
VW_WAREBASE
RATIO, PRICE_RATIO
как
(select svalue from pr_getattribute('RATIO', wb.barcode)), price/iif ((coalesce(cast((select first 1 svalue from pr_getattribute('RATIO', wb.barcode)) as dm_id),1) > 0), abs(coalesce(cast((select first 1 svalue from pr_getattribute('RATIO', wb.barcode)) as dm_id),1)), 1)
VW_WAREBASE_KASSA
RATIO
как
cast(coalesce((select first 1 svalue from pr_getattribute('RATIO', w.barcode)), 1) as dm_id)
Меняем процедуры для распечатки штрихкодов
create or alter procedure OUT$PR_SHTRIH ( doc_id dm_id) returns ( id dm_id) as declare variable i dm_id; declare variable status dm_status; declare variable quant dm_id; declare variable base_type dm_id; declare variable ratio dm_id; begin select d.status, dt.base_type from docs d left join doc_types dt on dt.id=d.doc_type where d.id=:doc_id into :status, :base_type; if ((status=0) or (status=2)) then for select dd.id, (select cast(svalue as dm_id) from pr_getattribute('RATIO', dd.barcode)), coalesce((select svalue from pr_getattribute('barc_label_count', dd.barcode)), trunc(dd.quant), 1) from doc_detail_active dd where doc_id=:doc_id into :id,:ratio,:quant do begin if (ratio is not null) then quant = ratio*quant; i=1; while (i<=quant) do begin suspend; i=i+1; end end if ((status=1) and (base_type<>4)) then for select dd.id, (select cast(svalue as dm_id) from pr_getattribute('RATIO', p.barcode)), coalesce((select svalue from pr_getattribute('barc_label_count', w.name_id)), trunc(dd.quant), 1) from doc_detail dd inner join parts p on p.id = dd.part_id inner join wares w on w.id = p.ware_id where dd.doc_id=:doc_id into :id,:ratio,:quant do begin if (ratio is not null) then quant = ratio*quant; i=1; while (i<=quant) do begin suspend; i=i+1; end end if ((status=-1) and (base_type<>4)) then for select dd.id,coalesce((select svalue from pr_getattribute('barc_label_count', dd.name_id)), trunc(dd.quant), 1) from doc_detail_deleted dd where dd.doc_id=:doc_id into :id,:quant do begin i=1; while (i<=quant) do begin suspend; i=i+1; end end if (((status=1) or (status=-1)) and (base_type=4)) then for select dd.id,coalesce((select svalue from pr_getattribute('barc_label_count', dd.name_id)), trunc(dd.quant), 1) from doc_detail_virtual dd where doc_id=:doc_id into :id,:quant do begin i=1; while (i<=quant) do begin suspend; i=i+1; end end end
create or alter procedure OUT$PR_SHTRIH_WAREBASE ( part_id dm_id) returns ( id dm_id) as declare variable i dm_id; declare variable quant dm_id; declare variable ratio dm_id; begin for select dd.part_id,(select cast(svalue as dm_id) from pr_getattribute('RATIO', dd.barcode)), coalesce((select svalue from pr_getattribute('barc_label_count', dd.name_id)), trunc(dd.quant), 1) from warebase dd where dd.part_id=:part_id into :id,:ratio,:quant do begin if (ratio is not null) then quant = ratio*quant; i=1; while (i<=quant) do begin suspend; i=i+1; end end end
Меняем ТМС печати ценников из базы и активного документа
Заменяем во всех запросах (bar,bar_check,cenn,cenn_check)
price
на
price_ratio as price
Запрещаем редактирование кратности из остатков
В ТМС 214 редактирование поля вставляем запрет на редактирование ratio if ((UPPERCASE(program_result.values['fieldname'])='QUANT') or (UPPERCASE(program_result.values['fieldname'])='PRICE') or (UPPERCASE(program_result.values['fieldname'])='PRICE_O') or (UPPERCASE(program_result.values['fieldname'])='PRICE_Z') or (UPPERCASE(program_result.values['fieldname'])='RATIO') or (UPPERCASE(program_result.values['fieldname'])='REALQUANT')) then begin showmessage('Редактирование поля запрещено!'); program_result.values['cancel']:='1'; end
По желанию пользователя выводим в сетке активного чека вместо стандартного количества Realquant_ratio, которое отображает количество в поделенных единицах