Browse Source

Limit cost precision to 2

Neal Wilson 8 years ago
parent
commit
42b05091db
1 changed files with 2 additions and 2 deletions
  1. 2
    2
      config/Reports/invoices.xml

+ 2
- 2
config/Reports/invoices.xml View File

@@ -95,7 +95,7 @@
95 95
                 {
96 96
                     searchclause = " AND id IN (SELECT invoice_id FROM invoice_items WHERE item_id IN (SELECT item FROM certifications WHERE certification ~* :p1 UNION SELECT id FROM coffees WHERE origin ~* :p2 UNION SELECT id FROM items WHERE name ~* :p3 UNION SELECT id FROM coffees WHERE reference ~* :p4))";
97 97
                 }
98
-                query.prepare("SELECT id, time::date, vendor, invoice, (SELECT sum(cost) FROM invoice_items WHERE invoice_id = id) AS cost FROM invoices WHERE time >= :sd AND time < :ed::date + interval '1 day'" + vendorclause + searchclause + " ORDER BY time DESC");
98
+                query.prepare("SELECT id, time::date, vendor, invoice, (SELECT sum(cost) FROM invoice_items WHERE invoice_id = id)::numeric(12,2) AS cost FROM invoices WHERE time >= :sd AND time < :ed::date + interval '1 day'" + vendorclause + searchclause + " ORDER BY time DESC");
99 99
                 query.bind(":sd", startDate);
100 100
                 query.bind(":ed", endDate);
101 101
                 if(vendorclause.length > 0) {
@@ -132,7 +132,7 @@
132 132
                 output.writeEmptyElement("td");
133 133
                 output.writeEmptyElement("td");
134 134
                 output.writeTextElement("th", "Total:");
135
-                output.writeTextElement("td", cost_sum);
135
+                output.writeTextElement("td", Number(cost_sum).toFixed(2));
136 136
                 output.writeEndElement();
137 137
                 output.writeEndElement();
138 138
                 output.writeEndElement();

Loading…
Cancel
Save