Commit 9f294850 authored by kevin's avatar kevin

Merge branch 'dev_mysql' of http://code.tech.tax.asia.pwcinternal.com/root/atms into dev_mysql

parents e6f5468d e13c5c4a
......@@ -171,11 +171,9 @@ public class CitReportServiceImpl extends BaseService {
try {
//根据projectId获取相关报表
List<Template> templates = getTemplatesByProjectId(projectId);
//因WrapPeriodJobDto.createReportGenJob方法需要传入数组,但CIT并不需要所以传入一个空数组
List<String> dataValidateArray = new ArrayList<String>();
/*dataValidateArray.add("DA001");
dataValidateArray.add("DA002");
dataValidateArray.add("DA003");*/
dataValidateArray.add("DA004");
PeriodJob genJob = WrapPeriodJobDto.createReportGenJob(projectId, periodParam, templates, dataValidateArray);
periodJobMapper.insert(genJob);
......@@ -186,7 +184,7 @@ public class CitReportServiceImpl extends BaseService {
updateConfig(projectId, periodParam, isMergeManualData, templates, genJob);
// TODO 进行数据校验
DataValidation(periodParam, projectId, genJob);
// DataValidation(periodParam, projectId, genJob);
PeriodResources resources = reportGenerator.getPeriodResources(projectId, periodParam,
templates.stream().map(Template::getId).collect(Collectors.toList()));
......@@ -199,6 +197,9 @@ public class CitReportServiceImpl extends BaseService {
FormulaEvaluator evaluator = workbook.getCreationHelper().createFormulaEvaluator();
evaluator.evaluateAll();
setStatus(genJob, STATUS_END);
periodJobMapper.updateByPrimaryKey(genJob);
reportGenerator.updateWorkbookCaclsValueToDb(projectId, periodParam, workbook, resources, isMergeManualData, genJob);
setStatus(genJob, STATUS_END);
periodJobMapper.updateByPrimaryKey(genJob);
......@@ -362,8 +363,7 @@ public class CitReportServiceImpl extends BaseService {
clearPeriodData(projectId, period, exceptTemplateIds, isMergeManualData);
//复制配置
copyTemplateAndConfigFromAdmin(projectId, templates, period);
setStatus(job, STATUS_END);
periodJobMapper.updateByPrimaryKey(job);
}
/**
......
......@@ -1047,7 +1047,7 @@ init-row="initRow" init-col="initCol" service-type="\'6\'" is-document-list="tru
$stateProvider.state({
name: 'cit.generateReport.reportView',
url: '/reportView?{id:string}&{templateid:string}&{name:string}&{templatecode:string}&{initrow:any}&{initcol:any}&{parentviewid:string}',
url: '/reportView?{id:string}&{templateid:string}&{name:string}&{templatecode:string}',
views: {
'@cit.generateReport': {
controller: ['$scope', '$stateParams', 'appTranslation',
......@@ -1056,13 +1056,9 @@ init-row="initRow" init-col="initCol" service-type="\'6\'" is-document-list="tru
$scope.templateId = $stateParams.templateid;
$scope.templateName = $stateParams.name;
$scope.templateCode = $stateParams.templatecode;
$scope.initRow = $stateParams.initrow;
$scope.initCol = $stateParams.initcol;
$scope.parentViewId = $stateParams.parentviewid;
appTranslation.load([appTranslation.cit]);
}],
template: '<vat-report-view report-id="reportId" template-id="templateId" template-name="templateName" template-code="templateCode" \
init-row="initRow" init-col="initCol" service-type="\'6\'" show-col="false" is-read-only="true" parent-view-id="parentViewId"></vat-report-view>',
template: '<cit-report-view report-id="reportId" template-id="templateId" template-name="templateName" template-code="templateCode" service-type="\'6\'"></cit-report-view>',
}
},
resolve: scriptDependencyProvider.createDependenciesMap(scriptDependencyProvider.cit),
......
......@@ -212,9 +212,9 @@ debugger;
result[result.length - 1].items.forEach(function (t) { t.seqNo = result.length - 1 });
//数据校验
var reItem = [];
reItem.push( new task(Math.ceil(Math.random()*1000000).toString(), "unstarted","上期导入调整表是否等于本期调整日记账发生额(摘要中包含“调表不调账”关键字)", "DA004"));
result.push({ name: $translate.instant('dataValidate'),isReportTask: true, items : reItem});
// var reItem = [];
// reItem.push( new task(Math.ceil(Math.random()*1000000).toString(), "unstarted","上期导入调整表是否等于本期调整日记账发生额(摘要中包含“调表不调账”关键字)", "DA004"));
// result.push({ name: $translate.instant('dataValidate'),isReportTask: true, items : reItem});
fixedRef = [];
if (report && report.data && report.data.data) {
......@@ -578,6 +578,7 @@ debugger;
var tasks = JSON.parse(job.status);
debugger;
if(job.jobStatus == 'End'){
debugger;
items.forEach(function(item,index){
debugger;
item.status = 'completed';
......@@ -586,8 +587,8 @@ debugger;
$scope.tasks[0].items[0].status = 'completed';
$scope.tasks[0].items[0].text= $translate.instant('completed');
$scope.tasks[tasks.length-1].items[items.length-1].status = 'completed';
$scope.tasks[tasks.length-1].items[items.length-1].status.text = $translate.instant(_task.status);
// $scope.tasks[tasks.length-1].items[items.length-1].status = 'completed';
// $scope.tasks[tasks.length-1].items[items.length-1].status.text = $translate.instant(_task.status);
if($scope.timer){
$interval.cancel($scope.timer);
vatCommonService.setProjectStatus(vatSessionService.project.id, vatSessionService.month, constant.ProjectStatusEnum.Generated
......
......@@ -161,7 +161,7 @@
var firstSubNode = _.first(firstNode.children);
if(firstSubNode.id!==undefined) {
$scope.selectedTemplateId = firstSubNode.id;
$state.go('vat.generateReport.reportView', {
$state.go('cit.generateReport.reportView', {
id: firstSubNode.reportId,
templateid: firstSubNode.id,
name: firstSubNode.name,
......
commonModule.directive('citReportSheet', ['$rootScope', '$log', '$timeout', '$q', 'templateService', 'enums', 'keyValueDataService', 'spreadJsTipService',
'$interval', 'vatSessionService',
function ($rootScope, $log, $timeout, $q, templateService, enums, keyValueDataService, spreadJsTipService, $interval, vatSessionService) {
'use strict';
$log.debug('citReportSheet.ctor()...');
return {
restrict: 'E',
template: '<div class="report" style="height: 100%;"></div>',
replace: true,
scope: {
templateId: '=',
spread: '=',
reportSource: '=',
formulaBlocks: '=',
manualDataSources: '=',
isReadOnly: '=',
serviceType: '=',
initRow: '=?',
initCol: '=?',
reportApi: '=?' // In: onCellClick, onCellDoubleClick; Out: refreshReport
},
link: function (scope, element) {
$log.debug('vatReportSheet.link()...');
// Register api functions in internalApi
// If selectorApi passed is not undefined, we will use it as internalApi
scope.internalApi = scope.reportApi || {};
scope.projectYear = vatSessionService.year;
scope.projectPeriod = scope.serviceType === enums.serviceType.VAT ? vatSessionService.month : 0;
scope.$watch('templateId', function (newVal, oldValue) {
if (newVal !== oldValue) {
loadSheet(newVal);
}
});
scope.$watchGroup(['reportSource', 'formulaBlocks', 'manualDataSources', 'templateId', 'hasLoadSpread'], function (newVal, oldValue) {
if (scope.templateId && scope.reportSource && scope.hasLoadSpread) {
setData();
}
});
// 首次进入页面时,通过promise模式保证在加载完成后再调用locateCell以focus在特定单元格
// 如果是在当前页面要focus在特定单元格,通过watch行列号来完成
scope.$watchGroup(['initRow', 'initCol'], function (newVal, oldVal) {
if (_.isNumber(scope.initRow) && _.isNumber(scope.initCol)) {
var spreadCtrl = getSpreadControl();
if (spreadCtrl) {
locateCell(spreadCtrl);
}
spreadCtrl = null;
}
});
var locateCell = function (spread, forceCloseModal) {
if (_.isNumber(scope.initRow) && _.isNumber(scope.initCol)) {
var sheet;
if (constant.regesterInformation.active) {
sheet = spread.getActiveSheet();
}
else {
sheet = spread.getSheet(1);
}
//var sheet = spread.getActiveSheet();
//var sheet = spread.getSheet(1);
sheet.setSelection(scope.initRow, scope.initCol, 1, 1);
if (_.isFunction(scope.internalApi.onCellClick) && !forceCloseModal) {
scope.internalApi.onCellClick({
'args': {row: scope.initRow, col: scope.initCol},
'data': JSON.parse(sheet.getTag(scope.initRow, scope.initCol))
});
}
$log.debug(sheet.getTag(scope.initRow, scope.initCol));
scope.initRow = null;
scope.initCol = null;
sheet = null;
return $q.when();
}
};
var loadSheet = function (templateId) {
var prokjectId = vatSessionService.project.id;
var period = 0;
return templateService.getPeriodTemplateJson(templateId,period,prokjectId).then(function (reportSpread) {
var spreadCtrl = getSpreadControl();
if (spreadCtrl) {
spreadCtrl.destroy();
}
spreadCtrl = null;
if (!_.isEmpty(reportSpread)) {
initSpreadExcel(reportSpread).then(function (spread) {
return locateCell(spread, true);
});
}
}, function (data) {
$log.info(data);
});
};
var initSpreadExcel = function (reportSpread) {
var spread = new GC.Spread.Sheets.Workbook(getSpreadControlElement());
spread.suspendPaint();
spread.fromJSON(reportSpread);
spread.options.showVerticalScrollbar = true;
spread.options.showHorizontalScrollbar = true;
spread.options.scrollbarMaxAlign = true;
spread.options.scrollbarShowMax = true;
spread.options.tabNavigationVisible = true;
if (constant.regesterInformation.active) {
spread.options.tabEditable = false;
spread.options.tabStripVisible = false;
spread.options.newTabVisible = false;
}
spread.options.allowUndo = false;
spread.options.allowUserResize = false;
spread.options.allowUserDragDrop = false;
spread.options.allowUserDragFill = false;
spread.options.allowUserEditFormula = false;
spread.options.allowContextMenu = false;
initInterFunction(spread);
//todo:注册之后这里去掉注释
//var sheet = spread.getActiveSheet();
var sheet;
if (constant.regesterInformation.active) {
sheet = spread.getActiveSheet();
}
else {
sheet = spread.getSheet(1);
}
if (sheet != null) {
sheet.options.rowHeaderVisible = true;
sheet.options.colHeaderVisible = true;
sheet.options.gridline.showVerticalGridline = false;
sheet.options.gridline.showHorizontalGridline = false;
sheet.options.isProtected = true;
if (scope.isReadOnly) {
setEditable(spread, true, false);
}
//setCellFormula(template.id, sheet);
//给单元格增加双击事件
sheet.bind(GC.Spread.Sheets.Events.CellDoubleClick, function (sender, args) {
scope.$apply(function () {
if (_.isFunction(scope.internalApi.onCellDoubleClick) && args.sheet.getTag(args.row, args.col)) {
scope.internalApi.onCellDoubleClick({
'sender': sender,
'args': args,
'templateId' : scope.templateId,
'data': JSON.parse(args.sheet.getTag(args.row, args.col))
});
$log.debug(args.sheet.getTag(args.row, args.col));
}
});
});
//给单元格增加单击事件
sheet.bind(GC.Spread.Sheets.Events.CellClick, function (sender, args) {
scope.$apply(function () {
if (window.event.ctrlKey) {
var data = JSON.parse(args.sheet.getTag(args.row, args.col));
if (!_.isEmpty(data) && !_.isEmpty(data.dataSourceList)) {
var reports = _.chain(data.dataSourceList)
.where({type: enums.formulaDataSourceType.Report})
.map(function (x) {
return {
reportCode: x.reportCode,
year: x.year,
period: x.period
};
}).uniq(function (x) {
return x.reportCode + ',' + x.year + ',' + x.period;
}).value();
if (reports.length === 1) {
var drillDownArgs = _.findWhere(data.dataSourceList, {type: enums.formulaDataSourceType.Report});
if (drillDownArgs.period === scope.projectPeriod && drillDownArgs.year === scope.projectYear) {
drillDownArgs = {
reportID: drillDownArgs.reportID,
reportTemplateID: drillDownArgs.reportTemplateID,
reportName: drillDownArgs.reportName,
reportCode: drillDownArgs.reportCode,
cellName: PWC.numToExcelChar(drillDownArgs.rowIndex, drillDownArgs.columnIndex)
};
scope.$emit(enums.vatEvent.reportDrillDown, drillDownArgs);
}
}
}
}
else if (_.isFunction(scope.internalApi.onCellClick) && args.sheet.getTag(args.row, args.col)) {
scope.internalApi.onCellClick({
'sender': sender,
'args': args,
'data': JSON.parse(args.sheet.getTag(args.row, args.col))
});
$log.debug(args.sheet.getTag(args.row, args.col));
}
});
});
// 编辑完成后记录更新的单元格,适用于isReadOnly为false时
sheet.bind(GC.Spread.Sheets.Events.EditEnded, function (sender, args) {
scope.$apply(function () {
var cell = sheet.getCell(args.row, args.col);
var newVal = cell.value();
var cellInfo = _.find(scope.reportSource, {rowIndex: args.row, columnIndex: args.col});
if (cellInfo) {
cellInfo.value = newVal;
cellInfo.isDirty = true;
}
$log.debug("Edit cell (" + args.row + ", " + args.col + ")");
});
});
sheet.clearSelection();
}
spread.resumePaint();
// spread.isPaintSuspended(false);
scope.spread = spread;
scope.hasLoadSpread = true;
return $q.when(spread);
};
var setEditable = function (spread, isReadOnly, ifSuspend) {
//todo:注册之后这里去掉注释
var sheet;
if (constant.regesterInformation.active) {
sheet = spread.getActiveSheet();
}
else {
sheet = spread.getSheet(1);
}
if (sheet != null) {
if (ifSuspend) {
spread.suspendPaint();
}
}
// isReadOnly为true时,设置整个sheet不可编辑
if (isReadOnly) {
for (var row = 0; row < sheet.getRowCount(); row++) {
for (var column = 0; column < sheet.getColumnCount(); column++) {
try {
sheet.getCell(row, column).locked(true);
}
catch (e) {
}
}
}
}
else {
// isReadOnly为false时,设置无配置单元格不可编辑,有配置单元格可编辑
for (var i = 0; i < scope.reportSource.length; i++) {
var cell = scope.reportSource[i];
sheet.getCell(cell.rowIndex, cell.columnIndex).locked(false);
}
for (var x = 0; x < sheet.getRowCount(); x++) {
for (var y = 0; y < sheet.getColumnCount(); y++) {
var idx = _.findIndex(scope.reportSource, {rowIndex: x, columnIndex: y});
if (idx < 0) {
sheet.getCell(x, y).locked(true);
}
}
}
}
sheet.options.isProtected = true;
sheet.options.protectionOptions = {
allowEditObjects: false
};
if (sheet != null) {
if (ifSuspend) {
spread.resumePaint();
}
}
};
// 每个单元格大致由以下部分构成:_SumAll(_Inter(...)+_Manual(...)+C1)
// _Inter: IronPython公式计算结果
// _Manual: 手工数据源值
// C1: 类似的Excel公式,通过SpreadJS公式引擎计算
var initInterFunction = function (spread) {
// var interFunc = function () {
// };
// interFunc.prototype = new GcSpread.Sheets.Calc.Functions.Function("_Inter", 1, 1);
// interFunc.prototype.evaluate = function (args) {
// if (args.length !== 1 || isNaN(parseInt(args))) {
// return "#VALUE!";
// }
//
// var idx = args[0];
// var b = _.findWhere(scope.formulaBlocks, {index: idx});
// if (b) {
// var rtn = b.data;
// rtn = PWC.tryParseStringToNum(rtn);
//
// return rtn;
// }
//
// return null;
// };
var activeSheet;
if (constant.regesterInformation.active) {
activeSheet = spread.getActiveSheet();
}
else {
activeSheet = spread.getSheet(1);
}
var manualFunc = function () {
};
manualFunc.prototype = new GC.Spread.CalcEngine.Functions.Function("_Manual", 1, 1);
manualFunc.prototype.evaluate = function (args) {
if (!_.isString(args)) {
return "#VALUE!";
}
//var cellTemplateID = Number(args);
var ds = _.where(scope.manualDataSources, {item1: args});
if (!_.isEmpty(ds)) {
return _.reduce(ds, function (memo, x) {
if (x.item2.dataSourceType === 6) {
var rtn = x.item2.amount;
rtn = PWC.tryParseStringToNum(rtn);
// 如果是数值数据源,只有OperationType为2时,该数据源的数值应被减去;其他情况下应被加上
if (_.isNumber(rtn) && !isNaN(rtn)) {
var operationType = x.item2.operationType;
rtn = operationType === 2 ? (-rtn) : rtn;
}
return memo + rtn;
}
else {
return memo;
}
}, 0);
}
return 0;
};
//var sumAllFunc = function () { };
//sumAllFunc.prototype = new GcSpread.Sheets.Calc.Functions.Function("_SumAll", 1, 255);
//sumAllFunc.prototype.evaluate = function (args) {
// if (args.length < 1) {
// return "";
// }
// var rtn = args[0];
// if (args.length === 1 && (_.isNull(rtn) || _.isUndefined(rtn))) {
// rtn = "";
// }
// else {
// // 下面这种奇怪的写法是为了保证在reduce过程中累计值的类型正确
// rtn = _.reduce(args.slice(1), function (memo, x) {
// return memo + x;
// }, rtn);
// }
// return rtn;
//};
spread.clearCustomFunctions();
//spread.addCustomFunction(new interFunc());
activeSheet.addCustomFunction(new manualFunc());
//spread.addCustomFunction(new sumAllFunc());
};
var layoutChangedFunc = scope.$on(enums.vatEvent.layoutChanged, function () {
repaintSpread();
});
// TODO: 手工修改单元格值之后,更新单元格状态
var cellValueModifiedFunc = $rootScope.$on('cellValueModified', function (event, args) {
var modifiedReportCell = args.modifiedReportCell;
var cell = scope.reportSource.filter(function (data) {
return data.rowIndex === modifiedReportCell.row && data.columnIndex === modifiedReportCell.col;
})[0];
cell.value = modifiedReportCell.value;
cell.isModified = true;
cell.modifiedReportCell = modifiedReportCell;
setData();
});
var cellValueResetFunc = $rootScope.$on('cellValueReset', function (event, args) {
var cell = scope.reportSource.filter(function (data) {
return data.rowIndex === args.row && data.columnIndex === args.col;
})[0];
cell.value = cell.modifiedReportCell ? cell.modifiedReportCell.originalValue : cell.value;
cell.isModified = false;
cell.modifiedReportCell = null;
setData();
});
scope.$on('$destroy', function () {
layoutChangedFunc();
cellValueModifiedFunc();
cellValueResetFunc();
});
// Get spreadJS control.
var getSpreadControl = function () {
return new GC.Spread.Sheets.Workbook(getSpreadControlElement());
};
// Get spreadJS control element
var getSpreadControlElement = function () {
//var elem = document.getElementsByClassName('report-view');
var elem = document.getElementById('r_' + scope.templateId);
if (!elem) {
var elems = document.getElementsByClassName('report');
if (!elems || elems.length === 0) {
return undefined;
}
return elems[0];
}
return elem;
};
var repaintSpread = function () {
return $timeout(function () {
var spread = getSpreadControl();
if (spread && spread.refresh) {
spread.refresh();
}
}, 50);
};
// 根据已有信息通过spreadJS计算各单元格的值
var setData = function () {
var sheet = scope.spread.sheets[0];
var isExportData = false;
if (angular.isArray(scope.reportSource)) {
spreadJsTipService.initialize(sheet);
if (!scope.isReadOnly) {
setEditable(scope.spread, false, true);
}
scope.reportSource.forEach(function (data) {
//fix bug11737 导出需要显示千分位
// 避免直接使用data.value = parseFloat(data.value)导致非数字型value无法显示
data.value = PWC.tryParseStringToNum(data.value);
if (data.isExportData) {//导出报表时,设置单元格的公式信息
isExportData = true;
if (data.isFormula) {
//获取单元格除公式值之外的剩余值
var subValue = 0;
if (data.dataSourceList && data.dataSourceList.length > 0) {
data.dataSourceList.forEach(function (dataSource) {
var cellName = PWC.numToExcelChar(dataSource.rowIndex, dataSource.columnIndex);
if (dataSource.type != enums.formulaDataSourceType.Report && dataSource.amount) {
subValue += parseFloat(dataSource.amount + '');
}
});
}
sheet.setFormula(data.rowIndex, data.columnIndex, '=' + data.formula + (subValue ? ('+' + subValue) : ''));
} else {
sheet.setValue(data.rowIndex, data.columnIndex, data.value);
}
} else { // 显示报表时,设置单元格的值或公式
var cell = sheet.getCell(data.rowIndex, data.columnIndex);
if (data.isModified
|| (data.dataVoucherList && data.dataVoucherList.length)
|| (data.dataInvoiceList && data.dataInvoiceList.length)
|| (data.dataSourceList && data.dataSourceList.length
&& _.some(data.dataSourceList, function (dataSource) {
return dataSource.dataSourceType === 6 && dataSource.amount
}))
) { // 存在用户手工输入值,需要改变底色
cell.backColor('#fbe8cc');
}
if (!_.isEmpty(data.dataSourceList)) {
var reports = _.chain(data.dataSourceList)
.where({type: enums.formulaDataSourceType.Report})
.map(function (x) {
return {
reportCode: x.reportCode,
year: x.year,
period: x.period
};
}).uniq(function (x) {
return x.reportCode + ',' + x.year + ',' + x.period;
}).value();
if (reports.length === 1) {
var drillDownArgs = _.findWhere(data.dataSourceList, {type: enums.formulaDataSourceType.Report});
if (drillDownArgs.period === scope.projectPeriod && drillDownArgs.year === scope.projectYear) {
// cell.textDecoration(GcSpread.Sheets.TextDecorationType.Underline);
cell.foreColor('blue');
}
}
}
// 设置顺序: 非数值字符串 -> 单元格值覆盖修改 -> 公式或手工数据源 -> 数值
var ifShowParseFloat = true; // 用于标识单元格是否设置成数值
if(data.dataSourceList && data.dataSourceList.length > 0 && data.dataSourceList[0].keyinData){
// sheet.getCell(data.rowIndex, data.columnIndex).cellType(new GC.Spread.Sheets.CellTypes.Text());
sheet.setValue(data.rowIndex, data.columnIndex, data.dataSourceList[0].keyinData+" ");
ifShowParseFloat = false; // 非数值字符串,单元格设置为字符串
// data.value = data.dataSourceList[0].keyinData;
}
// else if(_.isString(data.keyinData) && data.keyinData.length > 0 && isNaN(Number(data.keyinData))){
// sheet.setValue(data.rowIndex, data.columnIndex, data.keyinData);
// ifShowParseFloat = false; // 非数值字符串,单元格设置为字符串
// data.value = data.keyinData;
// }
else if (_.isString(data.value) && data.value.length > 0 && isNaN(Number(data.value))) {
sheet.setValue(data.rowIndex, data.columnIndex, data.value);
ifShowParseFloat = false; // 非数值字符串,单元格设置为字符串
}
else if (data.isModified) { // 覆盖修改,且新值是数字
if (_.isNumber(data.value) && !isNaN(data.value)) {
data.value = data.value.toFixed(4);
}
sheet.setValue(data.rowIndex, data.columnIndex, data.value);
ifShowParseFloat = false; // 单元格值覆盖修改
}
else if (!data.isReadOnly && !scope.isReadOnly) { // 非只读report(资料清单)且非只读单元格
ifShowParseFloat = true;
}
else if (data.cellTemplateConfig) {
var parsedFormula = data.cellTemplateConfig.parsedFormula;
if (data.cellTemplateConfig.hasInvoice || data.cellTemplateConfig.hasKeyIn
|| data.cellTemplateConfig.hasModel || data.cellTemplateConfig.hasVoucher) {
if (!_.isEmpty(parsedFormula)) {
parsedFormula = parsedFormula + '+_Manual("' + data.cellTemplateID + '")';
}
else {
parsedFormula = '_Manual("' + data.cellTemplateID + '")';
}
}
if (!_.isEmpty(parsedFormula)) {
parsedFormula = 'IFERROR(' + parsedFormula + ', "")';
sheet.setFormula(data.rowIndex, data.columnIndex, '=' + parsedFormula);
ifShowParseFloat = false; // 有公式或手工数据源,单元格设置为公式
}
}
if (ifShowParseFloat) {
if (_.isNumber(data.value) && !isNaN(data.value)) {
data.value = data.value.toFixed(4);
}
sheet.setValue(data.rowIndex, data.columnIndex, data.value); // 只有数值,设置为数值
}
}
sheet.setTag(data.rowIndex, data.columnIndex, JSON.stringify(data));
//设置 tooltip 和 图标信息
spreadJsTipService.setCellTipByCellData(sheet.getCell(data.rowIndex, data.columnIndex), data);
});
// 设置破折号单元格的值和显示格式,将其替换为带破折号格式的0值,这样引用到的其他单元格才能正常计算
var rowCount = sheet.getRowCount();
var columnCount = sheet.getColumnCount();
for (var r = 0; r < rowCount; r++) {
for (var c = 0; c < columnCount; c++) {
var cell = sheet.getCell(r, c);
if (cell.value() === '——') {
cell.value(0);
cell.formatter("[=0]——;0.00");
}
}
}
spreadJsTipService.paintSheet(sheet);
}
};
// 更新数据源后,通过调用该方法计算所有当前sheet单元格,并通过比较原数据列表与spreadJS计算的新值列表,获取保存时需要修改库中Value的单元格信息列表
var updateCells = function () {
setData();
var sheet = getSpreadControl().sheets[0];
var cells = [];
var reportDataSources = _.chain(scope.reportSource)
.pluck('dataSourceList')
.flatten(true).value();
angular.forEach(scope.reportSource, function (x) {
// 比较刷新前后报表中的值的变化
// 优先将单元格转换成数值比较,如果不能则转换为字符串比较
var cell = sheet.getCell(x.rowIndex, x.columnIndex);
var newVal = cell.value();
newVal = PWC.tryParseStringToNum(newVal);
if (_.isBoolean(newVal)) {
newVal = newVal.toString();
}
else if (_.isNumber(newVal) && !isNaN(newVal)) {
newVal = newVal.toFixed(4);
}
if(x.keyinData){
sheet.setValue(x.rowIndex, x.columnIndex, x.keyinData);
}
var oldVal = x.value;
oldVal = PWC.tryParseStringToNum(oldVal);
if (_.isBoolean(oldVal)) {
oldVal = oldVal.toString();
}
else if (_.isNumber(oldVal) && !isNaN(oldVal)) {
oldVal = oldVal.toFixed(4);
}
if (newVal !== oldVal) {
cells.push({id: x.cellID, oldVal: oldVal, newVal: newVal});
x.value = newVal;
x.isDirty = true;
var dirtyDataSources = _.filter(reportDataSources, {
cellDataID: x.cellID,
name: 'ReportDataSource'
});
angular.forEach(dirtyDataSources, function (ds) {
newVal = PWC.tryParseStringToNum(newVal);
ds.amount = newVal;
});
sheet.setTag(x.rowIndex, x.columnIndex, JSON.stringify(x));
}
});
loadSheet(scope.templateId);
return cells;
};
(function initialize() {
loadSheet(scope.templateId);
if (scope.internalApi) {
scope.internalApi.refreshReport = updateCells;
}
})();
}
};
}
]);
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
<div class='cit-report-view'>
<!--Report SpreadJS-->
<div ng-if="!isDocumentList" class="row">
<span ng-if="!isBSPL" ng-click="openExportPop('export');"><i class="fa fa-download"></i>&nbsp;{{'ExportExcel' | translate}}</span>
<span ng-if="!isBSPL" ng-click="commitApprove();"><i
class="fa fa-floppy-o"></i>&nbsp;{{'报表提审'}}</span>
<span ng-if="!isBSPL" ng-click="doApprove();"><i
class="fa fa-floppy-o"></i>&nbsp;{{'报表审批'}}</span>
<span ng-if="!isBSPL" ng-click="upLoadManual();"><i
class="fa fa-floppy-o"></i>&nbsp;{{'上传手工数据'}}
</span>
<span ng-if="!isBSPL" ng-click="openExportPop('upload');"><i class="fa fa-upload"></i>&nbsp;{{'UploadExcel' | translate}}</span>
<!--<span ng-if="!isBSPL" ng-click="saveReportCache();"><i-->
<!--class="fa fa-floppy-o"></i>&nbsp;{{'Save' | translate}}</span>-->
</div>
<div class='report-container' id="reportContainer">
<cit-report-sheet id='report-view' report-source="reportData" formula-blocks="formulaBlocks"
is-read-only="!isDocumentList"
manual-data-sources="manualDataSources" spread='spread' template-id='templateId'
report-api="reportApi"
service-type="serviceType" init-row="initRow" init-col="initCol">
</cit-report-sheet>
</div>
<cell-detail-panel detail="cellDetail" id="cell-detail" source-type="isBSPLSpecial"></cell-detail-panel>
<tax-report-cell-detail-modal on-confirm="confirm()" detail="taxCellDetail" id="tax-cell-detail" active-sheet = "activeSheet"
<!--service-type="serviceType"
on-update-data-source="updateCellByManualChange(manualData)"
on-delete-data-source="updateCellByManualSourceDelete(dataSourceId, cellId)"
on-delete-data-source-detail="updateCellBySourceDetailDelete(dataSource, detailId, opType)"-->>
</tax-report-cell-detail-modal>
<vat-operate-log period="period" module-type="moduleid" is-show="isShowLog"></vat-operate-log>
<div class='export-container hidden'></div>
<div id="export" class="hidden"></div>
<!-- 报表审核弹出框 -->
<script type="text/ng-template" id="model-report-approve-log.html" class="model-report-approve-popup">
<div class="modal-header">
<div class="modal-title" style="margin-bottom:10px">
{{'ApproveProcess' | translate}}<i class="fa fa-times" aria-hidden="true"
style="float: right; font-size: 11px; color: #CF2D1B"
ng-click="closeModal()"></i>
</div>
</div>
<div class="modal-body">
<div style="margin-bottom:10px">{{ApproveTitle}}</div>
<table>
<tr>
<td style="vertical-align:text-top">{{'Memo'|translate}}</td>
<td><textarea id="txtRemarks" style="width:300px;height:100px"></textarea></td>
</tr>
</table>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-vat-primary" ng-click="popUpOnConfirm()">{{'Confirm' | translate }}
</button>
<button type="button" class="btn btn-vat-primary" ng-click="closeModal()">{{'CloseButton' | translate }}
</button>
</div>
</script>
<!-- 显示上一步操作的备注 -->
<script type="text/ng-template" id="model-report-remarks.html" class="model-report-remarks-popup">
<div class="modal-header">
<div class="modal-title" style="margin-bottom:10px">
{{remarksTitle}}<i class="fa fa-times" aria-hidden="true"
style="float: right; font-size: 11px; color: #CF2D1B" ng-click="closeModal()"></i>
</div>
</div>
<div class="modal-body">
<div>
<textarea id="txtLastProcessRemark" style="width:370px;height:100px" readonly></textarea>
</div>
</div>
</script>
<!--Select export report pop-->
<div id="exportReportFilesContainer">
<script type="text/ng-template" class="content" id="exportReport.html">
<div class="modal-header">
<h4 class="modal-title" style="float: left;width: 70%;">{{'SelectExportReport' | translate}}</h4>
<span ng-click="$dismiss();" style="width: 20px; float: right; cursor: pointer;">x</span>
</div>
<div class="modal-body process-bar-container">
<div id="report-tree-container">
<div dx-tree-view="exportReportTreeOptions"></div>
</div>
</div>
<div class="modal-footer">
<button ng-click="export();" class="btn btn-default" style="background-color: #c00; color: #fff;">
{{'Confirm' | translate}}
</button>
<button ng-click="$dismiss();" class="btn btn-default" style="background-color: #777; color: #fff;">
{{'ButtonCancel' | translate}}
</button>
</div>
</script>
</div>
<!-- File Vouchers Upload Popup -->
<div class="modal fade" id="showVoucherUploadPortal" tabindex="-1" role="dialog" aria-labelledby="myModal"
data-backdrop="static" data-keyboard="false">
<div class="modal-dialog" style="width:740px;" role="document">
<div class="modal-content">
<div class="modal-header">
<span class="close" data-dismiss="modal" aria-hidden="true" ng-click="closeModal()">×</span>
<span>上传凭证 {{selectedProject.organizationName}}</span>
</div>
<div class="modal-body">
导入凭证:
<button type="button" atms-permission permission-code="02.004.002.006" ngf-select=""
ng-model="voucherFile" ngf-drag-over-class="'dragover'"
accept=".pdf,.jpg,.jpeg,.xls,.xlsx,.csv" ngf-multiple="true" ngf-allow-dir="false"
class="btn btn-vat-third">
<i class="fa fa-upload" aria-hidden="true"></i>
{{'SelectFileToUpload' | translate}}
</button>
</div>
<br/>
<div class="row" ng-show="voucherList!==null && voucherList.length>0"
style="margin-left:12px; margin-right:12px;">
<div class="col-lg-12 col-md-12 col-sm-12">
<table class="table table-no-bordered">
<thead>
<tr>
<th>凭证</th>
<th></th>
</tr>
</thead>
<tbody>
<tr ng-repeat="evidence in voucherList">
<td>{{evidence.creatorID}}</td>
<td><span style="cursor:pointer" atms-permission permission-code="02.004.002.001"
ng-click="openEvidenceFile(evidence)">{{evidence.fileName}}</span></td>
<td>{{evidence.createTime | date:'yyyy-MM-dd HH:mm'}}</td>
<td>{{evidence.comments}}</td>
<td>
<button class="btn btn-sm" atms-permission permission-code="02.004.002.006"
ng-click="showCommentsPopup(evidence);"><i class="fa fa-pencil-square-o"
</button>
<button class="btn btn-sm" atms-permission permission-code="02.004.002.006"
ng-click="deleteEvidenceFiles(evidence)"><i class="fa fa-times"
</button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="modal-footer">
</div>
</div>
</div>
</div>
<div class="modal fade" id="ApprovalComment" tabindex="-1" role="dialog" aria-labelledby="myModal"
data-backdrop="static" data-keyboard="false">
<div class="modal-dialog" style="" role="document">
<div class="modal-content">
<div class="modal-header">
<span class="close" data-dismiss="modal" aria-hidden="true" ng-click="closeModal()">×</span>
<span>{{vatSessionService.project.name}}</span>
</div>
<br/>
<div class="row" style="margin-left:12px; margin-right:12px;">
<div class="col-lg-12 col-md-12 col-sm-12">
<table class="table">
<caption>审核意见</caption>
<tr>
<td><textarea rows="3" class="form-control" ng-model="comment">{{comment}}</textarea>
</td>
</tr>
<tr>
<td style="float:right;border-top:none;">
<button class="btn btn-sm" ng-click="rejectApproval()">驳回
</button>
<button class="btn btn-sm" ng-click="agreeApproval()">通过
</button>
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="importExcellFile" tabindex="-1" role="dialog" aria-labelledby="myModal"
data-backdrop="static" data-keyboard="false">
<div class="modal-dialog" style="width:850px;height:500px" role="document" >
<div class="modal-content">
<div class="modal-header">
<span class="close" data-dismiss="modal" aria-hidden="true" ng-click="closeManualModal()">×</span>
<span>批量录入手工数据</span>
</div>
<br/>
<div class="row" style="width:850px;height:500px">
<div id="ss" class="sample-spreadsheets" style="height:100%;width:100%"></div>
</div>
<div class="row" style="margin-left:12px; margin-right:12px;">
<div class="col-sm-4">
<div class="form-control" type="text" name="fileName" readonly placeholder=""
ng-required="isAdd" title="{{file ? file.name : ''}}">
{{file ? file.name : '' | limitString :25}}
</div>
</div>
<div class="col-sm-2">
<button type="button" type="file" ngf-select ng-model="file" accept=".xls,.xlsx"
class="btn browse">选择文件
</button>
</div>
<div class="col-sm-2">
<button type="button" class="btn browse" ng-click="loadMyExcel()">加载文件
</button>
</div>
<div class="col-sm-2">
<button type="button" class="btn browse" ng-click="multiWrite()">批量录入
</button>
</div>
<div class="col-sm-2">
<button type="button" class="btn browse" ng-click="cleanManual()"> 清空
</button>
</div>
</div>
</div>
</div>
</div>
</div>
\ No newline at end of file
commonModule.directive('citReportView', ['$log', 'enums',
function ($log, enums) {
'use strict';
$log.debug('citReportView.ctor()...');
return {
restrict: 'E',
templateUrl: 'app/cit/report/cit-report-view/cit-report-view.html' + '?_=' + Math.random(),
scope: {
templateId: '=',
reportId: '=',
templateName:'=',
templateCode: '=',
isDocumentList: '=',
serviceType: '=',
initRow: '=?',
initCol: '=?',
instanceId: '='
},
controller: 'citReportViewController',
link: function ($scope, $ele, $attr) {
$ele.find("#tax-cell-detail").draggable({
scroll: true,
cancel: '#dataSourceGrid,.hand-input-container,.add-voucher-range-propover,.add-invoice,.tab-type,.dx-texteditor-input,input,.btn'
});
var saveFunc = $scope.$on('saveReportSheet', function (event, args) {
$scope.saveReportCache();
});
$scope.$on('$destroy', function () {
saveFunc();
});
}
};
}
]);
\ No newline at end of file
@import "~/app-resources/less/theme.less";
@color-red:#e20;
@color-gray:#939598-#222;
.cit-report-view {
height: calc(~"100% - 20px");
min-height: 500px;
margin: 10px 10px 10px 20px;
.report-container {
border: @thin-border solid @color-border;
height: calc(~"100% - 36px");
margin: 0;
width: 100%;
white-space: normal;
display: inline-block;
}
.row {
margin-left: 0px;
margin-bottom:10px;
&>span {
float: right;
margin-right: 15px;
cursor: pointer;
}
}
#addCertificatePop {
.modal-dialog {
width: 700px;
.add-certificate-pop-body {
height: 240px;
#add-certificate-grid {
height: 210px;
}
}
.modal-footer {
.template-1-button {
background-color: @color-red;
color: white;
margin-right:30px;
}
.template-2-button {
background-color: @color-gray;
color: white;
margin-right: 30px;
}
}
}
}
}
.model-report-approve-popup {
width: 400px;
height:500px;
position:fixed;
top:25%;
left:40%;
.modal-dialog {
width: 100%;
height: 90%;
margin: 20px auto;
.modal-content {
width: 100%;
.modal-body {
height: 90%;
}
}
}
}
.model-report-remarks-popup {
width: 400px;
height:500px;
position:fixed;
top:25%;
left:40%;
.modal-dialog {
width: 100%;
height: 90%;
margin: 20px auto;
.modal-content {
width: 100%;
.modal-body {
height: 90%;
}
}
}
}
......@@ -5,7 +5,7 @@
console.log('dataImpLayoutctor');
return {
restrict: 'E',
templateUrl: '/app/dataImport/data-import-layout/data-import-layout..html' + '?_=' + Math.random(),
templateUrl: '/app/dataImport/data-import-layout/data-import-layout.html' + '?_=' + Math.random(),
replace: true,
scope: {
},
......
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