function print_hard_subtotal(__hard_subtotal, __print_data) if compresed_print == true then loc_item_table = {}; loc_item_keys_table = {}; local normal_items = __hard_subtotal.receipt.items:leavenormal(); for j = 0, normal_items:size() - 1 do local i = get_table_from_item(normal_items:at(j)); local key = i.item .. "_" .. tostring(i.price); if loc_item_table[key] == nil then table.insert(loc_item_keys_table,key); loc_item_table[key] = i; else loc_item_table[key].totalquantity = loc_item_table[key].totalquantity + i.totalquantity; loc_item_table[key].total = loc_item_table[key].total + i.total; for idk, idv in pairs(i.discounts) do if loc_item_table[key].discounts[idk] == nil then loc_item_table[key].discounts[idk] = {}; loc_item_table[key].discounts[idk].name = idv.name; loc_item_table[key].discounts[idk].increment = idv.increment; else loc_item_table[key].discounts[idk].increment = loc_item_table[key].discounts[idk].increment + idv.increment; end end for idk, idv in pairs(i.tax_item) do if loc_item_table[key].tax_item[idk] == nil then loc_item_table[key].tax_item[idk] = {}; loc_item_table[key].tax_item[idk].name = idv.name; loc_item_table[key].tax_item[idk].percent = idv.name; loc_item_table[key].tax_item[idk].amount = idv.amount; else loc_item_table[key].tax_item[idk].amount = loc_item_table[key].tax_item[idk].amount + idv.amount; end end end end --сортировка таблицей по ключу for i,v in ipairs(loc_item_keys_table) do print_item_to_printer(loc_item_table[v], ukm.printer_type_master(), __print_data); end loc_item_keys_table = {}; loc_item_table = {}; end