Переглянути джерело

Limit cost precision to 2

Neal Wilson 9 роки тому
джерело
коміт
42b05091db
1 змінених файлів з 2 додано та 2 видалено
  1. 2
    2
      config/Reports/invoices.xml

+ 2
- 2
config/Reports/invoices.xml Переглянути файл

@@ -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();

Завантаження…
Відмінити
Зберегти