Commit 606f4439 authored by chase's avatar chase

税金计算表功能开发

parent 7fc4b237
......@@ -365,7 +365,8 @@ public class ReportServiceImpl extends BaseService {
}
@Transactional
public void assemblePeriodTemplate(Template template, Workbook workbook, String projectId, Integer period, Integer addRowIndex) throws ServiceException {
public void assemblePeriodTemplate(Template template, Workbook workbook, String projectId, Integer period, List<Long> configIds) throws ServiceException {
int addRowIndex = configIds.size();
List<Integer> hasHandDatas = Arrays.asList(
TaxesCalculateReportEnum.Column.Column_5.getIndex(),
TaxesCalculateReportEnum.Column.Column_6.getIndex(),
......@@ -394,7 +395,11 @@ public class ReportServiceImpl extends BaseService {
}
if (r <= addRowIndex+1) {
String cellId = projectId+template.getId()+period+r+c;
if((r-1)>=0&&(r-1)<configIds.size()){
cellId += configIds.get(r-1);
}
Long cellTemplateId = Long.valueOf(cellId.hashCode());
cellTemplateId = cellTemplateId<0?cellTemplateId:(cellTemplateId*-1);
PeriodCellTemplate cellTemplate = new PeriodCellTemplate();
cellTemplate.setPeriod(period);
cellTemplate.setRowName(POIUtil.getCellFormulaString(cell));
......@@ -728,6 +733,7 @@ public class ReportServiceImpl extends BaseService {
String queryDate = project.getYear()+"-"+(period>=10?period:("0"+period));
example.createCriteria().andOrgIdEqualTo(project.getOrganizationId()).
andStartDateLessThanOrEqualTo(queryDate).andEndDateGreaterThanOrEqualTo(queryDate).andStatusEqualTo(0);
example.setOrderByClause(" create_time ");
List<RevenueConfig> dataList = revenueConfigMapper.selectByExample(example);
//合计项map
Map<Integer,List<String>> sumMap = new HashMap<>();
......@@ -736,14 +742,17 @@ public class ReportServiceImpl extends BaseService {
sumMap.put(TaxesCalculateReportEnum.Column.Column_7.getIndex(),new ArrayList<>());
sumMap.put(TaxesCalculateReportEnum.Column.Column_8.getIndex(),new ArrayList<>());
sumMap.put(TaxesCalculateReportEnum.Column.Column_10.getIndex(),new ArrayList<>());
List<Long> configIds = new ArrayList<>();
if (CollectionUtils.isNotEmpty(dataList)) {
int rowIndex = 1;
Row sourceRow = sheet.getRow(3);
for (RevenueConfig config : dataList) {
configIds.add(config.getId());
Row row = POIUtil.createAndCloneRow(tWorkbook, sheet, 1, sourceRow);
row.getCell(TaxesCalculateReportEnum.Column.Column_1.getIndex()).setCellValue("1-" + rowIndex);
row.getCell(TaxesCalculateReportEnum.Column.Column_1.getIndex()).setCellValue("1-" + (dataList.size()+1-rowIndex));
row.getCell(TaxesCalculateReportEnum.Column.Column_2.getIndex()).setCellValue(config.getName());
row.getCell(TaxesCalculateReportEnum.Column.Column_3.getIndex()).setCellValue("");
row.getCell(TaxesCalculateReportEnum.Column.Column_4.getIndex()).setCellValue("PC(\"FilterDate1\",2)");
......@@ -764,13 +773,13 @@ public class ReportServiceImpl extends BaseService {
if (1 == config.getTaxBase()) {//账载
row.getCell(TaxesCalculateReportEnum.Column.Column_8.getIndex()).setCellValue("WPNAME(\"VAT020\",\"B\",\""+config.getName()+"\",\"E\")");
} else if (2 == config.getTaxBase()) {//开票收入
row.getCell(TaxesCalculateReportEnum.Column.Column_8.getIndex()).setCellValue("WPNAME(\"VAT020\",\"B\",\""+config.getName()+"\",\"F\")+"
+"WPNAME(\"VAT020\",\"B\",\""+config.getName()+"\",\"G\")");
} else if (3 == config.getTaxBase()) {//手工录入
} else if (4 == config.getTaxBase()) {//借方发生额
row.getCell(TaxesCalculateReportEnum.Column.Column_8.getIndex()).setCellValue("JFFS(\"" + config.getTbSegment3() + "\"," + project.getYear() + "," + period + ",1,,)");
} else if (5 == config.getTaxBase()) {//贷方发生额
row.getCell(TaxesCalculateReportEnum.Column.Column_8.getIndex()).setCellValue("DFFS(\"" + config.getTbSegment3() + "\"," + project.getYear() + "," + period + ",1,,)");
}else{
row.getCell(TaxesCalculateReportEnum.Column.Column_8.getIndex()).setCellValue("");
......@@ -791,7 +800,7 @@ public class ReportServiceImpl extends BaseService {
//组装合计项数据
assembleSumRow(sheet.getRow(rowIndex),sumMap);
}
assemblePeriodTemplate(template, tWorkbook, projectId, period, dataList.size());
assemblePeriodTemplate(template, tWorkbook, projectId, period, configIds);
return tWorkbook;
}
......
package pwc.taxtech.atms.vat.service.impl.report.functions;
import com.google.common.collect.Lists;
import org.apache.commons.collections.CollectionUtils;
import org.apache.poi.ss.formula.OperationEvaluationContext;
import org.apache.poi.ss.formula.eval.NumberEval;
......@@ -20,6 +19,7 @@ import pwc.taxtech.atms.vat.entity.RevenueTypeMapping;
import pwc.taxtech.atms.vat.entity.RevenueTypeMappingExample;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
......@@ -42,17 +42,17 @@ public class KPSR extends FunctionBase implements FreeRefFunction {
Integer billType = getIntParam(args[1], ec);//发票类型
String formulaExpression = "KPSR(\"" + revenueTypeName + "\","+billType+")";
logger.debug(formulaExpression);
List<OutputInvoiceDataSourceDto> dataSource = Lists.newArrayList();
double result = countForTrialBalance(revenueTypeName,dataSource,billType,ec);
Long dataSoureId = saveDataSource(ec, Collections.singletonList(dataSource), FormulaDataSourceDetailType.InputInvoiceDataSourceDto, new BigDecimal(result), formulaContext.getPeriod(),
List<OutputInvoiceDataSourceDto> dataSource = new ArrayList<>();
double result = assembleData(revenueTypeName,dataSource,billType,ec);
Long dataSoureId = saveDataSource(ec, Collections.singletonList(dataSource), FormulaDataSourceDetailType.OutputInvoiceDataSourceDto, new BigDecimal(result), formulaContext.getPeriod(),
formulaContext.getReportTemplateGroupId(), formulaContext.getProjectId());
saveFormulaBlock(formulaContext.getPeriod(), ec, formulaExpression, new BigDecimal(result), dataSoureId, formulaContext.getProjectId());
return new NumberEval(result);
}
private double countForTrialBalance(String revenueTypeName, List<OutputInvoiceDataSourceDto> contain, Integer billType,OperationEvaluationContext ec) {
private double assembleData(String revenueTypeName, List<OutputInvoiceDataSourceDto> contain, Integer billType,OperationEvaluationContext ec) {
String queryDate = formulaContext.getYear()+(formulaContext.getPeriod()<10?("0"+formulaContext.getPeriod()):(formulaContext.getPeriod()+""));
RevenueTypeMappingExample typeMappingExample = new RevenueTypeMappingExample();
typeMappingExample.createCriteria().andOrgIdEqualTo(formulaContext.getOrganizationId())
......
......@@ -70,7 +70,7 @@ public class WPNAME extends FunctionBase implements FreeRefFunction {
throw e;
} finally {
LOGGER.warn("[BB_Exception] error for bb cacls for {}", bo.toString());
Long dataSourceId = saveDataSource(ec, dataSource, FormulaDataSourceType.Other,FormulaDataSourceDetailType.TaxCellDataSourceDto,
Long dataSourceId = saveDataSource(ec, dataSource, FormulaDataSourceType.Report,FormulaDataSourceDetailType.ReportCellDataSourceDto,
cellValue, formulaContext.getPeriod(),
formulaContext.getReportTemplateGroupId(), cellTemplateData.getColumnIndex(), cellTemplateData.getRowIndex(),
formulaContext.getProjectId());
......
......@@ -696,13 +696,21 @@
+ '&nbsp;&nbsp;&nbsp;&nbsp;' + evalVal.formatAmount(precition));
}
else { // For 报表数据源 and BSPL数据源
if ($scope.detail.dataGridSource && $scope.detail.dataGridSource.length > 0) {
evalVal = _.reduce($scope.detail.dataGridSource, function (memo, x) {
return memo + x.cellValue;
}, 0);
//判断是否是动态生成sheet
if(new Number($scope.detail.cellTemplateId)<0){
$("#dataGridFooterSummary").html("");
}else{
evalVal = _.reduce($scope.detail.dataGridSource, function (memo, x) {
return memo + x.cellValue;
}, 0);
$("#dataGridFooterSummary").html($translate.instant('Conclusion') +
'&nbsp;&nbsp;&nbsp;&nbsp;' + evalVal.formatAmount(precition));
}
$("#dataGridFooterSummary").html($translate.instant('Conclusion') +
'&nbsp;&nbsp;&nbsp;&nbsp;' + evalVal.formatAmount(precition));
}
else {
var summaryExp = '';
......@@ -1209,13 +1217,13 @@
alignment: 'left',
width: '16%'
},
{dataField: 'project', caption: $translate.instant('Project'), alignment: 'left', width: '25%'},
{
dataField: 'reportColumn',
caption: $translate.instant('TaxReportColumn'),
alignment: 'left',
width: '17%'
},
// {dataField: 'project', caption: $translate.instant('Project'), alignment: 'left', width: '25%'},
// {
// dataField: 'reportColumn',
// caption: $translate.instant('TaxReportColumn'),
// alignment: 'left',
// width: '17%'
// },
{
dataField: 'cellName',
caption: $translate.instant('CellColumn'),
......
......@@ -34,14 +34,14 @@
<label class="cell-info-subject-label">{{'CellColumn' | translate}}:</label>
{{numToExcelChar(detail.rowIndex, detail.columnIndex)}}
</div>
<div class="cell-info-subject">
<label class="cell-info-subject-label">{{'RowName' | translate}}:</label>
{{detail.cellInfo.project}}
</div>
<div class="cell-info-subject">
<label class="cell-info-subject-label">{{'ColumnName' | translate}}:</label>
{{detail.cellInfo.column}}
</div>
<!--<div class="cell-info-subject">-->
<!--<label class="cell-info-subject-label">{{'RowName' | translate}}:</label>-->
<!--{{detail.cellInfo.project}}-->
<!--</div>-->
<!--<div class="cell-info-subject">-->
<!--<label class="cell-info-subject-label">{{'ColumnName' | translate}}:</label>-->
<!--{{detail.cellInfo.column}}-->
<!--</div>-->
<div class="cell-info-subject">
<label class="cell-info-subject-label">{{'Formula' | translate}}</label>
<formula-translator formula-list="formulaList" key-value-list="keyValueList" include-optional="false"
......
......@@ -620,12 +620,12 @@
//todo: according to element to get the detail data
var outItems;
var convert = false;
if (element.items.length === 1) {
outItems = JSON.parse(element.items[0]);
} else {
// if (element.items.length === 1) {
// outItems = JSON.parse(element.items[0]);
// } else {
outItems = element.items;
convert = true;
}
// }
//todo: according to element to get the detail data
angular.forEach(outItems, function (jsonData) {
......
......@@ -385,14 +385,14 @@ function ($scope, $rootScope, $q, $log, $timeout, $state, $translate, projectSer
}
if (data[constant.vatPermission.dataAnalysis.modelAnalysisCode]) {
$scope.menus.push({
name: 'analyzeLayout', state: 'analyzeLayout', num: 5,
permission: constant.vatPermission.dataAnalysis.dataAnalysisCode, url: '#/vat/analyzeLayout'
});
subMenus.push({
name: 'analyzeLayout.analyzeReport', state: 'analyzeLayout.analyzeReport', num: 5,
permission: constant.vatPermission.dataAnalysis.modelAnalysisCode, url: '#/vat/analyzeLayout/analyzeReport'
});
// $scope.menus.push({
// name: 'analyzeLayout', state: 'analyzeLayout', num: 5,
// permission: constant.vatPermission.dataAnalysis.dataAnalysisCode, url: '#/vat/analyzeLayout'
// });
// subMenus.push({
// name: 'analyzeLayout.analyzeReport', state: 'analyzeLayout.analyzeReport', num: 5,
// permission: constant.vatPermission.dataAnalysis.modelAnalysisCode, url: '#/vat/analyzeLayout/analyzeReport'
// });
}
//else if (data[constant.vatPermission.dataAnalysis.dashboard.dashboardCode]) {
// $scope.menus.push({
......@@ -406,14 +406,14 @@ function ($scope, $rootScope, $q, $log, $timeout, $state, $translate, projectSer
//}
else {
//data[constant.vatPermission.dataAnalysis.vatTaxDifferenceCode]
$scope.menus.push({
name: 'analyzeLayout', state: 'analyzeLayout', num: 5,
permission: constant.vatPermission.dataAnalysis.dataAnalysisCode, url: '#/vat/analyzeLayout'
});
subMenus.push({
name: 'analyzeLayout.vatTaxDifference', state: 'analyzeLayout.vatTaxDifference', num: 5,
permission: constant.vatPermission.dataAnalysis.vatTaxDifferenceCode, url: '#/analyzeLayout/vatTaxDifference'
});
// $scope.menus.push({
// name: 'analyzeLayout', state: 'analyzeLayout', num: 5,
// permission: constant.vatPermission.dataAnalysis.dataAnalysisCode, url: '#/vat/analyzeLayout'
// });
// subMenus.push({
// name: 'analyzeLayout.vatTaxDifference', state: 'analyzeLayout.vatTaxDifference', num: 5,
// permission: constant.vatPermission.dataAnalysis.vatTaxDifferenceCode, url: '#/analyzeLayout/vatTaxDifference'
// });
}
}
});
......
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