|
@@ -14,7 +14,7 @@
|
14
|
14
|
</menu>
|
15
|
15
|
<program>
|
16
|
16
|
<![CDATA[
|
17
|
|
- this.windowTitle = "Typica - Coffee Purchase Previous Years Comparison";
|
|
17
|
+ this.windowTitle = TTR("fypurchase", "Typica - Coffee Purchase Previous Years Comparison");
|
18
|
18
|
/* Set Lifetime range. */
|
19
|
19
|
var dateSelect = findChildObject(this, 'dates');
|
20
|
20
|
var query = new QSqlQuery();
|
|
@@ -33,8 +33,8 @@
|
33
|
33
|
});
|
34
|
34
|
/* Add units to unit selector and enable functionality */
|
35
|
35
|
var unitBox = findChildObject(this, 'unit');
|
36
|
|
- unitBox.addItem("Kg");
|
37
|
|
- unitBox.addItem("Lb");
|
|
36
|
+ unitBox.addItem(TTR("fypurchase", "Kg"));
|
|
37
|
+ unitBox.addItem(TTR("fypurchase", "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);
|
|
@@ -50,10 +50,10 @@
|
50
|
50
|
output.writeStartElement("html");
|
51
|
51
|
output.writeAttribute("xmlns", "http://www.w3.org/1999/xhtml");
|
52
|
52
|
output.writeStartElement("head");
|
53
|
|
- output.writeTextElement("title", "Coffee Purchase Previous Years Comparison");
|
|
53
|
+ output.writeTextElement("title", TTR("fypurchase", "Coffee Purchase Previous Years Comparison"));
|
54
|
54
|
output.writeEndElement();
|
55
|
55
|
output.writeStartElement("body");
|
56
|
|
- output.writeTextElement("h1", "Coffee Purchase Previous Years Comparison");
|
|
56
|
+ output.writeTextElement("h1", TTR("fypurchase", "Coffee Purchase Previous Years Comparison"));
|
57
|
57
|
output.writeStartElement("table");
|
58
|
58
|
output.writeAttribute("style", "page-break-after: auto; text-align: left");
|
59
|
59
|
output.writeAttribute("rules", "groups");
|
|
@@ -61,22 +61,22 @@
|
61
|
61
|
output.writeStartElement("thead");
|
62
|
62
|
output.writeStartElement("tr");
|
63
|
63
|
output.writeEmptyElement("th");
|
64
|
|
- output.writeTextElement("th", "Sacks Purchased");
|
|
64
|
+ output.writeTextElement("th", TTR("fypurchase", "Sacks Purchased"));
|
65
|
65
|
switch(unitBox.currentIndex) {
|
66
|
66
|
case 0:
|
67
|
|
- output.writeTextElement("th", "Kg Purchased");
|
|
67
|
+ output.writeTextElement("th", TTR("fypurchase", "Kg Purchased"));
|
68
|
68
|
break;
|
69
|
69
|
case 1:
|
70
|
|
- output.writeTextElement("th", "Lb Purchased");
|
|
70
|
+ output.writeTextElement("th", TTR("fypurchase", "Lb Purchased"));
|
71
|
71
|
break;
|
72
|
72
|
}
|
73
|
|
- output.writeTextElement("th", "Cost");
|
|
73
|
+ output.writeTextElement("th", TTR("fypurchase", "Cost"));
|
74
|
74
|
switch(unitBox.currentIndex) {
|
75
|
75
|
case 0:
|
76
|
|
- output.writeTextElement("th", "Cost per Kg");
|
|
76
|
+ output.writeTextElement("th", TTR("fypurchase", "Cost per Kg"));
|
77
|
77
|
break;
|
78
|
78
|
case 1:
|
79
|
|
- output.writeTextElement("th", "Cost per Lb");
|
|
79
|
+ output.writeTextElement("th", TTR("fypurchase", "Cost per Lb"));
|
80
|
80
|
break;
|
81
|
81
|
}
|
82
|
82
|
output.writeEndElement(); //tr
|
|
@@ -116,7 +116,7 @@
|
116
|
116
|
query = query.invalidate();
|
117
|
117
|
output.writeEndElement(); //tbody
|
118
|
118
|
output.writeStartElement("tfoot");
|
119
|
|
- output.writeTextElement("th", "Totals:");
|
|
119
|
+ output.writeTextElement("th", TTR("fypurchase", "Totals:"));
|
120
|
120
|
output.writeTextElement("td", sacktotal.toFixed(2));
|
121
|
121
|
output.writeTextElement("td", unittotal.toFixed(2));
|
122
|
122
|
output.writeTextElement("td", costtotal.toFixed(2));
|
|
@@ -140,7 +140,10 @@
|
140
|
140
|
expandedYears.push(url);
|
141
|
141
|
var element = new WebElement(view.findFirstElement("#" + url));
|
142
|
142
|
var year = url.slice(1,url.length);
|
143
|
|
- var details = '<tr><td /><td colspan="3"><table><tr><th>Id</th><th>Invoice</th><th>Vendor</th><th>Cost</th></tr>';
|
|
143
|
+ var details = '<tr><td /><td colspan="3"><table><tr><th>Id</th><th>' + TTR("fypurchase", "Invoice") +
|
|
144
|
+ '</th><th>' + TTR("fypurchase", "Vendor") +
|
|
145
|
+ '</th><th>' + TTR("fypurchase", "Cost") +
|
|
146
|
+ '</th></tr>';
|
144
|
147
|
q = "SELECT id, invoice, vendor, (SELECT sum(cost) FROM invoice_items WHERE invoice_id = id) FROM invoices WHERE time >= '" + year + "-01-01' AND time <= '" + year + "-12-31'";
|
145
|
148
|
var query = new QSqlQuery();
|
146
|
149
|
query.exec(q);
|