Полезные фильтры в менеджере

Материал из wiki.standart-n.ru
Перейти к: навигация, поиск

Содержание

Служебные

Не проставлена группа

MMBSH   IS NULL OR TRIM(MMBSH) = ''

Окончившиеся позиции

sname in
(select w.sname from warebase w group by w.sname
having count(distinct w.bcode_izg)>1) and
bcode_izg is not null and bcode_izg <> '' and bcode_izg<>'0'

Не нулевые

realquant>0

Нулевые остатки

REALQUANT  >= 0  AND  REALQUANT  <= 0.0005

Отрицательные остатки

REALQUANT  < 0

Фильтр на несхождение остатков

part_id in
(select dd.part_id
 from doc_detail dd
group by dd.part_id
having
abs( sum(dd.quant)-
 coalesce((select w.quant from warebase w where w.part_id=dd.part_id),0))>0.1)

Последний приход

part_id in
(select part_id from doc_detail where doc_id =
(select max(id) from docs where doc_type in (1,2,20) and status = 1)
)

Все приходы за текущий день

part_id in
(select part_id from doc_detail where doc_id in
(select id from docs where doc_type in (1,2,20) and status = 1 and commitdate>= current_date)
)

ЕГАИС

Не указан код вида продукции

((wb.mmbsh like ('%-21=%')) or (wb.mmbsh like ('%-20=%')) ) and (trim(wb.egais_product_vcode) = '' or (wb.egais_product_vcode is null))

Штрихкоды

Одно наименование, но разный штрихкод изготовителя

sname in
(select w.sname from warebase w group by w.sname
having count(distinct w.bcode_izg)>1) and
bcode_izg is not null and bcode_izg <> '' and bcode_izg<>'0'

Одно наименование и изготовитель, но разный штрихкод изготовителя

sname in
(select w.sname from warebase w group by w.sname
having count(distinct w.bcode_izg)>1) and
bcode_izg is not null and bcode_izg <> '' and bcode_izg<>'0'

1 шк изготовителя, но разные наименования

bcode_izg in
(select w.bcode_izg from warebase w group by w.bcode_izg
having count(distinct w.sname)>1) and
bcode_izg is not null and bcode_izg <> '' and bcode_izg<>'0'

1 шк, но разная цена

bcode_izg in
(select bcode_izg from
 (select w.bcode_izg, w.price from warebase w where abs(w.quant) > 0.001 group by w.bcode_izg, w.price
   having (select count(*) from warebase w2 where w2.bcode_izg= w.bcode_izg and abs(w2.quant) > 0.001 and w2.price <> w.price)>0))
and Trim(bcode_izg) <> '' and bcode_izg is not null
and realquant > 0

Не указан заводской штрихкод

bcode_izg<='000001' and quant>0

ШК изготовителя содержит перенос строки

bcode_izg containing ascii_char(10)

Неправильный шк изготовителя

part_id in 
(select part_id from warebase where bcode_izg is not null and char_length(Trim(bcode_izg)) = 13 and (select RES_BCODE from UTPR_GETCHECKSUM_EAN13(LEFT(Trim(bcode_izg),12))) <>  Trim(bcode_izg))


Скроки годности

Срок годности истек

godendo>'31.12.2000' and godendo is not null
and godendo<=current_date
and realquant>0

Срок годности 1 месяц

godendo>'31.12.2000' and godendo is not null
and godendo<=current_date+30
and realquant>0

Срок годности 2 месяца

godendo>'31.12.1899' and godendo is not null
and godendo<=current_date+60
and godendo>current_date+30
and realquant>0

Срок годности 3 месяца

godendo>'31.12.1899' and godendo is not null
and godendo<=current_date+90
and godendo>current_date+60
and realquant>0

Фарма

Возможно кодеинсодержашие

(select first 1 tovar from OUT$CODEIN ma where ma.tovar containing Trim(left(sname,6))) is not null


Малоходовка

Малоходовка 6 мес (дата прихода старше 6 мес. но меньше 7)

docdate<=current_date-180
and docdate>current_date-210
and realquant>0

Малоходовка 7 мес (дата прихода старше 7 мес. но меньше 8)

docdate<=current_date-210
and docdate>current_date-240
and realquant>0

Малоходовка 8 и более мес

docdate<=current_date-240
and realquant>0