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
+8 -10
View File
@@ -274,26 +274,24 @@ function Aux_Buy_ScrollbarUpdate()
[[
<html>
<body>
<h1>Aux Buy Report</h1><br/>
<h1>Exit status: %s</h1><br/>
<p>
%i out of %i ordered auctions for %s purchased
</p>
<h1>Aux Buy Report%s</h1>
<br/>
<p>
%i out of %i ordered auctions of %s purchased
<br/><br/>
Total units purchased: %i
</p>
<p>
Total expense: %i
<br/>
Total expense: %s
</p>
</body>
</html>
]],
completed and 'Completed' or 'Aborted',
completed and '' or ' (Aborted)',
progress.auctions,
ordered_count,
item_name,
progress.units,
progress.expense
Aux.util.format_money(progress.expense)
))
AuxBuyReportHTML:SetSpacing(3)
+9 -4
View File
@@ -516,17 +516,22 @@ function report(item_name, stack_size, buyout_price, posted)
[[
<html>
<body>
<h1>Aux Sell Report</h1><br/>
<h1>Aux Sell Report</h1>
<br/>
<p>
%i %i-stacks of %s posted for %i each
%i auctions of %s posted
<br/><br/>
Stack size: %i
<br/>
Stack price: %s
</p>
</body>
</html>
]],
posted,
stack_size,
item_name,
buyout_price
stack_size,
Aux.util.format_money(buyout_price)
))
AuxBuyReportHTML:SetSpacing(3)
+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