|
@@ -93,7 +93,7 @@
|
93
|
93
|
var searchclause = "";
|
94
|
94
|
if(search.text.length > 0)
|
95
|
95
|
{
|
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))";
|
|
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 UNION SELECT id FROM coffees WHERE region ~* :p5 UNION SELECT id FROM coffees WHERE producer ~* :p6 UNION SELECT id FROM coffees WHERE grade ~* :p7 UNION SELECT id FROM coffees WHERE milling ~* :p8 UNION SELECT id FROM coffees WHERE drying ~* :p9 UNION SELECT id FROM decaf_coffees WHERE decaf_method ~* :p10) OR description ~* :p11 UNION SELECT id FROM invoices WHERE invoice ~* :p12 UNION SELECT id FROM invoices WHERE vendor ~* :p13)";
|
97
|
97
|
}
|
98
|
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);
|
|
@@ -108,6 +108,15 @@
|
108
|
108
|
query.bind(":p2", pattern);
|
109
|
109
|
query.bind(":p3", pattern);
|
110
|
110
|
query.bind(":p4", pattern);
|
|
111
|
+ query.bind(":p5", pattern);
|
|
112
|
+ query.bind(":p6", pattern);
|
|
113
|
+ query.bind(":p7", pattern);
|
|
114
|
+ query.bind(":p8", pattern);
|
|
115
|
+ query.bind(":p9", pattern);
|
|
116
|
+ query.bind(":p10", pattern);
|
|
117
|
+ query.bind(":p11", pattern);
|
|
118
|
+ query.bind(":p12", pattern);
|
|
119
|
+ query.bind(":p13", pattern);
|
111
|
120
|
}
|
112
|
121
|
query.exec();
|
113
|
122
|
var cost_sum = 0;
|