|
@@ -201,30 +201,32 @@
|
201
|
201
|
var prev_balance = "0";
|
202
|
202
|
var prev_prec = 0;
|
203
|
203
|
var cur_prec = 0;
|
|
204
|
+ var max_prec = 3;
|
204
|
205
|
while(query.next()) {
|
205
|
206
|
output.writeStartElement("tr");
|
206
|
207
|
output.writeAttribute("class", query.value(1));
|
207
|
208
|
output.writeTextElement("td", query.value(0));
|
208
|
209
|
output.writeTextElement("td", query.value(1));
|
|
210
|
+ var split = prev_balance.split('.');
|
|
211
|
+ if(split.length > 1) {
|
|
212
|
+ prev_prec = split[1].length;
|
|
213
|
+ } else {
|
|
214
|
+ prev_prec = 0;
|
|
215
|
+ }
|
|
216
|
+ split = query.value(2).split('.');
|
|
217
|
+ if(split.length > 1) {
|
|
218
|
+ cur_prec = split[1].length;
|
|
219
|
+ } else {
|
|
220
|
+ cur_prec = 0;
|
|
221
|
+ }
|
|
222
|
+ var prec = prev_prec > cur_prec ? prev_prec : cur_prec;
|
|
223
|
+ var prec = (prec > max_prec ? max_prec : prec);
|
209
|
224
|
if(query.value(1) == "INVENTORY") {
|
210
|
|
- var split = prev_balance.split('.');
|
211
|
|
- if(split.length > 1) {
|
212
|
|
- prev_prec = split[1].length;
|
213
|
|
- } else {
|
214
|
|
- prev_prec = 0;
|
215
|
|
- }
|
216
|
|
- split = query.value(2).split('.');
|
217
|
|
- if(split.length > 1) {
|
218
|
|
- cur_prec = split[1].length;
|
219
|
|
- } else {
|
220
|
|
- cur_prec = 0;
|
221
|
|
- }
|
222
|
|
- var prec = prev_prec > cur_prec ? prev_prec : cur_prec;
|
223
|
|
- output.writeTextElement("td", (Number(query.value(2)) - Number(prev_balance)).toFixed(prec));
|
|
225
|
+ output.writeTextElement("td", (Number(query.value(2)) - Number(prev_balance)).toFixed(prec));
|
224
|
226
|
} else {
|
225
|
|
- output.writeTextElement("td", query.value(2));
|
|
227
|
+ output.writeTextElement("td", (Number(query.value(2)).toFixed(prec)));
|
226
|
228
|
}
|
227
|
|
- output.writeTextElement("td", query.value(3));
|
|
229
|
+ output.writeTextElement("td", (Number(query.value(3)).toFixed(prec)));
|
228
|
230
|
prev_balance = query.value(3);
|
229
|
231
|
if(query.value(1) == "PURCHASE") {
|
230
|
232
|
output.writeStartElement("td");
|