Przeglądaj źródła

Mark for translation: monthcompare.xml

Neal Wilson 9 lat temu
rodzic
commit
d5a437573a
1 zmienionych plików z 117 dodań i 106 usunięć
  1. 117
    106
      config/Reports/monthcompare.xml

+ 117
- 106
config/Reports/monthcompare.xml Wyświetl plik

@@ -13,20 +13,20 @@
13 13
     </menu>
14 14
     <program>
15 15
         <![CDATA[
16
-            this.windowTitle = "Typica - Previous Year Production Comparison By Month";
16
+            this.windowTitle = TTR("pytdprodcomp", "Typica - Previous Year Production Comparison By Month");
17 17
             var view = findChildObject(this, 'report');
18 18
             var printMenu = findChildObject(this, 'print');
19 19
             printMenu.triggered.connect(function() {
20 20
                 view.print();
21 21
             });
22
-			var unitBox = findChildObject(this, 'unit');
23
-			unitBox.addItem("Kg");
24
-			unitBox.addItem("Lb");
25
-			unitBox.currentIndex = QSettings.value("script/report_unit", 1);
26
-			unitBox['currentIndexChanged(int)'].connect(function() {
27
-				QSettings.setValue("script/report_unit", unitBox.currentIndex);
28
-				refresh();
29
-			});
22
+            var unitBox = findChildObject(this, 'unit');
23
+            unitBox.addItem(TTR("pytdprodcomp", "Kg"));
24
+            unitBox.addItem(TTR("pytdprodcomp", "Lb"));
25
+            unitBox.currentIndex = QSettings.value("script/report_unit", 1);
26
+            unitBox['currentIndexChanged(int)'].connect(function() {
27
+                QSettings.setValue("script/report_unit", unitBox.currentIndex);
28
+                refresh();
29
+            });
30 30
             function refresh() {
31 31
                 var buffer = new QBuffer;
32 32
                 buffer.open(3);
@@ -36,120 +36,131 @@
36 36
                 output.writeStartElement("html");
37 37
                 output.writeAttribute("xmlns", "http://www.w3.org/1999/xhtml");
38 38
                 output.writeStartElement("head");
39
-                output.writeTextElement("title", "Previous Year Production Comparison By Month");
39
+                output.writeTextElement("title", TTR("pytdprodcomp", "Previous Year Production Comparison By Month"));
40 40
                 output.writeEndElement();
41 41
                 output.writeStartElement("body");
42
-                output.writeTextElement("h1", "Previous Year Production Comparison By Month");
43
-				switch(unitBox.currentIndex)
44
-				{
45
-					case 0:
46
-						output.writeTextElement("p", "This report compares total roasted coffee production in kilograms with the previous year on a monthly basis.");
47
-						break;
48
-					case 1:
49
-						output.writeTextElement("p", "This report compares total roasted coffee production in pounds with the previous year on a monthly basis.");
50
-						break;
51
-				}
42
+                output.writeTextElement("h1", TTR("pytdprodcomp", "Previous Year Production Comparison By Month"));
43
+                switch(unitBox.currentIndex)
44
+                {
45
+                    case 0:
46
+                        output.writeTextElement("p", TTR("pytdprodcomp", "This report compares total roasted coffee production in kilograms with the previous year on a monthly basis."));
47
+                        break;
48
+                    case 1:
49
+                        output.writeTextElement("p", TTR("pytdprodcomp", "This report compares total roasted coffee production in pounds with the previous year on a monthly basis."));
50
+                        break;
51
+                }
52 52
                 output.writeStartElement("table");
53 53
                 output.writeAttribute("style", "page-break-after:auto;");
54 54
                 output.writeAttribute("rules", "groups");
55 55
                 output.writeAttribute("cellpadding", "3px");
56 56
                 output.writeStartElement("thead");
57 57
                 output.writeStartElement("tr");
58
-                output.writeTextElement("th", "Month");
59
-				var query = new QSqlQuery();
60
-				query.exec("SELECT EXTRACT(YEAR FROM 'now'::date) AS current_year");
61
-				query.next();
62
-				var current_year = query.value(0);
58
+                output.writeTextElement("th", TTR("pytdprodcomp", "Month"));
59
+                var query = new QSqlQuery();
60
+                query.exec("SELECT EXTRACT(YEAR FROM 'now'::date) AS current_year");
61
+                query.next();
62
+                var current_year = query.value(0);
63 63
                 output.writeTextElement("th", current_year-1);
64 64
                 output.writeTextElement("th", current_year);
65 65
                 output.writeTextElement("th", "Change");
66 66
                 output.writeEndElement();
67 67
                 output.writeEndElement();
68 68
                 output.writeStartElement("tbody");
69
-				var month_names = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
70
-				var current_data = new Array();
71
-				var previous_data = new Array();
72
-				for(var i = 0; i < 12; i++) {
73
-					var q = "SELECT SUM(roasted_quantity) FROM roasting_log WHERE roasted_id IS NOT NULL AND time > '"
74
-					q += current_year;
75
-					q += "-";
76
-					q += 1+i;
77
-					q += "-01' AND time < '";
78
-					if(i == 11) {
79
-						q += 1+current_year;
80
-					} else {
81
-						q += current_year;
82
-					}
83
-					q += "-";
84
-					if(i == 11) {
85
-						q += "01"
86
-					} else {
87
-						q += 2+i;
88
-					}
89
-					q += "-01'";
90
-					query.exec(q);
91
-					query.next();
92
-					current_data.push(query.value(0));
93
-				}
94
-				for(var i = 0; i < 12; i++) {
95
-					var q = "SELECT SUM(roasted_quantity) FROM roasting_log WHERE roasted_id IS NOT NULL AND time > '"
96
-					q += current_year-1;
97
-					q += "-";
98
-					q += 1+i;
99
-					q += "-01' AND time < '";
100
-					if(i == 11) {
101
-						q += current_year;
102
-					} else {
103
-						q += current_year-1;
104
-					}
105
-					q += "-";
106
-					if(i == 11) {
107
-						q += "01"
108
-					} else {
109
-						q += 2+i;
110
-					}
111
-					q += "-01'";
112
-					query.exec(q);
113
-					query.next();
114
-					previous_data.push(query.value(0));
115
-				}
116
-				query = query.invalidate();
117
-				for(var i = 0; i < 12; i++) {
118
-					output.writeStartElement("tr");
119
-					output.writeTextElement("td", month_names[i]);
120
-					switch(unitBox.currentIndex)
121
-					{
122
-						case 0:
123
-							output.writeTextElement("td", Number(previous_data[i] / 2.2).toFixed(2));
124
-							output.writeTextElement("td", Number(current_data[i] / 2.2).toFixed(2));
125
-							output.writeTextElement("td", Number((current_data[i] - previous_data[i]) / 2.2).toFixed(2));
126
-							break;
127
-						case 1:
128
-							output.writeTextElement("td", Number(previous_data[i]).toFixed(2));
129
-							output.writeTextElement("td", Number(current_data[i]).toFixed(2));
130
-							output.writeTextElement("td", Number(current_data[i]-previous_data[i]).toFixed(2));
131
-							break;
132
-					}
133
-					output.writeEndElement();
134
-				}
69
+                var month_names = [TTR("pytdprodcomp", "January"),
70
+                    TTR("pytdprodcomp", "February"),
71
+                    TTR("pytdprodcomp", "March"),
72
+                    TTR("pytdprodcomp", "April"),
73
+                    TTR("pytdprodcomp", "May"),
74
+                    TTR("pytdprodcomp", "June"),
75
+                    TTR("pytdprodcomp", "July"),
76
+                    TTR("pytdprodcomp", "August"),
77
+                    TTR("pytdprodcomp", "September"),
78
+                    TTR("pytdprodcomp", "October"),
79
+                    TTR("pytdprodcomp", "November"),
80
+                    TTR("pytdprodcomp", "December")];
81
+                var current_data = new Array();
82
+                var previous_data = new Array();
83
+                for(var i = 0; i < 12; i++) {
84
+                    var q = "SELECT SUM(roasted_quantity) FROM roasting_log WHERE roasted_id IS NOT NULL AND time > '"
85
+                    q += current_year;
86
+                    q += "-";
87
+                    q += 1+i;
88
+                    q += "-01' AND time < '";
89
+                    if(i == 11) {
90
+                        q += 1+current_year;
91
+                    } else {
92
+                        q += current_year;
93
+                    }
94
+                    q += "-";
95
+                    if(i == 11) {
96
+                        q += "01"
97
+                    } else {
98
+                        q += 2+i;
99
+                    }
100
+                    q += "-01'";
101
+                    query.exec(q);
102
+                    query.next();
103
+                    current_data.push(query.value(0));
104
+                }
105
+                for(var i = 0; i < 12; i++) {
106
+                    var q = "SELECT SUM(roasted_quantity) FROM roasting_log WHERE roasted_id IS NOT NULL AND time > '"
107
+                    q += current_year-1;
108
+                    q += "-";
109
+                    q += 1+i;
110
+                    q += "-01' AND time < '";
111
+                    if(i == 11) {
112
+                        q += current_year;
113
+                    } else {
114
+                        q += current_year-1;
115
+                    }
116
+                    q += "-";
117
+                    if(i == 11) {
118
+                        q += "01"
119
+                    } else {
120
+                        q += 2+i;
121
+                    }
122
+                    q += "-01'";
123
+                    query.exec(q);
124
+                    query.next();
125
+                    previous_data.push(query.value(0));
126
+                }
127
+                query = query.invalidate();
128
+                for(var i = 0; i < 12; i++) {
129
+                    output.writeStartElement("tr");
130
+                    output.writeTextElement("td", month_names[i]);
131
+                    switch(unitBox.currentIndex)
132
+                    {
133
+                        case 0:
134
+                            output.writeTextElement("td", Number(previous_data[i] / 2.2).toFixed(2));
135
+                            output.writeTextElement("td", Number(current_data[i] / 2.2).toFixed(2));
136
+                            output.writeTextElement("td", Number((current_data[i] - previous_data[i]) / 2.2).toFixed(2));
137
+                            break;
138
+                        case 1:
139
+                            output.writeTextElement("td", Number(previous_data[i]).toFixed(2));
140
+                            output.writeTextElement("td", Number(current_data[i]).toFixed(2));
141
+                            output.writeTextElement("td", Number(current_data[i]-previous_data[i]).toFixed(2));
142
+                            break;
143
+                    }
144
+                    output.writeEndElement();
145
+                }
135 146
                 output.writeEndElement();
136 147
                 output.writeStartElement("tfoot");
137
-                output.writeTextElement("th", "Totals");
138
-				var current_total = current_data.reduce(function(a,b) {return Number(a) + Number(b);}, 0);
139
-				var previous_total = previous_data.reduce(function(a,b) {return Number(a) + Number(b);}, 0);
140
-				switch(unitBox.currentIndex)
141
-				{
142
-					case 0:
143
-						output.writeTextElement("td", (previous_total/2.2).toFixed(2));
148
+                output.writeTextElement("th", TTR("pytdprodcomp", "Totals"));
149
+                var current_total = current_data.reduce(function(a,b) {return Number(a) + Number(b);}, 0);
150
+                var previous_total = previous_data.reduce(function(a,b) {return Number(a) + Number(b);}, 0);
151
+                switch(unitBox.currentIndex)
152
+                {
153
+                    case 0:
154
+                        output.writeTextElement("td", (previous_total/2.2).toFixed(2));
144 155
 						output.writeTextElement("td", (current_total/2.2).toFixed(2));
145
-						output.writeTextElement("td", ((current_total-previous_total)/2.2).toFixed(2));
146
-						break;
147
-					case 1:
148
-						output.writeTextElement("td", previous_total.toFixed(2));
149
-						output.writeTextElement("td", current_total.toFixed(2));
150
-						output.writeTextElement("td", (current_total-previous_total).toFixed(2));
151
-						break;
152
-				}
156
+                        output.writeTextElement("td", ((current_total-previous_total)/2.2).toFixed(2));
157
+                        break;
158
+                    case 1:
159
+                        output.writeTextElement("td", previous_total.toFixed(2));
160
+                        output.writeTextElement("td", current_total.toFixed(2));
161
+                        output.writeTextElement("td", (current_total-previous_total).toFixed(2));
162
+                        break;
163
+                }
153 164
                 output.writeEndElement();
154 165
                 output.writeEndElement();
155 166
                 output.writeEndElement();

Ładowanie…
Anuluj
Zapisz