Что-то подобное. Не тестировала.
Код:
--Товарный отчёт
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