var sum = 0
var symbol = '?'
function total() {
document.write("total: "+symbol+sum.toFixed(2))
}
function table(data) {
for (key in data) {
var topic = data[key]
document.write(""+topic["name"]+"
")
document.write("
| quantity | ") document.write("item | ") document.write("description | ") document.write("list unit price | ") document.write("extended price | ") document.write("
|---|---|---|---|---|
| "+vendor["name"]+" | ||||
| "+category["name"]+" | ||||
| "+item["quantity"]+" | ") document.write(""+item["item"]+" | ") document.write(""+item["description"]+" | ") document.write(""+symbol+parseFloat(item["price"]).toFixed(2)+" | ") var extended = parseFloat(item["quantity"])*parseFloat(item["price"]) document.write(""+symbol+extended.toFixed(2)+" | ") vendortotal += extended document.write("
| total | "+symbol+vendortotal.toFixed(2)+" |