Commit 2cf0f02e authored by Cheng C Yang's avatar Cheng C Yang

Balance Sheet and Profit table

parent 4313d019
......@@ -16,4 +16,6 @@ public final class ExportTemplatePathConstant {
public static final String ADJUSTMENT_TABLE = "/vat_excel_template/adjustment_table.xlsx";
public static final String PROFIT_LOSS_STATEMENT_PRC_MANUAL_REPORT = "/vat_excel_template/profit_loss_statement_prc_manual.xlsx";
public static final String BALANCE_SHEET_PRC_MANUAL="/vat_excel_template/balance_sheet_prc_manual.xlsx";
public static final String CASH_FLOW_MANUAL = "/vat_excel_template/cash_flow_manual.xlsx";
}
......@@ -127,6 +127,13 @@ public class DataPreviewController extends BaseController {
dataPreviewSerivceImpl.exportCashFlowList(response, param, fileName);
}
@RequestMapping(value = "exportCFMData/get", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public void downloadCFMQueryData(@RequestBody CashFlowParam param, HttpServletResponse response) {
logger.debug("enter downloadCFQueryData");
String fileName = "testFile";
dataPreviewSerivceImpl.exportCashFlowManualList(response, param, fileName);
}
@RequestMapping(value = "exportADTBData/get", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public void downloadADTBQueryData(@RequestBody AdjustmentTableParam param, HttpServletResponse response) {
logger.debug("enter downloadADTBQueryData");
......
......@@ -3,6 +3,7 @@ package pwc.taxtech.atms.dto.vatdto.excelheader;
public class CashFlowHeader {
private String companyNameCn;
private String companyNameEn;
private String companyCode;
private Integer periodStart;
private Integer periodEnd;
private String ledgerName;
......@@ -25,6 +26,16 @@ public class CashFlowHeader {
this.companyNameEn = companyNameEn;
}
public String getCompanyCode() {
return companyCode;
}
public void setCompanyCode(String companyCode) {
this.companyCode = companyCode;
}
public Integer getPeriodStart() {
return periodStart;
}
......
......@@ -50,6 +50,7 @@ public class CommonDocumentHelper {
Streams.safeClose(os);
}
}
public OutputStream toXlsxFileUsingJxls(Object header, List<?> list, String excelTemplatePathInClassPath) {
//InputStream is = Streams.fileIn(excelTemplatePathInClassPath);
InputStream is = this.getClass().getResourceAsStream(excelTemplatePathInClassPath);
......
......@@ -275,6 +275,41 @@ public class DataPreviewSerivceImpl extends BaseService {
return null;
}
public HttpServletResponse exportCashFlowManualList(HttpServletResponse response, CashFlowParam param, String fileName) {
//Boolean isEn = StringUtils.equals(language, "en-us");
logger.debug("start export CashFlow list to excel");
//String excelTemplatePathInClassPath = "/vat_excel_template/cash_flow"+(isEn?"":"_cn") + ".xlsx";
String excelTemplatePathInClassPath = ExportTemplatePathConstant.CASH_FLOW_MANUAL;
CashFlowCondition condition = new CashFlowCondition();
beanUtil.copyProperties(param, condition);
PageHelper.startPage(param.getPageInfo().getPageIndex(), param.getPageInfo().getPageSize());
List<CashFlow> cashFlows = cashFlowManualMapper.selectByCondition(condition);
List<CashFlowDto> cashFlowDtos = Lists.newArrayList();
cashFlows.forEach(cf -> {
CashFlowDto cashFlowDto = new CashFlowDto();
beanUtil.copyProperties(cf, cashFlowDto);
cashFlowDtos.add(cashFlowDto);
});
CashFlowHeader cashFlowHeader = new CashFlowHeader();
if (cashFlowDtos.size() > 0) {
Organization org = organizationMapper.selectByPrimaryKey(param.getOrgId());
cashFlowHeader.setCompanyNameCn(org.getName());
cashFlowHeader.setCompanyCode(org.getCode());
cashFlowHeader.setPeriodStart(param.getPeriodStart());
cashFlowHeader.setLedgerName(cashFlowDtos.get(0).getLedgerName());
cashFlowHeader.setLedgerCurrencyCode(cashFlowDtos.get(0).getLedgerCurrencyCode());
}
OutputStream outputStream = commonDocumentHelper.toXlsxFileUsingJxls(cashFlowHeader, cashFlowDtos, excelTemplatePathInClassPath);
try {
return responseMessageBuilder.getDownloadTmpResponseMessage(response, outputStream, fileName);
} catch (Exception e) {
e.printStackTrace();
logger.error(e.getMessage());
}
return null;
}
public HttpServletResponse exportAdjustmentTableList(HttpServletResponse response, AdjustmentTableParam param, String fileName) {
//Boolean isEn = StringUtils.equals(language, "en-us");
logger.debug("start export AdjustmentTable list to excel");
......
......@@ -201,6 +201,14 @@
FileSaver.saveAs(data,fileName + '_'+queryParm.periodStart+'-'+queryParm.periodEnd+'_'+vatSessionService.project.name+'.xlsx');
});
},
initExportCFMData: function (queryParm, fileName) {
var thisConfig = apiConfig.create();
thisConfig.responseType = "arraybuffer";
return $http.post('/dataPreview/exportCFMData/get', queryParm, thisConfig).then(function (response) {
var data = new Blob([response.data], {type: response.headers('Content-Type')});
FileSaver.saveAs(data,fileName + '_'+queryParm.periodStart+'-'+queryParm.periodEnd+'_'+vatSessionService.project.name+'.xlsx');
});
},
getADTBDataForDisplay: function (queryParams) {
return $http.post('/dataPreview/getADTBDataForDisplay', queryParams, apiConfig.createVat());
},
......
......@@ -930,12 +930,12 @@
$state.go('vat.previewData.coupaPurchasingReport');
} else if (data[constant.vatPermission.dataPreview.invoiceData.queryCode]) {
$state.go('vat.previewData.invoiceData');
} else if (data[constant.vatPermission.dataPreview.cashFlowManual.queryCode]) {
$state.go('vat.previewData.cashFlowManual');
} else if (data[constant.vatPermission.dataPreview.profitTable.queryCode]) {
$state.go('vat.previewData.vatPreviewProfitTable');
} else if (data[constant.vatPermission.dataPreview.balanceSheet.queryCode]) {
$state.go('vat.previewData.vatPreviewTheBalanceSheet');
} else if (data[constant.vatPermission.dataPreview.cashFlowManual.queryCode]) {
$state.go('vat.previewData.cashFlowManual');
}else if (data[constant.vatPermission.dataManage.caculateDataCode]) {
$state.go('vat.reductionData.caculateData');
} else if (data[constant.vatPermission.dataManage.revenueDetailCode]) {
......
......@@ -81,6 +81,10 @@
text: $translate.instant('invoiceData'), icon: 'fa fa-file-text-o', show: true
},
//TODO 增加TAB
{
name: 'cashFlowManual', permission: constant.vatPermission.dataPreview.cashFlowManual.queryCode,
text: $translate.instant('CashFlowManual'), icon: 'fa fa-file-text-o', show: true
},
{
name: 'vatPreviewProfitTable', permission: constant.vatPermission.dataPreview.profitTable.queryCode,
text: $translate.instant('ProfitTable'), icon: 'fa fa-file-text-o', show: true
......@@ -89,10 +93,6 @@
name: 'vatPreviewTheBalanceSheet', permission: constant.vatPermission.dataPreview.balanceSheet.queryCode,
text: $translate.instant('offBalanceSheet'), icon: 'fa fa-file-text-o', show: true
},
{
name: 'cashFlowManual', permission: constant.vatPermission.dataPreview.cashFlowManual.queryCode,
text: $translate.instant('CashFlowManual'), icon: 'fa fa-file-text-o', show: true
},
{
name: 'adjustmentTab', permission: constant.vatPermission.dataPreview.adjustmentTab.queryCode,
text: $translate.instant('adjustmentTable'), icon: 'fa fa-file-text-o', show: false
......
......@@ -212,7 +212,6 @@
// });
// var ele2 = $("#certificationDateEnd");
// ele2.datepicker({
// startDate: $scope.startDate,
......@@ -240,7 +239,7 @@
$scope.downloadCashFlow = function () {
var localDate = $filter('date')(new Date(), 'yyyyMMddHHmmss');
var fileName = "现金流量信息";
vatPreviewService.initExportCFData($scope.queryParams, fileName).then(function (data) {
vatPreviewService.initExportCFMData($scope.queryParams, fileName).then(function (data) {
if (data) {
ackMessageBox.success(translate('FileExportSuccess'));
}
......@@ -251,7 +250,6 @@
$log.debug('VatPreviewInputInvoiceController.ctor()...');
initPeriods();
showPopover();
......
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