Commit dbac0c20 authored by zhkwei's avatar zhkwei

Merge remote-tracking branch 'origin/dev_mysql' into dev_mysql

parents 2c8306d9 dcfe14a3
package pwc.taxtech.atms.constant.enums; package pwc.taxtech.atms.constant.enums;
import java.util.HashMap;
import java.util.Map;
public enum EnumInvoiceType { public enum EnumInvoiceType {
VATInvoice(1, "增值税专票"), VATInvoice(1, "增值税专票"),
FreightTransport(2, "货运发票"), FreightTransport(2, "货运发票"),
...@@ -9,7 +12,7 @@ public enum EnumInvoiceType { ...@@ -9,7 +12,7 @@ public enum EnumInvoiceType {
private int code; private int code;
private String name; private String name;
public static final Map<Integer, String> MAPPING = new HashMap<>();
EnumInvoiceType(int code, String name) { EnumInvoiceType(int code, String name) {
this.code = code; this.code = code;
this.name = name; this.name = name;
...@@ -22,4 +25,10 @@ public enum EnumInvoiceType { ...@@ -22,4 +25,10 @@ public enum EnumInvoiceType {
public String getName() { public String getName() {
return name; return name;
} }
static {
for (EnumInvoiceType invoiceType : EnumInvoiceType.values()) {
MAPPING.put(invoiceType.getCode(), invoiceType.getName());
}
}
} }
...@@ -9,8 +9,8 @@ public class InvoiceRecordEnum { ...@@ -9,8 +9,8 @@ public class InvoiceRecordEnum {
* 发票类型 * 发票类型
*/ */
public enum InvoiceType { public enum InvoiceType {
ORDINARY(1, "增值税普票"), ORDINARY(1, "增值税普通发票"),
SPECIAL(2, "增值税专票"); SPECIAL(2, "增值税专用发票");
private Integer code; private Integer code;
private String name; private String name;
public static final Map<Integer, String> MAPPING = new HashMap<>(); public static final Map<Integer, String> MAPPING = new HashMap<>();
......
...@@ -198,7 +198,6 @@ public class TemplateGroupServiceImpl extends AbstractService { ...@@ -198,7 +198,6 @@ public class TemplateGroupServiceImpl extends AbstractService {
return ""; return "";
} }
public static final String PROTABLEID = "100610523201314816";
@Autowired @Autowired
private EbitCellDataMapper ebitCellDataMapper; private EbitCellDataMapper ebitCellDataMapper;
...@@ -217,8 +216,8 @@ public class TemplateGroupServiceImpl extends AbstractService { ...@@ -217,8 +216,8 @@ public class TemplateGroupServiceImpl extends AbstractService {
List<InvoiceData> cfs = Lists.newArrayList(); List<InvoiceData> cfs = Lists.newArrayList();
String[] sheetName = sheet.getSheetName().split("-"); String[] sheetName = sheet.getSheetName().split("-");
String taypayerNum = sheetName[0]; String taypayerNum = sheetName[0];
String titleValue = sheet.getRow(0).getCell(3).getStringCellValue(); String titleValue = sheet.getRow(0).getCell(2).getStringCellValue();
if ("".equals(titleValue) || !"".equals("利润表(单家PRC)")) if (titleValue.indexOf("利润表") == -1)
throw new ServiceException(ErrorMessageCN.ErrorFileFormat); throw new ServiceException(ErrorMessageCN.ErrorFileFormat);
if (period == null) { if (period == null) {
throw new ServiceException(ErrorMessageCN.DoNotSelectPeriod); throw new ServiceException(ErrorMessageCN.DoNotSelectPeriod);
...@@ -238,8 +237,9 @@ public class TemplateGroupServiceImpl extends AbstractService { ...@@ -238,8 +237,9 @@ public class TemplateGroupServiceImpl extends AbstractService {
ebitCellData.setCol(j); ebitCellData.setCol(j);
ebitCellData.setRow(m); ebitCellData.setRow(m);
ebitCellData.setCreateTime(now); ebitCellData.setCreateTime(now);
if(sheet.getRow(m).getCell(j) != null)
ebitCellData.setData(sheet.getRow(m).getCell(j).getStringCellValue()); ebitCellData.setData(sheet.getRow(m).getCell(j).getStringCellValue());
ebitCellData.setTemplateId(PROTABLEID); ebitCellData.setTemplateId(String.valueOf(idService.nextId()));
ebitCellData.setProjectId(projectId); ebitCellData.setProjectId(projectId);
ebitCellData.setOrganizationId(orgId); ebitCellData.setOrganizationId(orgId);
ebitCellData.setPeriod(period); ebitCellData.setPeriod(period);
...@@ -252,9 +252,9 @@ public class TemplateGroupServiceImpl extends AbstractService { ...@@ -252,9 +252,9 @@ public class TemplateGroupServiceImpl extends AbstractService {
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
operationResultDto.setResult(false); operationResultDto.success(e.getMessage());
} }
operationResultDto.setResult(true); operationResultDto.success();
return operationResultDto; return operationResultDto;
} }
......
...@@ -100,7 +100,8 @@ public class BB extends FunctionBase implements FreeRefFunction { ...@@ -100,7 +100,8 @@ public class BB extends FunctionBase implements FreeRefFunction {
CellTemplatePerGroupDto cellTemplateData = cellTemplateDataList.get(0); CellTemplatePerGroupDto cellTemplateData = cellTemplateDataList.get(0);
nullCellDto.fixedWithGroup(cellTemplateData); nullCellDto.fixedWithGroup(cellTemplateData);
//当年当期 //当年当期
if (bo.getPeriod().intValue() == 0 && bo.getYear().intValue() == 0) { if ((bo.getPeriod().intValue() == 0 && bo.getYear().intValue() == 0)||
(bo.getYear().equals(formulaContext.getYear())&&bo.getPeriod().equals(formulaContext.getPeriod()))) {
int index = ec.getWorkbook().getSheetIndex(bo.getReportCode()); int index = ec.getWorkbook().getSheetIndex(bo.getReportCode());
cellValue = getCellValue(index, ec, formulaContext, agent, bo.getRowIndex() - 1, bo.getColumnIndex() - 1, cellValue = getCellValue(index, ec, formulaContext, agent, bo.getRowIndex() - 1, bo.getColumnIndex() - 1,
Long.parseLong(cellTemplateData.getCellTemplateId())); Long.parseLong(cellTemplateData.getCellTemplateId()));
......
...@@ -6,6 +6,7 @@ import org.apache.poi.ss.formula.eval.ValueEval; ...@@ -6,6 +6,7 @@ import org.apache.poi.ss.formula.eval.ValueEval;
import org.apache.poi.ss.formula.functions.FreeRefFunction; import org.apache.poi.ss.formula.functions.FreeRefFunction;
import pwc.taxtech.atms.common.util.SpringContextUtil; import pwc.taxtech.atms.common.util.SpringContextUtil;
import pwc.taxtech.atms.constant.Constant; import pwc.taxtech.atms.constant.Constant;
import pwc.taxtech.atms.constant.enums.EnumInvoiceType;
import pwc.taxtech.atms.constant.enums.EnumOperationType; import pwc.taxtech.atms.constant.enums.EnumOperationType;
import pwc.taxtech.atms.constant.enums.FormulaDataSourceDetailType; import pwc.taxtech.atms.constant.enums.FormulaDataSourceDetailType;
import pwc.taxtech.atms.constant.enums.KeyValueConfigResultType; import pwc.taxtech.atms.constant.enums.KeyValueConfigResultType;
...@@ -53,7 +54,7 @@ public class JXFP extends FunctionBase implements FreeRefFunction { ...@@ -53,7 +54,7 @@ public class JXFP extends FunctionBase implements FreeRefFunction {
int resultType = getIntParam(args[3], ec); int resultType = getIntParam(args[3], ec);
int period = getIntParam(args[4], ec); int period = getIntParam(args[4], ec);
// 客户情况只计算增值税专票 // 客户情况只计算增值税专票
String invoiceType = "004"; // String invoiceType = "004";
String formulaExpression = "JXFP(" + certificationPeriod + "," + invoiceTypeParam + "," String formulaExpression = "JXFP(" + certificationPeriod + "," + invoiceTypeParam + ","
+ authenticationType + "," + resultType + "," + period + ")"; + authenticationType + "," + resultType + "," + period + ")";
...@@ -81,22 +82,22 @@ public class JXFP extends FunctionBase implements FreeRefFunction { ...@@ -81,22 +82,22 @@ public class JXFP extends FunctionBase implements FreeRefFunction {
List<CertifiedInvoicesList> inputInvoices; List<CertifiedInvoicesList> inputInvoices;
if (authenticationType == 1 && formulaContext.getIsYear()) { if (authenticationType == 1 && formulaContext.getIsYear()) {
inputInvoices = getInvoice(null, invoiceType, inputInvoices = getInvoice(null, invoiceTypeParam,
Constant.InputInvoiceCertificationResult.CheckPass, Constant.InputInvoiceCertificationResult.ScanPass, Constant.InputInvoiceCertificationResult.CheckPass, Constant.InputInvoiceCertificationResult.ScanPass,
null); null);
} else if (authenticationType == 1) { } else if (authenticationType == 1) {
inputInvoices =getInvoice(period, invoiceType, inputInvoices =getInvoice(period, invoiceTypeParam,
Constant.InputInvoiceCertificationResult.CheckPass, Constant.InputInvoiceCertificationResult.ScanPass, Constant.InputInvoiceCertificationResult.CheckPass, Constant.InputInvoiceCertificationResult.ScanPass,
null); null);
} }
// 认证未通过与未认证暂认为是同一个意思 // 认证未通过与未认证暂认为是同一个意思
else if (authenticationType == 2 && formulaContext.getIsYear()) { else if (authenticationType == 2 && formulaContext.getIsYear()) {
inputInvoices = getInvoice(null, invoiceType, inputInvoices = getInvoice(null, invoiceTypeParam,
null, null, Constant.InputInvoiceCertificationResult.NotPass); null, null, Constant.InputInvoiceCertificationResult.NotPass);
} }
// 认证未通过与未认证暂认为是同一个意思 // 认证未通过与未认证暂认为是同一个意思
else if (authenticationType == 0 || authenticationType == 2) { else if (authenticationType == 0 || authenticationType == 2) {
inputInvoices =getInvoice(period, invoiceType, null, inputInvoices =getInvoice(period, invoiceTypeParam, null,
null, Constant.InputInvoiceCertificationResult.NotPass); null, Constant.InputInvoiceCertificationResult.NotPass);
} else { } else {
saveFormulaBlock(period, ec, formulaExpression, new BigDecimal("0.0"), 0L, formulaContext.getProjectId()); saveFormulaBlock(period, ec, formulaExpression, new BigDecimal("0.0"), 0L, formulaContext.getProjectId());
...@@ -194,20 +195,17 @@ public class JXFP extends FunctionBase implements FreeRefFunction { ...@@ -194,20 +195,17 @@ public class JXFP extends FunctionBase implements FreeRefFunction {
return strtodate; return strtodate;
} }
public List<CertifiedInvoicesList> getInvoice(Integer period, String invoiceType, String checkPass, String scanPass, String notPass) { public List<CertifiedInvoicesList> getInvoice(Integer period, Integer invoiceType, String checkPass, String scanPass, String notPass) {
CertifiedInvoicesListExample example = new CertifiedInvoicesListExample(); CertifiedInvoicesListExample example = new CertifiedInvoicesListExample();
CertifiedInvoicesListExample.Criteria criteria = example.createCriteria(); CertifiedInvoicesListExample.Criteria criteria = example.createCriteria();
if (period != null) { if (period != null) {
Calendar date = Calendar.getInstance(); criteria.andPeriodEqualTo(Integer.valueOf(formulaContext.getYear() + (period > 9 ? period.toString() : "0" + period.toString())));
String year = String.valueOf(date.get(Calendar.YEAR));
//认证期间
criteria.andPeriodEqualTo(Integer.valueOf(year + (period > 9 ? period.toString() : "0" + period.toString())));
} }
if (invoiceType != null) { if (invoiceType != null) {
//发票类型 //发票类型
criteria.andInvoiceTypeEqualTo(String.valueOf(invoiceType)); criteria.andInvoiceTypeEqualTo(EnumInvoiceType.MAPPING.get(invoiceType));
// criteria1.andFPLXEqualTo(String.valueOf(invoiceType)); // criteria1.andFPLXEqualTo(String.valueOf(invoiceType));
} }
...@@ -223,7 +221,7 @@ public class JXFP extends FunctionBase implements FreeRefFunction { ...@@ -223,7 +221,7 @@ public class JXFP extends FunctionBase implements FreeRefFunction {
//// example.or(criteria1); //// example.or(criteria1);
// } // }
//发票状态 //发票状态
criteria.andInvoiceTypeEqualTo("1"); // 过滤作废状态 criteria.andInvoiceTypeEqualTo("正常"); // 过滤作废状态
// List<InputInvoice> list = inputInvoiceMapper.selectByExample(example).stream().filter(x -> { // List<InputInvoice> list = inputInvoiceMapper.selectByExample(example).stream().filter(x -> {
// return x.getRZSQ().endsWith("-" + (period.intValue() > 9 ? period.toString() : "0" + period.toString())); // return x.getRZSQ().endsWith("-" + (period.intValue() > 9 ? period.toString() : "0" + period.toString()));
......
...@@ -74,8 +74,8 @@ public class RSUMIF extends FunctionBase implements FreeRefFunction { ...@@ -74,8 +74,8 @@ public class RSUMIF extends FunctionBase implements FreeRefFunction {
dataSource.add(reportCellTableSUMIFDataSourceDto); dataSource.add(reportCellTableSUMIFDataSourceDto);
tableName = resolverString(args, ec, 0); tableName = resolverString(args, ec, 0);
getField = resolverString(args, ec, 1); getField = resolverString(args, ec, 1);
filter= resolverString(args, ec, 2); filter = resolverString(args, ec, 2);
filterValue= resolverString(args, ec, 3); filterValue = resolverString(args, ec, 3);
year = resolverInteger(args, ec, 4);//会计年度 year = resolverInteger(args, ec, 4);//会计年度
period = Integer.parseInt(resolverString(args, ec, 5));//会计期间 period = Integer.parseInt(resolverString(args, ec, 5));//会计期间
cellValue = agent.getTableDataByName(tableName, getField, filter, filterValue, period, year, formulaContext); cellValue = agent.getTableDataByName(tableName, getField, filter, filterValue, period, year, formulaContext);
...@@ -85,17 +85,18 @@ public class RSUMIF extends FunctionBase implements FreeRefFunction { ...@@ -85,17 +85,18 @@ public class RSUMIF extends FunctionBase implements FreeRefFunction {
return new NumberEval(0.00); return new NumberEval(0.00);
} finally { } finally {
boolean boo; boolean boo;
if(TableRule.map.get(tableName).substring(0, 3).equals("cit")){
Long dataSourceId = null;
try {
if (TableRule.map.get(tableName).substring(0, 3).equals("cit")) {
boo = true; boo = true;
}else{ } else {
boo = false; boo = false;
} }
Long dataSourceId = null;
try {
dataSourceId = saveDataRSUMIFSource(ec, dataSource, FormulaDataSourceDetailType.ReportCellTableSUMIFDataSourceDto, dataSourceId = saveDataRSUMIFSource(ec, dataSource, FormulaDataSourceDetailType.ReportCellTableSUMIFDataSourceDto,
cellValue, formulaContext.getPeriod(), cellValue, formulaContext.getPeriod(),
formulaContext.getReportTemplateGroupId(), ec.getColumnIndex(), ec.getRowIndex(), formulaContext.getReportTemplateGroupId(), ec.getColumnIndex(), ec.getRowIndex(),
formulaContext.getProjectId(), selectShow(tableName), FormulaAgent._buildSql(getField,tableName,filter,filterValue,period,formulaContext,year, boo, true)); formulaContext.getProjectId(), selectShow(tableName), FormulaAgent._buildSql(getField, tableName, filter, filterValue, period, formulaContext, year, boo, true));
saveFormulaBlock(formulaContext.getPeriod(), ec, saveFormulaBlock(formulaContext.getPeriod(), ec,
new RSUMIFParasBo().getExpression(args, ec), cellValue, dataSourceId, formulaContext.getProjectId()); new RSUMIFParasBo().getExpression(args, ec), cellValue, dataSourceId, formulaContext.getProjectId());
} catch (Exception e) { } catch (Exception e) {
...@@ -108,12 +109,12 @@ public class RSUMIF extends FunctionBase implements FreeRefFunction { ...@@ -108,12 +109,12 @@ public class RSUMIF extends FunctionBase implements FreeRefFunction {
public FormulaDataSourceType selectShow(String tableName) { public FormulaDataSourceType selectShow(String tableName) {
if ("CIT_TBAM".equals(tableName)) { if ("CIT_TBAM".equals(tableName)) {
return FormulaDataSourceType.CIT_TBAM; return FormulaDataSourceType.CIT_TBAM;
}else{ } else {
return FormulaDataSourceType.Other; return FormulaDataSourceType.Other;
} }
} }
public static String getSql (){ public static String getSql() {
return ""; return "";
} }
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
period, create_time, update_time period, create_time, update_time
</sql> </sql>
<insert id="insertBatch" parameterType="java.util.List"> <insert id="insertBatch" parameterType="java.util.List">
insert into profit_loss_statement_manual insert into ebit_cell_data
(<include refid="Base_Column_List_Ebit"/>) (<include refid="Base_Column_List_Ebit"/>)
values values
......
...@@ -1457,6 +1457,7 @@ ...@@ -1457,6 +1457,7 @@
"SelectCheck": "请至少选择一项", "SelectCheck": "请至少选择一项",
"SelectColumnError": "列名对应错误", "SelectColumnError": "列名对应错误",
"SelectExportReport": "选择导出报表", "SelectExportReport": "选择导出报表",
"SelectUploadReport": "选择保存版本",
"SelectFile": "选择文件...", "SelectFile": "选择文件...",
"SelectFileTitle": "选择文件", "SelectFileTitle": "选择文件",
"SelectFileToUpload": "上传文件...", "SelectFileToUpload": "上传文件...",
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
scope.$watchGroup(['reportSource', 'formulaBlocks', 'manualDataSources', 'templateId'], function (newVal, oldValue) { scope.$watchGroup(['reportSource', 'formulaBlocks', 'manualDataSources', 'templateId'], function (newVal, oldValue) {
if (scope.templateId && scope.reportSource) { if (scope.templateId && scope.reportSource) {
setData(); setData(true);
} }
}); });
var profileList = ["EBIT考虑资产减值损失", "加:特殊因素考虑", "EBIT(考虑特殊因素)", "EBIT rate", "关联交易金额", "6%增值税", "价税合计金额"]; var profileList = ["EBIT考虑资产减值损失", "加:特殊因素考虑", "EBIT(考虑特殊因素)", "EBIT rate", "关联交易金额", "6%增值税", "价税合计金额"];
...@@ -85,34 +85,25 @@ ...@@ -85,34 +85,25 @@
} }
}; };
scope.$watchGroup(['relation.period', 'relation.orgId', 'relation.data', 'relation.broadcast'], function(newValue, oldValue){ scope.$watchGroup(['relation.period', 'relation.orgId', 'relation.data'], function(newValue, oldValue){
if(scope.relation.orgId != null && scope.relation.period != null && scope.spread != undefined){ if(scope.relation.orgId != null && scope.relation.period != null && scope.spread != undefined){
loadSheet(scope.templateId, true) loadSheet(scope.templateId, true)
} }
}); });
scope.$watch('relation.broadcast', function(newValue, oldValue){
if(scope.relation.orgId != null && scope.relation.period != null && scope.spread != undefined){
loadSheet(scope.templateId, false)
}
});
var loadSheet = function (templateId, init) { var loadSheet = function (templateId, init) {
//var prokjectId = vatSessionService.project.id; //var prokjectId = vatSessionService.project.id;
//var period = vatSessionService.month; //var period = vatSessionService.month;
if(scope.relation.orgId == undefined){
scope.relation.orgId = "-1";
}
if(!init){ if(!init){
return templateService.getPeriodTemplateJsonByOrg(templateId, scope.relation.period, scope.relation.orgId).then(function (reportSpread) { addEbitRow();
var spreadCtrl = getSpreadControl(); setData(init)
if (spreadCtrl) { return;
spreadCtrl.destroy();
}
spreadCtrl = null;
if (!_.isEmpty(reportSpread)) {
initSpreadExcel(reportSpread).then(function (spread) {
return locateCell(spread, true);
});
} }
}, function (data) { return templateService.getPeriodTemplateJsonByOrg(templateId, scope.relation.period, scope.relation.orgId).then(function (reportSpread) {
$log.info(data);
});
}else{
return templateService.getPeriodTemplateJsonByInit(templateId, scope.relation.period, scope.relation.orgId).then(function (reportSpread) {
var spreadCtrl = getSpreadControl(); var spreadCtrl = getSpreadControl();
if (spreadCtrl) { if (spreadCtrl) {
spreadCtrl.destroy(); spreadCtrl.destroy();
...@@ -126,8 +117,6 @@ ...@@ -126,8 +117,6 @@
}, function (data) { }, function (data) {
$log.info(data); $log.info(data);
}); });
}
}; };
var initSpreadExcel = function (reportSpread) { var initSpreadExcel = function (reportSpread) {
...@@ -177,11 +166,16 @@ ...@@ -177,11 +166,16 @@
} }
spread.resumePaint(); spread.resumePaint();
scope.spread = spread; scope.spread = spread;
addEbitRow(sheet)
if (scope.templateId && scope.reportSource ) { if (scope.templateId && scope.reportSource ) {
setData("true"); setData(true);
} }
// return $q.when(spread);
sheet.setColumnWidth(0, 350) };
var addEbitRow = function(sheet){
if(sheet == undefined || sheet == null)
sheet = scope.spread.getActiveSheet();
sheet.setColumnWidth(0, 400)
//添加单元格 //添加单元格
sheet.addRows(sheet.getRowCount(scope.relation.sheetArea.viewport), 1); sheet.addRows(sheet.getRowCount(scope.relation.sheetArea.viewport), 1);
sheet.addRows(sheet.getRowCount(scope.relation.sheetArea.viewport), 1); sheet.addRows(sheet.getRowCount(scope.relation.sheetArea.viewport), 1);
...@@ -190,8 +184,7 @@ ...@@ -190,8 +184,7 @@
sheet.addRows(sheet.getRowCount(scope.relation.sheetArea.viewport), 1); sheet.addRows(sheet.getRowCount(scope.relation.sheetArea.viewport), 1);
sheet.setValue(i+37,0, profileList[i]); sheet.setValue(i+37,0, profileList[i]);
} }
return $q.when(spread); }
};
var setEditable = function (spread, isReadOnly, ifSuspend) { var setEditable = function (spread, isReadOnly, ifSuspend) {
...@@ -334,7 +327,7 @@ ...@@ -334,7 +327,7 @@
cell.value = modifiedReportCell.value; cell.value = modifiedReportCell.value;
cell.isModified = true; cell.isModified = true;
cell.modifiedReportCell = modifiedReportCell; cell.modifiedReportCell = modifiedReportCell;
setData(); setData(true);
}); });
var cellValueResetFunc = $rootScope.$on('cellValueReset', function (event, args) { var cellValueResetFunc = $rootScope.$on('cellValueReset', function (event, args) {
...@@ -344,7 +337,7 @@ ...@@ -344,7 +337,7 @@
cell.value = cell.modifiedReportCell ? cell.modifiedReportCell.originalValue : cell.value; cell.value = cell.modifiedReportCell ? cell.modifiedReportCell.originalValue : cell.value;
cell.isModified = false; cell.isModified = false;
cell.modifiedReportCell = null; cell.modifiedReportCell = null;
setData(); setData(true);
}); });
scope.$on('$destroy', function () { scope.$on('$destroy', function () {
...@@ -383,8 +376,12 @@ ...@@ -383,8 +376,12 @@
}; };
// 根据已有信息通过spreadJS计算各单元格的值 // 根据已有信息通过spreadJS计算各单元格的值
var setData = function (saveAndRefresh) { var setData = function (init) {
var sheet = scope.spread.sheets[0]; var sheet = scope.spread.sheets[0];
if(!init){
loadEbitCell(sheet);
return;
}
var isExportData = false; var isExportData = false;
if (angular.isArray(scope.reportSource)) { if (angular.isArray(scope.reportSource)) {
spreadJsTipService.initialize(sheet); spreadJsTipService.initialize(sheet);
...@@ -523,19 +520,15 @@ ...@@ -523,19 +520,15 @@
} }
} }
} }
if(saveAndRefresh && saveAndRefresh == "false"){
loadEbitCell(sheet, false); loadEbitCell(sheet, false);
}else if ( saveAndRefresh && saveAndRefresh == "true"){
loadEbitCell(sheet, true);
}
spreadJsTipService.paintSheet(sheet); spreadJsTipService.paintSheet(sheet);
} }
}; };
//加载Ebit数据 //加载Ebit数据
var loadEbitCell = function(sheet, type){ var loadEbitCell = function(sheet){
for( var r = 37; r<= 43; r++ ){ for( var r = 37; r<= 43; r++ ){
for(var c = 1; c<=3; c++){ for(var c = 1; c<=3; c++){
if(c == 3 && type){ if(c == 3){
if(r == 37){ if(r == 37){
sheet.setValue(r, c,PWC.tryParseStringToNum(scope.relation.data.ebitSubtraction)); sheet.setValue(r, c,PWC.tryParseStringToNum(scope.relation.data.ebitSubtraction));
} }
......
...@@ -2879,22 +2879,10 @@ ...@@ -2879,22 +2879,10 @@
}; };
var initDatePicker = function () { var initDatePicker = function () {
if ($scope.serviceTypeId === enums.serviceType.CIT) {
$scope.systemTitle = $translate.instant('CIT');
$scope.viewMode = 2;
}
if ($scope.serviceTypeId === enums.serviceType.VAT) {
$scope.systemTitle = $translate.instant('MenuVAT');
$scope.viewMode = 1;
}
if ($scope.serviceTypeId === enums.serviceType.AssetsManage) {
$scope.systemTitle = $translate.instant('AssetTitle');
$scope.viewMode = 1;
}
var date = new Date(); var date = new Date();
var year = date.getFullYear(); var year = date.getFullYear();
var month = date.getMonth(); var mon = date.getMonth()+ 1;
$scope.selectedDate = new Date(vatSessionService.year, vatSessionService.month - 1, 1); $scope.selectedDate = new Date(year, date.getMonth() + 1, 1);
$scope.startDate = new Date(year - 20, 1, 1); $scope.startDate = new Date(year - 20, 1, 1);
$scope.endDate = new Date(year + 20, 1, 1); $scope.endDate = new Date(year + 20, 1, 1);
var ele1 = $("#ebitDatepacker"); var ele1 = $("#ebitDatepacker");
...@@ -2906,14 +2894,21 @@ ...@@ -2906,14 +2894,21 @@
minViewMode: 1, minViewMode: 1,
autoclose: true, //选中之后自动隐藏日期选择框 autoclose: true, //选中之后自动隐藏日期选择框
clearBtn: true, //清除按钮 clearBtn: true, //清除按钮
todayBtn: false, //今日按钮 todayBtn: true, //今日按钮
format: "yyyy-mm" //日期格式,详见 http://bootstrap-datepicker.readthedocs.org/en/release/options.html#format format: "yyyy-mm" //日期格式,详见 http://bootstrap-datepicker.readthedocs.org/en/release/options.html#format
}).on('changeDate', function (e) { }).on('changeDate', function (e) {
$scope.changeDate(e); $scope.changeDate(e);
}); });
ele1.datepicker("setDate", $scope.selectedDate); ele1.datepicker("setDate", $scope.selectedDate);
//初始化
$scope.relation.period = year.toString() + monthRevert(mon);
}; };
var monthRevert = function(mon){
if(mon < 10)
mon = "0" + mon.toString();
return mon.toString();
}
//保存并刷新,加载数据 //保存并刷新,加载数据
$scope.saveAndRefresh = function(){ $scope.saveAndRefresh = function(){
...@@ -2933,19 +2928,20 @@ ...@@ -2933,19 +2928,20 @@
}); });
//上传模板 //上传模板
$scope.upload = function (file) { $scope.upload = function (file) {
var _file = $scope.importExcelFile; if(file.length == 0)
if(file == null)
return return
frontImport(_file); file = file[0];
var token = $('input[name="__RequestVerificationToken"]').val(); var token = $('input[name="__RequestVerificationToken"]').val();
var url = apiInterceptor.vatWebApiHostUrl + '/templateGroup/ebitTemplateImport'; var url = apiInterceptor.webApiHostUrl + '/templateGroup/ebitTemplateImport';
Upload.upload( Upload.upload(
{ {
url: url, url: url,
data: {orgId : $scope.relation.orgId, period : $scope.relation.period}, file: _file, data: {orgId : $scope.relation.orgId, period : $scope.relation.period != undefined ? $scope.relation.period : 0 }, file: file,
headers: { headers: {
'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Origin': '*',
Authorization: apiInterceptor.tokenType + ' ' + apiInterceptor.apiToken() Authorization: apiInterceptor.tokenType + ' ' + apiInterceptor.apiToken(),
__RequestVerificationToken: token,
withCredentials: true
}, },
__RequestVerificationToken: token, __RequestVerificationToken: token,
withCredentials: true withCredentials: true
...@@ -2953,17 +2949,18 @@ ...@@ -2953,17 +2949,18 @@
.progress(function (evt) { .progress(function (evt) {
}) })
.success(function (data, status, headers, config) { .success(function (data, status, headers, config) {
SweetAlert.error("上传成功"); frontImport(file);
$('#busy-indicator-container').hide();
SweetAlert.success("上传成功");
$scope.relation.fileName = config.file.name; $scope.relation.fileName = config.file.name;
vatReportService.frontImportBack().success(function(res){ //重新获取数据
getReportData(function(){ getReportData(function(){
$scope.relation.broadcast = true; $scope.relation.broadcast = true;
}, $scope.relation.period); }, $scope.relation.period);
});
}) })
.error(function (data, status, headers, config) { .error(function (data, status, headers, config) {
SweetAlert.error(status + '错误' + ",上传失败") SweetAlert.error(status + "上传失败")
}) })
}; };
...@@ -2973,8 +2970,7 @@ ...@@ -2973,8 +2970,7 @@
var excelIo = new GC.Spread.Excel.IO(); var excelIo = new GC.Spread.Excel.IO();
excelIo.open(file, function (json) { excelIo.open(file, function (json) {
var workbookObj = json; var workbookObj = json;
spread.fromJSON(workbookObj); $scope.spread.fromJSON(workbookObj);
}, function (e) { }, function (e) {
// process error // process error
alert(e.errorMessage); alert(e.errorMessage);
......
...@@ -22,8 +22,8 @@ ...@@ -22,8 +22,8 @@
</div> </div>
</div> </div>
<div class="col-sm-5" class="bar-export" style=" margin-top: 20px;width: 39%; float: right;"> <div class="col-sm-5" class="bar-export" style=" margin-top: 20px;width: 39%; float: right;">
<span ngf-select="" type="file" ng-model="importExcelFile" ngf-change="upload($files)" ngf-drag-over-class="'dragover'" accept=".xls,.xlsx" ngf-multiple="false" <span ngf-select="" ngf-change="upload($files)" accept=".xls,.xlsx" ngf-multiple="false"
ngf-allow-dir="false" class="btn btn-vat-third" ><i class="fa fa-file">&nbsp;{{'uploadProfileTable' | translate}}</i></span> ngf-allow-dir="false" class="" ><i class="fa fa-file">&nbsp;{{'uploadProfileTable' | translate}}</i></span>
<span ng-click="saveAndRefresh()"><i class="fa fa-refresh"></i>&nbsp;{{'saveAndRefresh' | translate}}</span> <span ng-click="saveAndRefresh()"><i class="fa fa-refresh"></i>&nbsp;{{'saveAndRefresh' | translate}}</span>
<span ng-click="singleExport()"><i <span ng-click="singleExport()"><i
class="fa fa-upload"></i>&nbsp;{{'singleExport' | translate}}</span> class="fa fa-upload"></i>&nbsp;{{'singleExport' | translate}}</span>
......
...@@ -910,6 +910,12 @@ ...@@ -910,6 +910,12 @@
//打开导出文件弹出框 //打开导出文件弹出框
$scope.openExportPop = function (evenType) { $scope.openExportPop = function (evenType) {
$scope.evenType = evenType; $scope.evenType = evenType;
if ('export' == $scope.evenType) {
$scope.viewTitle = $translate.instant('SelectExportReport');
}
if ('upload' == $scope.evenType) {
$scope.viewTitle = $translate.instant('SelectUploadReport');
}
var grp = _.find($scope.$parent.$parent.groups, function (g) { var grp = _.find($scope.$parent.$parent.groups, function (g) {
return g.name == 'TaxReturnType'; return g.name == 'TaxReturnType';
}); });
......
...@@ -76,7 +76,7 @@ ...@@ -76,7 +76,7 @@
<div id="exportReportFilesContainer"> <div id="exportReportFilesContainer">
<script type="text/ng-template" class="content" id="exportReport.html"> <script type="text/ng-template" class="content" id="exportReport.html">
<div class="modal-header"> <div class="modal-header">
<h4 class="modal-title" style="float: left;width: 70%;">{{'SelectExportReport' | translate}}</h4> <h4 class="modal-title" style="float: left;width: 70%;">{{viewTitle}}</h4>
<span ng-click="$dismiss();" style="width: 20px; float: right; cursor: pointer;">x</span> <span ng-click="$dismiss();" style="width: 20px; float: right; cursor: pointer;">x</span>
</div> </div>
<div class="modal-body process-bar-container"> <div class="modal-body process-bar-container">
......
...@@ -119,12 +119,7 @@ webservices.factory('templateService', ['$log', '$http', '$q', 'apiConfig', 'htt ...@@ -119,12 +119,7 @@ webservices.factory('templateService', ['$log', '$http', '$q', 'apiConfig', 'htt
var deferred = $q.defer(); var deferred = $q.defer();
var promise = deferred.promise; var promise = deferred.promise;
var url = null; var url = null;
if(!init){ url = loginContext.apiHost + constant.webapi.prefix + '/template/getPeriodTemplateJson?templateId=' + templateID+"&period="+period+"&orgId="+projectId;
url = loginContext.apiHost + constant.webapi.prefix + '/template/getPeriodTemplateJson?templateId=' + templateID+"&period="+period+"&projectId="+projectId;
}else{
url = loginContext.apiHost + constant.webapi.prefix + '/template/getPeriodTemplateJson?templateId=' + templateID;
}
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
xhr.open('POST', url, true); // 也可以使用POST方式,根据接口 xhr.open('POST', url, true); // 也可以使用POST方式,根据接口
xhr.responseType = "blob"; // 返回类型blob xhr.responseType = "blob"; // 返回类型blob
......
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