Код:
--печать скидок чека
-- for i=0, __hard_subtotal.receipt.discounts:size()-1 do
-- local discount = __hard_subtotal.receipt.discounts:at(i);
-- if __hard_subtotal.receipt.items:getdiscount(discount):is_initialized() and __hard_subtotal.receipt.items:getdiscount(discount):get():sign() ~= 0 then
-- if __hard_subtotal.receipt.items:getdiscount(discount):get():sign() == -1 then
-- if ukm.str_len("Наценка: " .. ukm.rightpad(ukm.left(discount.name, width-28),width-28,".") .. " " .. tostring(__hard_subtotal.receipt.items:getrealpercent(discount)) .. "% " .. " " .. tostring(__hard_subtotal.receipt.items:getdiscount(discount):get()*ukm.currency(-1))) < width then
-- text = text .. ukm.adjustment("Наценка: " .. ukm.rightpad(ukm.left(discount.name, width-28),width-28,".") .. " " .. tostring(__hard_subtotal.receipt.items:getrealpercent(discount)) .. "% ", tostring(__hard_subtotal.receipt.items:getdiscount(discount):get()*ukm.currency(-1)), width-1, ".") .. "\n";
-- else
-- text = text .. ukm.rightpad("Наценка: " .. ukm.rightpad(ukm.left(discount.name, width-28),width-28,".") .. " " .. tostring(__hard_subtotal.receipt.items:getrealpercent(discount)) .. "% ", width-1, ".") .. "\n";
-- text = text .. ukm.leftpad(tostring(__hard_subtotal.receipt.items:getdiscount(discount):get()*ukm.currency(-1)),width-1,".") .. "\n";
-- end
-- else
-- if ukm.str_len("Скидка: " .. ukm.rightpad(ukm.left(discount.name, width-28),width-28,".") .. " " .. tostring(__hard_subtotal.receipt.items:getrealpercent(discount)) .. "% " .. " " .. tostring(__hard_subtotal.receipt.items:getdiscount(discount):get())) < width then
-- text = text .. ukm.adjustment("Скидка: " .. ukm.rightpad(ukm.left(discount.name, width-28),width-28,".") .. " " .. tostring(__hard_subtotal.receipt.items:getrealpercent(discount)) .. "% ", tostring(__hard_subtotal.receipt.items:getdiscount(discount):get()), width-1, ".") .. "\n";
-- else
-- text = text .. ukm.rightpad("Скидка: " .. ukm.rightpad(ukm.left(discount.name, width-28),width-28,".") .. " " .. tostring(__hard_subtotal.receipt.items:getrealpercent(discount)) .. "% ", width-1, ".") .. "\n";
-- text = text .. ukm.leftpad(tostring(__hard_subtotal.receipt.items:getdiscount(discount):get()),width-1,".") .. "\n";
-- end
-- end
local properties_iterator = ukm.map.int.string.iterator(discount.properties);
if properties_iterator:at(ukm.core.field_discount_modificator) ~= "" then
local modif = "возможное значение ";
этот кусочек? =)