better reporting

This commit is contained in:
Manuel Simon Hirsig
2015-09-28 00:15:42 +02:00
parent 6886a42762
commit 3205762d0e
3 changed files with 36 additions and 14 deletions
+19
View File
@@ -20,4 +20,23 @@ function Aux.util.item_name_autocomplete()
return
end
end
end
function Aux.util.format_money(val)
local g = math.floor(val / 10000)
val = val - g * 10000
local s = math.floor(val / 100)
val = val - s * 100
local c = math.floor(val)
local g_string = g ~= 0 and g .. 'g' or ''
local s_string = s ~= 0 and s .. 's' or ''
local c_string = (c ~= 0 or g == 0 and s == 0) and c .. 'c' or ''
return g_string .. s_string .. c_string
end