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) {
}
writer.WriteXmlNodeEnd(name);
};
CT_DateTime.prototype.getCellValue = function (subtotal) {
CT_DateTime.prototype.getCellValue = function () {
var res = new AscCommonExcel.CCellValue();
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();
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;
};
function CT_Error() {
......@@ -3904,15 +3898,10 @@ CT_Number.prototype.toXml = function(writer, name) {
}
writer.WriteXmlNodeEnd(name);
};
CT_Number.prototype.getCellValue = function (subtotal) {
CT_Number.prototype.getCellValue = function () {
var res = new AscCommonExcel.CCellValue();
if (subtotal) {
res.text = this.v + subtotal;
res.type = AscCommon.CellValueType.String;
} else {
res.number = this.v;
res.type = AscCommon.CellValueType.Number;
}
res.number = this.v;
res.type = AscCommon.CellValueType.Number;
return res;
};
function CT_String() {
......@@ -4055,9 +4044,9 @@ CT_String.prototype.toXml = function(writer, name) {
}
writer.WriteXmlNodeEnd(name);
};
CT_String.prototype.getCellValue = function (subtotal) {
CT_String.prototype.getCellValue = function () {
var res = new AscCommonExcel.CCellValue();
res.text = this.v + (subtotal ? subtotal : '');
res.text = this.v;
res.type = AscCommon.CellValueType.String;
return res;
};
......
......@@ -4951,6 +4951,7 @@
var countC = pivotTable.getColumnFieldsCount();
var countR = pivotTable.getRowFieldsCount(true);
var countD = pivotTable.getDataFieldsCount();
var valuesWithFormat = [];
var cacheValuesCol = [];
var cacheValuesRow = [];
......@@ -4981,8 +4982,13 @@
cacheIndex = field.getItem(item.x[j].getV());
sharedItem = cacheFields[indexField].getSharedItem(cacheIndex.x);
// ToDo add other names by type
oCellValue = sharedItem.getCellValue(
AscCommonExcel.c_oAscItemType.Default === item.t ? ' Total' : null);
if (null !== item.t) {
oCellValue = new AscCommonExcel.CCellValue();
oCellValue.text = valuesWithFormat[r1 + r + j] + ' Total';
oCellValue.type = AscCommon.CellValueType.String;
} else {
oCellValue = sharedItem.getCellValue();
}
if (countD) {
cacheRecord = pivotTable.getValues(cacheRecord, indexField, cacheIndex.x);
......@@ -4994,6 +5000,9 @@
cells.setNum(new AscCommonExcel.Num({id: field.numFmtId}));
}
cells.setValueData(new AscCommonExcel.UndoRedoData_CellValueData(null, oCellValue));
if (null === item.t) {
valuesWithFormat[r1 + r + j] = cells.getValueWithFormat();
}
}
if (countD) {
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