Commit 23335fbf authored by Alexander.Trofimov's avatar Alexander.Trofimov

update set value with total

parent 79673cc0
...@@ -3479,18 +3479,12 @@ CT_DateTime.prototype.toXml = function(writer, name) { ...@@ -3479,18 +3479,12 @@ CT_DateTime.prototype.toXml = function(writer, name) {
} }
writer.WriteXmlNodeEnd(name); writer.WriteXmlNodeEnd(name);
}; };
CT_DateTime.prototype.getCellValue = function (subtotal) { CT_DateTime.prototype.getCellValue = function () {
var res = new AscCommonExcel.CCellValue(); var res = new AscCommonExcel.CCellValue();
var d = new Date(this.v); var d = new Date(this.v);
var v = new Date(Date.UTC(d.getYear(), d.getMonth(), d.getDay(), d.getHours(), d.getMinutes(), d.getSeconds(), res.number = new Date(Date.UTC(d.getYear(), d.getMonth(), d.getDate(), d.getHours(), d.getMinutes(), d.getSeconds(),
d.getMilliseconds())).getExcelDateWithTime(); d.getMilliseconds())).getExcelDateWithTime();
if (subtotal) {
res.text = v + subtotal;
res.type = AscCommon.CellValueType.String;
} else {
res.number = v;
res.type = AscCommon.CellValueType.Number; res.type = AscCommon.CellValueType.Number;
}
return res; return res;
}; };
function CT_Error() { function CT_Error() {
...@@ -3904,15 +3898,10 @@ CT_Number.prototype.toXml = function(writer, name) { ...@@ -3904,15 +3898,10 @@ CT_Number.prototype.toXml = function(writer, name) {
} }
writer.WriteXmlNodeEnd(name); writer.WriteXmlNodeEnd(name);
}; };
CT_Number.prototype.getCellValue = function (subtotal) { CT_Number.prototype.getCellValue = function () {
var res = new AscCommonExcel.CCellValue(); var res = new AscCommonExcel.CCellValue();
if (subtotal) {
res.text = this.v + subtotal;
res.type = AscCommon.CellValueType.String;
} else {
res.number = this.v; res.number = this.v;
res.type = AscCommon.CellValueType.Number; res.type = AscCommon.CellValueType.Number;
}
return res; return res;
}; };
function CT_String() { function CT_String() {
...@@ -4055,9 +4044,9 @@ CT_String.prototype.toXml = function(writer, name) { ...@@ -4055,9 +4044,9 @@ CT_String.prototype.toXml = function(writer, name) {
} }
writer.WriteXmlNodeEnd(name); writer.WriteXmlNodeEnd(name);
}; };
CT_String.prototype.getCellValue = function (subtotal) { CT_String.prototype.getCellValue = function () {
var res = new AscCommonExcel.CCellValue(); var res = new AscCommonExcel.CCellValue();
res.text = this.v + (subtotal ? subtotal : ''); res.text = this.v;
res.type = AscCommon.CellValueType.String; res.type = AscCommon.CellValueType.String;
return res; return res;
}; };
......
...@@ -4951,6 +4951,7 @@ ...@@ -4951,6 +4951,7 @@
var countC = pivotTable.getColumnFieldsCount(); var countC = pivotTable.getColumnFieldsCount();
var countR = pivotTable.getRowFieldsCount(true); var countR = pivotTable.getRowFieldsCount(true);
var countD = pivotTable.getDataFieldsCount(); var countD = pivotTable.getDataFieldsCount();
var valuesWithFormat = [];
var cacheValuesCol = []; var cacheValuesCol = [];
var cacheValuesRow = []; var cacheValuesRow = [];
...@@ -4981,8 +4982,13 @@ ...@@ -4981,8 +4982,13 @@
cacheIndex = field.getItem(item.x[j].getV()); cacheIndex = field.getItem(item.x[j].getV());
sharedItem = cacheFields[indexField].getSharedItem(cacheIndex.x); sharedItem = cacheFields[indexField].getSharedItem(cacheIndex.x);
// ToDo add other names by type // ToDo add other names by type
oCellValue = sharedItem.getCellValue( if (null !== item.t) {
AscCommonExcel.c_oAscItemType.Default === item.t ? ' Total' : null); oCellValue = new AscCommonExcel.CCellValue();
oCellValue.text = valuesWithFormat[r1 + r + j] + ' Total';
oCellValue.type = AscCommon.CellValueType.String;
} else {
oCellValue = sharedItem.getCellValue();
}
if (countD) { if (countD) {
cacheRecord = pivotTable.getValues(cacheRecord, indexField, cacheIndex.x); cacheRecord = pivotTable.getValues(cacheRecord, indexField, cacheIndex.x);
...@@ -4994,6 +5000,9 @@ ...@@ -4994,6 +5000,9 @@
cells.setNum(new AscCommonExcel.Num({id: field.numFmtId})); cells.setNum(new AscCommonExcel.Num({id: field.numFmtId}));
} }
cells.setValueData(new AscCommonExcel.UndoRedoData_CellValueData(null, oCellValue)); cells.setValueData(new AscCommonExcel.UndoRedoData_CellValueData(null, oCellValue));
if (null === item.t) {
valuesWithFormat[r1 + r + j] = cells.getValueWithFormat();
}
} }
if (countD) { if (countD) {
cacheValuesCol.push(cacheRecord); cacheValuesCol.push(cacheRecord);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment