Форум OlegON > Программы и оборудование для автоматизации торговли > Кассовые программы > УКМ-4

mysql запрос в укм4 в формате выгрузки укм2 : УКМ-4

20.04.2024 9:44


30.05.2012 12:08
Павел Сосновских
 
я как-то писал "костыль", чтоб подарки выгружать для версии, где они еще не умели выгружаться
для дописывания в cashsail там был такой запрос
если что можно наверное его подправить
только 3 момента: это было для конвертера "стандартный CSV";
(чтобы потом подарки отличались от пробитых позиций) к номеру позиции прибавляется 5(в чеке 3 позиции и 2 подарка, значит, будут позиции 1,2,3,9,10);
4 первых поля (№места хранения, №кассы, №Z-отчета, №чека) в запросе не участвуют

select
(select max(ri.position)+1+IF(max(ri.position) = @b0_c, @rn := @rn + 1, @rn := 1 + LEAST(0, @b0_c := max(ri.position)))
from trm_out_receipt_item ri, (SELECT @rn := 1, @b0_c := '_') AS xx where ri.cash_id = rh.cash_id
and ri.receipt_header = rh.id) + 5 as id,
date_format(rh.date,'%d/%m/%Y') as date,
date_format(rh.date,'%k%i') as time,
rdg.item as cardarticul,
'NOSIZE' as cardsize,
'1.000' as quantity,
'0.00' as pricerub,
'0.00' as pricecur,
'0.00' as totalrub,
'0.00' as totalcur,
0 as department,
l.user_id as casher,
rh.stock_id as usingindex,
'1' as _replace,
'100' as credcardindex,
0 as disccliindex,
ifnull(rl.receipt_link_header,0) as linked
from trm_out_shift_open so
inner join trm_out_receipt_header rh on so.cash_id=rh.cash_id and so.id=rh.shift_open
inner join trm_out_receipt_discounts rd on rh.cash_id=rd.cash_id and rh.id=rd.receipt_header
inner join trm_out_receipt_discount_gifts rdg on rd.cash_id=rdg.cash_id and rd.id=rdg.receipt_discount
inner join trm_out_login l on rh.cash_id=l.cash_id and rh.login=l.id
left join trm_out_receipt_link rl on rh.cash_id=rl.cash_id and rh.id=rl.id
where rdg.item is not null
and rh.pos = ...
and so.number = ...
and rh.local_number = ...;
Часовой пояс GMT +3, время: 09:44.

Форум на базе vBulletin®
Copyright © Jelsoft Enterprises Ltd.
В случае заимствования информации гипертекстовая индексируемая ссылка на Форум обязательна.