Neal Wilson 11 years ago
parent
commit
e7d3be2cf9
1 changed files with 55 additions and 12 deletions
  1. 55
    12
      config/Reports/invchange.xml

+ 55
- 12
config/Reports/invchange.xml View File

@@ -89,6 +89,18 @@
89 89
 				output.writeEndElement();
90 90
 				output.writeEndElement();
91 91
 				output.writeStartElement("tbody");
92
+				var sum3 = 0;
93
+				var sum10 = 0;
94
+				var sum4 = 0;
95
+				var sum11 = 0;
96
+				var sum5 = 0;
97
+				var sum12 = 0;
98
+				var sum6 = 0;
99
+				var sum13 = 0;
100
+				var sum9 = 0;
101
+				var sum15 = 0;
102
+				var sum7 = 0;
103
+				var sum14 = 0;;
92 104
 				while(query.next())
93 105
 				{
94 106
 					output.writeStartElement("tr");
@@ -100,21 +112,52 @@
100 112
 					output.writeEndElement();
101 113
 					output.writeTextElement("td", query.value(1)); //Coffee
102 114
 					output.writeTextElement("td", query.value(2)); //Reference
103
-					output.writeTextElement("td", query.value(3)); //Starting Wt
104
-					output.writeTextElement("td", query.value(10)); //Starting Cost
105
-					output.writeTextElement("td", query.value(4)); //Purchase Wt
106
-					output.writeTextElement("td", query.value(11)); //Purchase Cost
107
-					output.writeTextElement("td", query.value(5)); //Use Wt
108
-					output.writeTextElement("td", query.value(12)); //Use Cost
109
-					output.writeTextElement("td", query.value(6)); //Sale Wt
110
-					output.writeTextElement("td", query.value(13)); //Sale Cost
111
-					output.writeTextElement("td", query.value(9)); //Adjustment Wt
112
-					output.writeTextElement("td", query.value(15)); //Adjustment Cost
113
-					output.writeTextElement("td", query.value(7)); //Ending Wt
114
-					output.writeTextElement("td", query.value(14)); //Ending Cost
115
+					output.writeTextElement("td", parseFloat(query.value(3)).toFixed(2)); //Starting Wt
116
+					output.writeTextElement("td", parseFloat(query.value(10)).toFixed(2)); //Starting Cost
117
+					output.writeTextElement("td", parseFloat(query.value(4)).toFixed(2)); //Purchase Wt
118
+					output.writeTextElement("td", parseFloat(query.value(11)).toFixed(2)); //Purchase Cost
119
+					output.writeTextElement("td", parseFloat(query.value(5)).toFixed(2)); //Use Wt
120
+					output.writeTextElement("td", parseFloat(query.value(12)).toFixed(2)); //Use Cost
121
+					output.writeTextElement("td", parseFloat(query.value(6)).toFixed(2)); //Sale Wt
122
+					output.writeTextElement("td", parseFloat(query.value(13)).toFixed(2)); //Sale Cost
123
+					output.writeTextElement("td", parseFloat(query.value(9)).toFixed(2)); //Adjustment Wt
124
+					output.writeTextElement("td", parseFloat(query.value(15)).toFixed(2)); //Adjustment Cost
125
+					output.writeTextElement("td", parseFloat(query.value(7)).toFixed(2)); //Ending Wt
126
+					output.writeTextElement("td", parseFloat(query.value(14)).toFixed(2)); //Ending Cost
115 127
 					output.writeEndElement();
128
+					sum3 += parseFloat(query.value(3));
129
+					sum10 += parseFloat(query.value(10));
130
+					sum4 += parseFloat(query.value(4));
131
+					sum11 += parseFloat(query.value(11));
132
+					sum5 += parseFloat(query.value(5));
133
+					sum12 += parseFloat(query.value(12));
134
+					sum6 += parseFloat(query.value(6));
135
+					sum13 += parseFloat(query.value(13));
136
+					sum9 += parseFloat(query.value(9));
137
+					sum15 += parseFloat(query.value(15));
138
+					sum7 += parseFloat(query.value(7));
139
+					sum14 += parseFloat(query.value(14));
116 140
 				}
117 141
 				output.writeEndElement(); // tbody
142
+				output.writeStartElement("tfoot");
143
+				output.writeStartElement("tr");
144
+				output.writeTextElement("td", "");
145
+				output.writeTextElement("td", "");
146
+				output.writeTextElement("th", "Total:");
147
+				output.writeTextElement("td", sum3.toFixed(2));
148
+				output.writeTextElement("td", sum10.toFixed(2));
149
+				output.writeTextElement("td", sum4.toFixed(2));
150
+				output.writeTextElement("td", sum11.toFixed(2));
151
+				output.writeTextElement("td", sum5.toFixed(2));
152
+				output.writeTextElement("td", sum12.toFixed(2));
153
+				output.writeTextElement("td", sum6.toFixed(2));
154
+				output.writeTextElement("td", sum13.toFixed(2));
155
+				output.writeTextElement("td", sum9.toFixed(2));
156
+				output.writeTextElement("td", sum15.toFixed(2));
157
+				output.writeTextElement("td", sum7.toFixed(2));
158
+				output.writeTextElement("td", sum14.toFixed(2));
159
+				output.writeEndElement(); // tr
160
+				output.writeEndElement(); // tfoot
118 161
 				output.writeEndElement();
119 162
 				output.writeEndElement();
120 163
 				output.writeEndElement();

Loading…
Cancel
Save