Explorar el Código

Limit cost precision to 2

Neal Wilson hace 9 años
padre
commit
42b05091db
Se han modificado 1 ficheros con 2 adiciones y 2 borrados
  1. 2
    2
      config/Reports/invoices.xml

+ 2
- 2
config/Reports/invoices.xml Ver fichero

@@ -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…
Cancelar
Guardar