22.01.2018 16:37
Dim
 
есть такой отчет:
Код:
--Товарный отчёт
function print_report_item(__rep,__print_data)
    local printer = ukm.get_printer(ukm.printer_type_master());
    if printer then
        local text = "";
        local width = printer:get_width();
        text = report_general_shift_period(__rep,width);
        text = text .. report_general_header(__rep,width,"ТВР");
        text = text .. ukm.adjustment(ukm.adjustment("ТОВАР","(РУБ) ВОЗВРАТ",width-12," "),"ПРОДАЖА",width," ") .. "\n";
        local report_item = ukm.map.string.report_item.iterator(__rep.items);

        local full_amount_rtrn = ukm.currency(0);        
        local full_amount_sale = ukm.currency(0);
        while report_item:next() do
           local rtrn = report_item:second().amount_return + report_item:second().disc_amount_return;
           local sale = report_item:second().amount_sale + report_item:second().disc_amount_sale;

--           local rtrn = report_item:second().amount_return + report_item:second().disc_amount_return;
--           local sale = report_item:second().amount_sale + report_item:second().disc_amount_sale;
           full_amount_rtrn = full_amount_rtrn + rtrn;
           full_amount_sale = full_amount_sale + sale;
           text = text .. ukm.adjustment(ukm.adjustment(tostring(report_item:second().item),tostring(rtrn),width-12," "),tostring(sale),width," ") .. "\n";
           text = text .. " " .. ukm.left(ukm.rightpad(report_item:second().name,width-1," "),width-1) .. "\n"; 
        end

           text = text .. ukm.adjustment(ukm.adjustment("Итого",tostring(full_amount_rtrn),width-12," "),tostring(full_amount_sale),width," ") .. "\n";

        __print_data:add(text, ukm.printer_type_master());
   end
end
необходимо добавить вывод количества
05.03.2018 11:32
Dim
 
апну... помогите кто-нибудь, пож
05.03.2018 12:29
OlegON
 
Ты ж, вроде, программист :) Не писал отчеты на lua, но по смыслу, посмотри report_item, судя по всему, там может быть не только сумма денег, но и количество... Впихни его в строку с text = text .. ukm.adjustment и вперед...
05.03.2018 12:42
Dim
 
вот как количество достать и не понятно
05.03.2018 12:51
Mtirt
 
Что-то подобное. Не тестировала.
Код:
--Товарный отчёт
function print_report_item(__rep,__print_data)
    local printer = ukm.get_printer(ukm.printer_type_master());
    if printer then
        local text = "";
        local width = printer:get_width();
        text = report_general_shift_period(__rep,width);
        text = text .. report_general_header(__rep,width,"ТВР");
        text = text .. ukm.adjustment(ukm.adjustment("ТОВАР","(РУБ) ВОЗВРАТ",width-12," "),"ПРОДАЖА",width," ") .. "\n";
        local report_item = ukm.map.string.report_item.iterator(__rep.items);

        local full_amount_rtrn = ukm.currency(0);        
        local full_amount_sale = ukm.currency(0);
        local full_quant_sale =0;
        local full_quant_return =0;

        while report_item:next() do
           local rtrn = report_item:second().amount_return + report_item:second().disc_amount_return;
           local sale = report_item:second().amount_sale + report_item:second().disc_amount_sale;

--           local rtrn = report_item:second().amount_return + report_item:second().disc_amount_return;
--           local sale = report_item:second().amount_sale + report_item:second().disc_amount_sale;
           full_amount_rtrn = full_amount_rtrn + rtrn;
           full_amount_sale = full_amount_sale + sale;
           full_quant_sale = full_quant_sale +report_item:second().quantity_sale;
           full_quant_return = full_quant_return +report_item:second().quantity_return
 
           text = text .. ukm.adjustment(ukm.adjustment(tostring(report_item:second().item),tostring(rtrn),width-12," "),tostring(sale),width," ") .. "\n";
           text = text .. ukm.adjustment(ukm.adjustment("Кол-во",tostring(report_item:second().quantity_sale),width-12," "),tostring(report_item:second().quantity_sale),width," ") .. "\n";

           text = text .. " " .. ukm.left(ukm.rightpad(report_item:second().name,width-1," "),width-1) .. "\n"; 
        end

           text = text .. ukm.adjustment(ukm.adjustment("Итого",tostring(full_amount_rtrn),width-12," "),tostring(full_amount_sale),width," ") .. "\n";
        text = text .. ukm.adjustment(ukm.adjustment("Итого,кол-во",tostring(full_quant_sale),width-12," "),tostring( full_quant_return),width," ") .. "\n";
        __print_data:add(text, ukm.printer_type_master());
   end
end
07.03.2018 13:18
Dim
 
не работает... пишет
Цитата:
12:51:49: 0x00004000: DEBUG: luaukm: hello
12:51:52: 0x00084011: INFO: replication_to_server: Передача данных на сервер завершена
12:52:08: 0x00004000: WARNING: debug#/usr/local/storage/home/ukm/build-br-75_sp1-2017_05_02_11_00_00/ukm/libukm/ccore.cpp(8273) ReportItemByShift: No matching overload found, candidates:
void __add(lua_State*,quantity const&,currency)
void __add(lua_State*,quantity const&,quantity)
12:52:26: 0x00004000: WARNING: debug#/usr/local/storage/home/ukm/build-br-75_sp1-2017_05_02_11_00_00/ukm/libukm/ccore.cpp(8273) ReportItemByShift: No matching overload found, candidates:
void __add(lua_State*,quantity const&,currency)
void __add(lua_State*,quantity const&,quantity)
12:53:07: 0x00004000: WARNING: debug#/usr/local/storage/home/ukm/build-br-75_sp1-2017_05_02_11_00_00/ukm/libukm/ccore.cpp(8273) ReportItemByShift: No matching overload found, candidates:
void __add(lua_State*,quantity const&,currency)
void __add(lua_State*,quantity const&,quantity)
12:54:13: 0x00004000: WARNING: debug#/usr/local/storage/home/ukm/build-br-75_sp1-2017_05_02_11_00_00/ukm/libukm/ccore.cpp(8273) ReportItemByShift: No matching overload found, candidates:
void __add(lua_State*,quantity const&,currency)
void __add(lua_State*,quantity const&,quantity)
13:04:16: 0x00088011: INFO: replication_from_server: Получение данных от сервера начато
13:04:16: 0x00088011: INFO: replication_from_server: Ожидание готовности терминала
13:04:16: 0x00088011: INFO: debug#/usr/local/storage/home/ukm/build-br-75_sp1-2017_05_02_11_00_00/ukm/libukm/cprotocolmanager.cpp(283) TableAdjuster: NO FILES
13:04:17: 0x00088011: INFO: replication_from_server: Получение данных от сервера завершено
Миниатюры
Нажмите на изображение для увеличения
Название: IMG-abbabc92ec93989faf8a2dbd8d46532a-V.jpg
Просмотров: 53
Размер:	2.08 Мб
ID:	9272  
07.03.2018 13:37
vdm
 
Возможно это:
Код:
        local full_quant_sale = ukm.quantity(0);
        local full_quant_return = ukm.quantity(0);
12.03.2018 13:22
Dim
 
сегодня проверили. с исправлениями от vdm все работает. всем огромное спасибо!

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