|
@@ -18,7 +18,7 @@
|
18
|
18
|
</menu>
|
19
|
19
|
<program>
|
20
|
20
|
<![CDATA[
|
21
|
|
- this.windowTitle = "Typica - Production Summary";
|
|
21
|
+ this.windowTitle = TTR("dailyproduction", "Typica - Production Summary");
|
22
|
22
|
var dateSelect = findChildObject(this, 'dates');
|
23
|
23
|
var dateQuery = new QSqlQuery();
|
24
|
24
|
dateQuery.exec("SELECT time::date FROM roasting_log WHERE time = (SELECT min(time) FROM roasting_log) OR time = (SELECT max(time) FROM roasting_log) ORDER BY time ASC");
|
|
@@ -33,26 +33,26 @@
|
33
|
33
|
dateSelect.setLifetimeRange(lifetimeStartDate, lifetimeEndDate);
|
34
|
34
|
dateQuery = dateQuery.invalidate();
|
35
|
35
|
var unitBox = findChildObject(this, 'unit');
|
36
|
|
- unitBox.addItem("Kg");
|
37
|
|
- unitBox.addItem("Lb");
|
|
36
|
+ unitBox.addItem(TTR("dailyproduction", "Kg"));
|
|
37
|
+ unitBox.addItem(TTR("dailyproduction", "Lb"));
|
38
|
38
|
unitBox.currentIndex = QSettings.value("script/report_unit", 1);
|
39
|
39
|
unitBox['currentIndexChanged(int)'].connect(function() {
|
40
|
40
|
QSettings.setValue("script/report_unit", unitBox.currentIndex);
|
41
|
41
|
refresh();
|
42
|
42
|
});
|
43
|
43
|
var batchType = findChildObject(this, 'batchtype');
|
44
|
|
- batchType.addItem("Any");
|
45
|
|
- batchType.addItem("Production Roasts");
|
46
|
|
- batchType.addItem("SampleRoasts");
|
|
44
|
+ batchType.addItem(TTR("dailyproduction", "Any"));
|
|
45
|
+ batchType.addItem(TTR("dailyproduction", "Production Roasts"));
|
|
46
|
+ batchType.addItem(TTR("dailyproduction", "Sample Roasts"));
|
47
|
47
|
batchType.currentIndex = QSettings.value("script/batchtypefilter", 1);
|
48
|
48
|
batchType['currentIndexChanged(int)'].connect(function() {
|
49
|
49
|
QSettings.setValue("script/batchtypefilter", batchType.currentIndex);
|
50
|
50
|
refresh();
|
51
|
51
|
});
|
52
|
52
|
var approval = findChildObject(this, 'approval');
|
53
|
|
- approval.addItem("Any");
|
54
|
|
- approval.addItem("Approved");
|
55
|
|
- approval.addItem("Not Approved");
|
|
53
|
+ approval.addItem(TTR("dailyproduction", "Any"));
|
|
54
|
+ approval.addItem(TTR("dailyproduction", "Approved"));
|
|
55
|
+ approval.addItem(TTR("dailyproduction", "Not Approved"));
|
56
|
56
|
approval.currentIndex = QSettings.value("script/approvalfilter", 1);
|
57
|
57
|
approval['currentIndexChanged(int)'].connect(function() {
|
58
|
58
|
QSettings.setValue("script/approvalfilter", approval.currentIndex);
|
|
@@ -72,18 +72,18 @@
|
72
|
72
|
output.writeStartElement("html");
|
73
|
73
|
output.writeAttribute("xmlns", "http://www.w3.org/1999/xhtml");
|
74
|
74
|
output.writeStartElement("head");
|
75
|
|
- output.writeTextElement("title", "Production Summary");
|
|
75
|
+ output.writeTextElement("title", TTR("dailyproduction", "Production Summary"));
|
76
|
76
|
output.writeEndElement();
|
77
|
77
|
output.writeStartElement("body");
|
78
|
78
|
var dateRange = dateSelect.currentRange();
|
79
|
79
|
var startDate = dateRange[0];
|
80
|
80
|
var endDate = dateRange[dateRange.length - 1];
|
81
|
|
- output.writeTextElement("h1", "Production Summary: " + startDate + " - " + endDate);
|
|
81
|
+ output.writeTextElement("h1", TTR("dailyproduction", "Production Summary: ") + startDate + " - " + endDate);
|
82
|
82
|
var conversion = 1;
|
83
|
|
- var unitText = 'Lb';
|
|
83
|
+ var unitText = TTR("dailyproduction", "Lb");
|
84
|
84
|
if(unitBox.currentIndex == 0) {
|
85
|
85
|
conversion = 2.2;
|
86
|
|
- unitText = 'Kg';
|
|
86
|
+ unitText = TTR("dailyproduction", "Kg");
|
87
|
87
|
}
|
88
|
88
|
var transaction_filter;
|
89
|
89
|
var approval_filter;
|
|
@@ -120,7 +120,9 @@
|
120
|
120
|
var batchesRoasted = query.value(0);
|
121
|
121
|
var unroastedSum = query.value(1);
|
122
|
122
|
var roastedSum = query.value(2);
|
123
|
|
- output.writeTextElement("p", "" + roastedSum + " " + unitText + " roasted from " + unroastedSum + " " + unitText + " green in " + batchesRoasted + " batches.");
|
|
123
|
+ output.writeTextElement("p", "" + roastedSum + " " + unitText + TTR("dailyproduction", " roasted from ") +
|
|
124
|
+ unroastedSum + " " + unitText + TTR("dailyproduction", " green in ") +
|
|
125
|
+ batchesRoasted + TTR("dailyproduction", " batches."));
|
124
|
126
|
query.prepare("SELECT time::date AS date, count(1), sum(unroasted_total_quantity) / :c1, sum(roasted_quantity) / :c2 FROM roasting_log WHERE time >= :sd AND time < :ed ::date + interval '1 day'" + transaction_filter + approval_filter + " GROUP BY date ORDER BY date ASC");
|
125
|
127
|
query.bind(":c1", conversion);
|
126
|
128
|
query.bind(":c2", conversion);
|
|
@@ -132,10 +134,10 @@
|
132
|
134
|
output.writeAttribute("cellpadding", "3px");
|
133
|
135
|
output.writeStartElement("thead");
|
134
|
136
|
output.writeStartElement("tr");
|
135
|
|
- output.writeTextElement("th", "Date");
|
136
|
|
- output.writeTextElement("th", "Batches");
|
137
|
|
- output.writeTextElement("th", "Unroasted (" + unitText + ")");
|
138
|
|
- output.writeTextElement("th", "Roasted (" + unitText + ")");
|
|
137
|
+ output.writeTextElement("th", TTR("dailyproduction", "Date"));
|
|
138
|
+ output.writeTextElement("th", TTR("dailyproduction", "Batches"));
|
|
139
|
+ output.writeTextElement("th", TTR("dailyproduction", "Unroasted (") + unitText + ")");
|
|
140
|
+ output.writeTextElement("th", TTR("dailyproduction", "Roasted (") + unitText + ")");
|
139
|
141
|
output.writeEndElement();
|
140
|
142
|
output.writeEndElement();
|
141
|
143
|
output.writeStartElement("tbody");
|
|
@@ -156,7 +158,7 @@
|
156
|
158
|
output.writeStartElement("tfoot");
|
157
|
159
|
output.writeStartElement("tr");
|
158
|
160
|
output.writeStartElement("td");
|
159
|
|
- output.writeTextElement("strong", "Totals:");
|
|
161
|
+ output.writeTextElement("strong", TTR("dailyproduction", "Totals:"));
|
160
|
162
|
output.writeEndElement();
|
161
|
163
|
output.writeTextElement("td", batchesRoasted);
|
162
|
164
|
output.writeTextElement("td", unroastedSum);
|