Commit 7e573a12 authored by frank.xa.zhang's avatar frank.xa.zhang

add new api download preview data

parent 9ac46e3f
......@@ -2,6 +2,7 @@ package pwc.taxtech.atms.controller;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpStatus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -13,12 +14,16 @@ import pwc.taxtech.atms.dto.PagingDto;
import pwc.taxtech.atms.dto.PagingResultDto;
import pwc.taxtech.atms.dto.vatdto.CustomsInvoiceDto;
import pwc.taxtech.atms.dto.vatdto.CustomsInvoiceFilter;
import pwc.taxtech.atms.dto.vatdto.JsonCustomsInvoice;
import pwc.taxtech.atms.dto.vatdto.JsonCustomsInvoiceDto;
import pwc.taxtech.atms.thirdparty.ExcelUtil;
import pwc.taxtech.atms.vat.service.CustomsInvoiceService;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.text.DateFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
@RestController
......@@ -45,6 +50,78 @@ public class CustomsInvoiceController {
return convertCustomsInvoiceDataToJson(fromPeriod, toPeriod, filter, paging);
}
@RequestMapping(value = "ExportQueryData/get", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public void exportQueryData(@RequestParam String criteria, HttpServletResponse response) {
CustomsInvoiceFilter filter = new CustomsInvoiceFilter();
if (StringUtils.isNotBlank(criteria) && !criteria.equals("null")) {
filter = JSONObject.parseObject(criteria, CustomsInvoiceFilter.class);
} else {
filter = null;
}
response.setContentType("application/vnd.ms-excel;charset=utf-8");
response.setHeader("Content-Disposition", "attachment;filename=" + UUID.randomUUID() + ".xlsx");
response.setHeader("x-file-name", UUID.randomUUID() + ".xlsx");
OutputStream os = null;
try {
os = response.getOutputStream();
int count = getDownloadFilePath(filter, os);
if (count == 0) {
response.setStatus(HttpStatus.SC_NO_CONTENT);
} else {
response.setStatus(HttpStatus.SC_OK);
}
} catch (IOException e) {
e.printStackTrace();
}
}
private int getDownloadFilePath(CustomsInvoiceFilter filter, OutputStream outputStream) {
List<JsonCustomsInvoiceDto> list = GetCustomsInvoiceDataList(filter);
if (list.size() == 0) {
return 0;
}
Map<String, String> header = new HashMap<>();
header.put("RecordNumber", "RecordNumber");
header.put("PeriodId", "期间");
header.put("IssueDate", "开具日期");
header.put("PayNum", "海关缴款书号码");
header.put("InvoiceAmount", "金额");
header.put("InvoiceTaxAmount", "税额");
header.put("AuditResult", "稽核结果");
ExcelUtil.exportExcel(header, list, outputStream);
return list.size();
}
private List<JsonCustomsInvoiceDto> GetCustomsInvoiceDataList(CustomsInvoiceFilter filter) {
List<CustomsInvoiceDto> balanceList = customsInvoiceService.getCustomsInvoicesByPeriodIds(filter.getPeriodFrom(), filter.getPeriodTo());
if (filter != null && !balanceList.isEmpty()) {
balanceList = filterCustomsInvoiceDataList(filter, balanceList);
}
List<JsonCustomsInvoiceDto> recordList = new ArrayList<>();
JsonCustomsInvoiceDto record;
int indexNumber = 1;
for (CustomsInvoiceDto dto : balanceList) {
record = new JsonCustomsInvoiceDto();
CommonUtils.copyProperties(dto, record);
record.setRecordNumber(String.valueOf(indexNumber));
record.setIssueDate(DateFormat.getDateInstance().format(dto.getIssueDate()));
record.setInvoiceTaxAmount(dto.getInvoiceTaxAmount() != null ? dto.getInvoiceTaxAmount().toString() : "0.00");
record.setInvoiceAmount(dto.getInvoiceAmount() != null ? dto.getInvoiceAmount().toString() : "0.00");
recordList.add(record);
indexNumber++;
}
return recordList;
}
private String convertCustomsInvoiceDataToJson(int fromPeriod, int toPeriod, CustomsInvoiceFilter filter, PagingDto pagination) {
String result = StringUtils.EMPTY;
List<CustomsInvoiceDto> balanceList = customsInvoiceService.getCustomsInvoicesByPeriodIds(fromPeriod, toPeriod);
......
package pwc.taxtech.atms.controller;
import org.apache.http.HttpStatus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import pwc.taxtech.atms.dto.PagingResultDto;
import pwc.taxtech.atms.dto.vatdto.InputInvoicePreviewQueryParam;
import pwc.taxtech.atms.dto.vatdto.InputVATInvoiceDto;
import pwc.taxtech.atms.dto.vatdto.*;
import pwc.taxtech.atms.thirdparty.ExcelSheet;
import pwc.taxtech.atms.thirdparty.ExcelUtil;
import pwc.taxtech.atms.vat.service.InputInvoiceDataImportService;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.util.*;
@RestController
@RequestMapping(value = "api/v1/inputInvoiceImport")
public class InputInvoiceImportController {
......@@ -18,7 +22,81 @@ public class InputInvoiceImportController {
InputInvoiceDataImportService inputInvoiceDataImportService;
@RequestMapping(value = "inputInvoicePreviewList", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public PagingResultDto<InputVATInvoiceDto> getInputInvoiceTreeViewData(@RequestBody InputInvoicePreviewQueryParam paras) {
public @ResponseBody
PagingResultDto<InputVATInvoiceDto> getInputInvoiceTreeViewData(@RequestBody InputInvoicePreviewQueryParam paras) {
return inputInvoiceDataImportService.getInputInvoiceTreeViewData(paras);
}
@RequestMapping(value = "exportQueryData/get", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public void downloadInvoiceQueryData(@RequestBody InputInvoicePreviewQueryParam paras, HttpServletResponse response) {
response.setContentType("application/vnd.ms-excel;charset=utf-8");
response.setHeader("Content-Disposition", "attachment;filename=" + UUID.randomUUID() + ".xlsx");
response.setHeader("x-file-name", UUID.randomUUID() + ".xlsx");
OutputStream os = null;
try {
os = response.getOutputStream();
int count = getDownloadFilePath(paras, os);
if (count == 0) {
response.setStatus(HttpStatus.SC_NO_CONTENT);
} else {
response.setStatus(HttpStatus.SC_OK);
}
} catch (IOException e) {
e.printStackTrace();
}
}
private int getDownloadFilePath(InputInvoicePreviewQueryParam paras, OutputStream outputStream) {
List<InputVATInvoiceDto> list = inputInvoiceDataImportService.getInputInvoiceTreeViewData(paras).getList();
if (list.size() == 0) {
//return 0;
}
Map<String, String> header = new HashMap<>();
header.put("PeriodID", "期间");
header.put("InvoiceDate", "开票日期");
header.put("InvoiceCode", "发票代码");
header.put("InvoiceNumber", "发票号码");
header.put("SellerTaxNumber", "供货方税号");
header.put("InvoiceTypeName", "发票类型");
header.put("Amount", "金额");
header.put("TaxAmount", "税额");
header.put("CertificationDate", "认证日期");
ExcelSheet excelSheetA = new ExcelSheet<>();
excelSheetA.setHeaders(header);
excelSheetA.setDataset(list);
excelSheetA.setSheetName("sheetA");
Map<String, String> header2 = new HashMap<>();
header2.put("PeriodID", "期间");
header2.put("InvoiceCode", "发票代码");
header2.put("InvoiceNumber", "发票号码");
header2.put("Amount", "金额");
header2.put("TaxAmount", "税额");
header2.put("TaxRate", "税率");
header2.put("ProductionName", "货物名称");
ExcelSheet excelSheetB = new ExcelSheet<>();
excelSheetB.setHeaders(header2);
excelSheetB.setSheetName("sheetB");
List<InputVATInvoiceItemDto> inputInvoiceItemList = new ArrayList<>();
for (InputVATInvoiceDto item : list) {
List<InputVATInvoiceItemDto> tempResult = inputInvoiceDataImportService.getInputInvoiceItemTreeViewData(item.getID());
for (InputVATInvoiceItemDto r : tempResult) {
inputInvoiceItemList.add(r);
}
}
excelSheetB.setDataset(inputInvoiceItemList);
List<ExcelSheet<InputVATInvoiceBaseDto>> sheets = new ArrayList<>();
sheets.add(excelSheetA);
sheets.add(excelSheetB);
ExcelUtil.exportExcel(sheets, outputStream);
return list.size();
}
}
package pwc.taxtech.atms.controller;
import org.apache.http.HttpStatus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
......@@ -9,8 +10,17 @@ import org.springframework.web.bind.annotation.RestController;
import pwc.taxtech.atms.dto.PagingResultDto;
import pwc.taxtech.atms.dto.vatdto.OutputVATInvoiceInfoDto;
import pwc.taxtech.atms.dto.vatdto.QueryOutputDto;
import pwc.taxtech.atms.thirdparty.ExcelUtil;
import pwc.taxtech.atms.vat.service.OutputInvoiceService;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
@RestController
@RequestMapping(value = "api/v1/outputInvoiceImport")
public class OutputInvoiceController {
......@@ -22,4 +32,56 @@ public class OutputInvoiceController {
public PagingResultDto<OutputVATInvoiceInfoDto> queryOutputInvoiceList(@RequestBody QueryOutputDto queryDto) {
return outputInvoiceService.queryOutputInvoiceList(queryDto);
}
@RequestMapping(value = "getExportOutputInvoiceList", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public void downloadInvoiceQueryData(@RequestBody QueryOutputDto paras, HttpServletResponse response) {
response.setContentType("application/vnd.ms-excel;charset=utf-8");
response.setHeader("Content-Disposition", "attachment;filename="
+ UUID.randomUUID() + ".xls");
response.setHeader("x-file-name",UUID.randomUUID() + ".xlsx");
OutputStream os = null;
try {
os = response.getOutputStream();
int count = getDownloadFilePath(paras, os);
if(count==0){
response.setStatus(HttpStatus.SC_NO_CONTENT);
}
else
{
response.setStatus(HttpStatus.SC_OK);
}
} catch (IOException e) {
e.printStackTrace();
}
}
private int getDownloadFilePath(QueryOutputDto paras, OutputStream outputStream) {
List<OutputVATInvoiceInfoDto> list = outputInvoiceService.getExportOutputInvoiceList(paras).getData();
if (list.size() == 0) {
return 0;
}
Map<String, String> header = new HashMap<>();
header.put("InvoiceTypeName", "发票类型");
header.put("ClassCode", "发票代码");
header.put("InvoiceNumber", "发票号码");
header.put("BuyerName", "购方企业名称");
header.put("BuyerTaxNumber", "购方税号");
header.put("BankAccount", "银行账号");
header.put("PhoneNum", "地址电话");
header.put("InvoiceDate", "开票日期");
header.put("CodeVersion", "商品编码版本号");
header.put("DocumentNum", "单据号");
header.put("ProductName", "商品名称");
header.put("ProductStandar", "规格");
header.put("Unit", "单位");
header.put("Quantity", "数量");
header.put("UnitPrice", "单价");
header.put("Amount", "金额");
header.put("TaxRate", "税率");
header.put("TaxAmount", "税额");
header.put("TaxClassCode", "税收分类编码");
ExcelUtil.exportExcel(header, list, outputStream);
return list.size();
}
}
package pwc.taxtech.atms.dto.vatdto;
public abstract class InputVATInvoiceBaseDto {
}
......@@ -5,7 +5,7 @@ import pwc.taxtech.atms.constant.enums.EnumInvoiceType;
import java.math.BigDecimal;
import java.util.Date;
public class InputVATInvoiceDto {
public class InputVATInvoiceDto extends InputVATInvoiceBaseDto {
private String ID ;
private int periodID ;
private String invoiceCode ;
......
package pwc.taxtech.atms.dto.vatdto;
public class InputVATInvoiceItemDto extends InputVATInvoiceBaseDto {
}
package pwc.taxtech.atms.dto.vatdto;
public class JsonCustomsInvoice {
}
......@@ -3,7 +3,12 @@ package pwc.taxtech.atms.vat.service;
import pwc.taxtech.atms.dto.PagingResultDto;
import pwc.taxtech.atms.dto.vatdto.InputInvoicePreviewQueryParam;
import pwc.taxtech.atms.dto.vatdto.InputVATInvoiceDto;
import pwc.taxtech.atms.dto.vatdto.InputVATInvoiceItemDto;
import java.util.List;
public interface InputInvoiceDataImportService {
PagingResultDto<InputVATInvoiceDto> getInputInvoiceTreeViewData(InputInvoicePreviewQueryParam paras);
List<InputVATInvoiceItemDto> getInputInvoiceItemTreeViewData(String id);
}
package pwc.taxtech.atms.vat.service;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.PagingResultDto;
import pwc.taxtech.atms.dto.vatdto.OutputVATInvoiceInfoDto;
import pwc.taxtech.atms.dto.vatdto.QueryOutputDto;
import java.util.List;
public interface OutputInvoiceService {
PagingResultDto<OutputVATInvoiceInfoDto> queryOutputInvoiceList(QueryOutputDto queryDto);
OperationResultDto<List<OutputVATInvoiceInfoDto>> getExportOutputInvoiceList(QueryOutputDto queryDto);
}
......@@ -2,9 +2,14 @@ package pwc.taxtech.atms.vat.service.impl;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.common.CommonUtils;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.PagingResultDto;
import pwc.taxtech.atms.dto.vatdto.InputInvoicePreviewQueryParam;
import pwc.taxtech.atms.dto.vatdto.InputVATInvoiceDto;
import pwc.taxtech.atms.dto.vatdto.InputVATInvoiceItemDto;
import pwc.taxtech.atms.dto.vatdto.QueryOutputDto;
import pwc.taxtech.atms.vat.entity.InputVATInvoiceItem;
import pwc.taxtech.atms.vat.entity.InputVATInvoiceItemExample;
import pwc.taxtech.atms.vat.service.InputInvoiceDataImportService;
import java.util.ArrayList;
......@@ -32,4 +37,18 @@ public class InputInvoiceDataImportServiceImpl extends VatAbstractService implem
}
return qResult;
}
@Override
public List<InputVATInvoiceItemDto> getInputInvoiceItemTreeViewData(String id) {
InputVATInvoiceItemExample example = new InputVATInvoiceItemExample();
example.createCriteria().andInputVATInvoiceIDEqualTo(id);
List<InputVATInvoiceItem> list = inputVATInvoiceItemMapper.selectByExample(example);
List<InputVATInvoiceItemDto> result = new ArrayList<>();
list.forEach(a -> {
InputVATInvoiceItemDto dto = new InputVATInvoiceItemDto();
CommonUtils.copyProperties(a, dto);
result.add(dto);
});
return result;
}
}
......@@ -4,9 +4,12 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.common.CommonUtils;
import pwc.taxtech.atms.common.PagingList;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.PagingResultDto;
import pwc.taxtech.atms.dto.vatdto.OutputVATInvoiceInfoDto;
import pwc.taxtech.atms.dto.vatdto.QueryOutputDto;
import pwc.taxtech.atms.vat.entity.OutputVATInvoiceItem;
import pwc.taxtech.atms.vat.entity.OutputVATInvoiceItemExample;
import pwc.taxtech.atms.vat.service.OutputInvoiceService;
import java.math.BigDecimal;
......@@ -25,6 +28,84 @@ public class OutputInvoiceServiceImpl extends VatAbstractService implements Outp
PagingResultDto<OutputVATInvoiceInfoDto> qResult = new PagingResultDto<>();
qResult.setPageInfo(queryDto.getPageInfo());
qResult.setList(new ArrayList<>());
List<OutputVATInvoiceInfoDto> finalList = getQueryList(queryDto);
qResult.getPageInfo().setTotalCount(finalList.size());
if (finalList.size() > 0) {
PagingList pagingList = new PagingList(finalList, qResult.getPageInfo());
qResult.setList(pagingList.getPagingList());
}
return qResult;
}
@Override
public OperationResultDto<List<OutputVATInvoiceInfoDto>> getExportOutputInvoiceList(QueryOutputDto queryDto) {
OperationResultDto<List<OutputVATInvoiceInfoDto>> result = new OperationResultDto<>();
List<OutputVATInvoiceInfoDto> finalList = getQueryList(queryDto);
finalList = getOutputDetailInfoList(finalList);
result.setData(finalList);
result.setResult(true);
return result;
}
private List<OutputVATInvoiceInfoDto> getOutputDetailInfoList(List<OutputVATInvoiceInfoDto> query) {
List<OutputVATInvoiceInfoDto> list = new ArrayList<>();
List<OutputVATInvoiceItem> outItem = outputVATInvoiceItemMapper.selectByExample(new OutputVATInvoiceItemExample());
if (query != null && query.size() > 0) {
for (OutputVATInvoiceInfoDto dto : query) {
List<OutputVATInvoiceItem> itemList = outItem.stream()
.filter(a -> a.getInvoiceID().equals(dto.getInvoiceID()))
.sorted(Comparator.comparing(OutputVATInvoiceItem::getSeqNo))
.collect(Collectors.toList());
if (itemList != null && itemList.size() > 0) {
OutputVATInvoiceInfoDto newDto = new OutputVATInvoiceInfoDto();
CommonUtils.copyProperties(dto, newDto);
newDto.setCodeVersion(itemList.get(0).getCodeVersion());
newDto.setProductName(itemList.get(0).getProductName());
newDto.setDocumentNum(itemList.get(0).getDocumentNum());
newDto.setProductStandard(itemList.get(0).getProductStandard());
newDto.setUnit(itemList.get(0).getUnit());
newDto.setQuantity(itemList.get(0).getQuantity());
newDto.setUnitPrice(itemList.get(0).getUnitPrice());
newDto.setAmount(itemList.get(0).getAmount());
newDto.setTaxRate(itemList.get(0).getTaxRate());
newDto.setTaxAmount(itemList.get(0).getTaxAmount());
newDto.setTaxClassCode(itemList.get(0).getTaxClassCode());
list.add(newDto);
if (itemList.size() > 1) {
for (int i = 1; i < itemList.size(); i++) {
OutputVATInvoiceInfoDto invoiceDto = new OutputVATInvoiceInfoDto();
invoiceDto.setPeriodID(dto.getPeriodID());
invoiceDto.setInvoiceType(null);
invoiceDto.setClassCode(StringUtils.EMPTY);
invoiceDto.setInvoiceNumber(StringUtils.EMPTY);
invoiceDto.setBuyerName(StringUtils.EMPTY);
invoiceDto.setBuyerTaxNumber(StringUtils.EMPTY);
invoiceDto.setBankAccount(StringUtils.EMPTY);
invoiceDto.setPhoneNum(StringUtils.EMPTY);
invoiceDto.setInvoiceDate(null);
invoiceDto.setCodeVersion(itemList.get(i).getCodeVersion());
invoiceDto.setProductName(itemList.get(i).getProductName());
invoiceDto.setDocumentNum(itemList.get(i).getDocumentNum());
invoiceDto.setProductStandard(itemList.get(i).getProductStandard());
invoiceDto.setUnit(itemList.get(i).getUnit());
invoiceDto.setQuantity(itemList.get(i).getQuantity());
invoiceDto.setUnitPrice(itemList.get(i).getUnitPrice());
invoiceDto.setAmount(itemList.get(i).getAmount());
invoiceDto.setTaxRate(itemList.get(i).getTaxRate());
invoiceDto.setTaxAmount(itemList.get(i).getTaxAmount());
invoiceDto.setTaxClassCode(itemList.get(i).getTaxClassCode());
list.add(invoiceDto);
}
}
}
}
}
return list;
}
private List<OutputVATInvoiceInfoDto> getQueryList(QueryOutputDto queryDto) {
List<OutputVATInvoiceInfoDto> rList = outputVATInvoiceMapper.selectOutputVATInvoiceInfoLeftJoinItem(queryDto);
Function<OutputVATInvoiceInfoDto, List<Object>> compositeKey = outputVATInvoiceInfoDto ->
Arrays.asList(outputVATInvoiceInfoDto.getInvoiceID()
......@@ -73,13 +154,6 @@ public class OutputInvoiceServiceImpl extends VatAbstractService implements Outp
if (queryDto.getTaxAmountEnd() != null) {
stream = stream.filter(a -> a.getTaxAmount().compareTo(queryDto.getTaxAmountEnd()) < 0);
}
List<OutputVATInvoiceInfoDto> finalList = stream.sorted(Comparator.comparing(OutputVATInvoiceInfoDto::getInvoiceDate)).collect(Collectors.toList());
qResult.getPageInfo().setTotalCount(finalList.size());
if (finalList.size() > 0) {
PagingList pagingList = new PagingList(finalList, qResult.getPageInfo());
qResult.setList(pagingList.getPagingList());
}
return qResult;
return stream.sorted(Comparator.comparing(OutputVATInvoiceInfoDto::getInvoiceDate)).collect(Collectors.toList());
}
}
......@@ -20,5 +20,8 @@ public class VatAbstractService {
OutputVATInvoiceMapper outputVATInvoiceMapper;
@Autowired
CustomsInvoiceMapper customsInvoiceMapper;
@Autowired
OutputVATInvoiceItemMapper outputVATInvoiceItemMapper;
@Autowired
InputVATInvoiceItemMapper inputVATInvoiceItemMapper;
}
......@@ -82,6 +82,10 @@
criteria = "";
vatImportService.getExportCustomInvoiceList(criteria).success(function (data, status, headers) {
if(status===204){
SweetAlert.warning("没有数据可以下载");
return;
}
vatExportService.exportToExcel(data, status, headers, 'CustomInvoice.xlsx');
});
};
......
......@@ -512,6 +512,10 @@
//导出进项发票数据
var downloadInputInvoice = function () {
vatPreviewService.getExportInputInvoiceList($scope.queryParams).success(function (data, status, headers) {
if(status===204){
SweetAlert.warning("没有数据可以下载");
return;
}
vatExportService.exportToExcel(data, status, headers, '进项发票信息.xlsx');
});
};
......
......@@ -44,7 +44,7 @@
$scope.InvoiceType = {};
//初始化期间
var initPeriods = function () {
var initPeriods = function () {
$scope.queryParams = {
pageInfo: {},
periodStart: '',
......@@ -140,7 +140,7 @@
$('#totalInvoicePage').css('display', 'inline-block');
}
};
//初始化分页信息
var initOutputInvoicePagination = function () {
......@@ -165,7 +165,7 @@
break;
case 1:
type = invoiceTypeEnum.Special;
break;
break;
default:
type = "";
}
......@@ -174,7 +174,7 @@
//将选择了的查询条件显示在grid上方
var doDataFilter = function (removeData) {
//设置起止期间
if ($scope.queryParams.periodStart > $scope.queryParams.periodEnd) {
$scope.queryParams.periodEnd = $scope.queryParams.periodStart;
......@@ -185,10 +185,10 @@
var removeItem = removeData.split("|");
removeItem.forEach(function (v) {
$scope.queryParams[v] = null;
if ($scope.queryParams.invoiceType === null) {
$scope.InvoiceType.selected = undefined;
}
}
});
}
......@@ -196,7 +196,7 @@
if ($scope.InvoiceType.selected !== undefined)
$scope.queryParams.invoiceType = $scope.InvoiceType.selected.id;
else
$scope.queryParams.invoiceType = null;
$scope.queryParams.invoiceType = null;
// 将查询条件加入到grid上方
var crits = $scope.queryParams;
......@@ -367,7 +367,7 @@
loadOutputInvoiceDataFromDB(1);
$('.filter-button').popover("hide");
};
//去掉所有的查询条件,重新load数据
var doDataFilterReset = function () {
$scope.queryParams = {
......@@ -431,7 +431,7 @@
//初始化已选择的发票类型和认证结果
$scope.InvoiceType.selected = _.find($scope.invoiceTypeList, function (v) {
return v.id == $scope.queryParams.invoiceType;
})
})
};
//转换百分比
......@@ -441,8 +441,12 @@
//导出
var doExport = function ()
{
{
vatPreviewService.getExportOutputInvoiceList($scope.queryParams).success(function (data, status, headers) {
if(status===204){
SweetAlert.warning("没有数据可以下载");
return;
}
vatExportService.exportToExcel(data, status, headers, '销项发票信息.xlsx');
}).error(function () {
SweetAlert.error($translate.instant('PleaseContactAdministrator'));
......@@ -452,7 +456,7 @@
//$scope.$on('ngRepeatFinished', function (ngRepeatFinishedEvent) {
// export_table_to_excel('exportTable', 'OutputInvoice', 'xlsx', '');
//});
$scope.gridOptionsColumnDefs = [
{
name: $translate.instant('ImportErrorPopUpNoCol'), width: '5%',
......@@ -469,7 +473,7 @@
{
name: $translate.instant('InvoiceType'), width: '10%',
cellTemplate: '<div class="ui-grid-cell-contents" title="{{grid.appScope.typeToString(row.entity.invoiceType)}}"><span>{{grid.appScope.typeToString(row.entity.invoiceType)}}<span></div>'
},
},
{
name: $translate.instant('ClassCode'), width: '10%',
cellTemplate: '<div class="ui-grid-cell-contents" title="{{row.entity.classCode}}"><span>{{row.entity.classCode}}<span></div>'
......@@ -477,7 +481,7 @@
{
name: $translate.instant('InvoiceNumber'), width: '10%',
cellTemplate: '<div class="ui-grid-cell-contents" title="{{row.entity.invoiceNumber}}"><span>{{row.entity.invoiceNumber}}</span></div>'
},
},
{
name: $translate.instant('BuyerName'), width: '15%',
cellTemplate: '<div class="ui-grid-cell-contents" title="{{row.entity.buyerName}}"><span>{{row.entity.buyerName}}</span></div>'
......@@ -493,7 +497,7 @@
//{
// name: $translate.instant('PhoneNum'), width: '8%',
// cellTemplate: '<div class="ui-grid-cell-contents" title="{{row.entity.phoneNum}}"><span>{{row.entity.phoneNum}}</span></div>'
//},
//},
{
name: $translate.instant('Amount'), width: '8%', headerCellClass: 'right',
cellTemplate: '<div class="ui-grid-cell-contents right" title="{{row.entity.amount}}"><span>{{row.entity.amount}}</span></div>'
......@@ -510,7 +514,7 @@
cellTemplate: '<div class="ui-grid-cell-contents"><span>{{row.entity.seqNo}}</span></div>'
},
{
name: $translate.instant('ProductName'),
name: $translate.instant('ProductName'),
cellTemplate: '<div class="ui-grid-cell-contents" title="{{row.entity.productName}}"><span>{{row.entity.productName}}</span></div>'
},
{
......@@ -541,7 +545,7 @@
// name: $translate.instant('DocumentNum'), width: '8%',
// cellTemplate: '<div class="ui-grid-cell-contents" title="{{row.entity.documentNum}}"><span>{{row.entity.documentNum}}</span></div>'
//},
//{
// name: $translate.instant('ProductStandar'), width: '8%',
// cellTemplate: '<div class="ui-grid-cell-contents" title="{{row.entity.productStandard}}"><span>{{row.entity.productStandard}}</span></div>'
......@@ -549,7 +553,7 @@
//{
// name: $translate.instant('Unit'), width: '8%',
// cellTemplate: '<div class="ui-grid-cell-contents" title="{{row.entity.unit}}"><span>{{row.entity.unit}}</span></div>'
//},
//},
//{
// name: $translate.instant('TaxClassCode'), width: '15%',
// cellTemplate: '<div class="ui-grid-cell-contents" title="{{row.entity.taxClassCode}}"><span>{{row.entity.taxClassCode}}</span></div>'
......@@ -574,7 +578,7 @@
startMonth = result[0][0];
//结束月份
endMonth = result[1][0];
$scope.queryParams.periodStart = startMonth;
$scope.queryParams.periodStart = startMonth;
$scope.queryParams.periodEnd = endMonth;
loadOutputInvoiceDataFromDB(1);
......@@ -606,7 +610,7 @@
//获取子table数据
vatPreviewService.queryOutputInvoiceItemList(row.entity.invoiceID).success(function (data) {
if (data) {
data.forEach(function (v) {
data.forEach(function (v) {
v.unitPrice = PWC.round(v.unitPrice, 2);
v.amount = PWC.round(v.amount, 2);
v.taxRate = PWC.round(v.taxRate, 2);
......@@ -622,10 +626,10 @@
$scope.gridApi.core.handleWindowResize();
}, 500, 60 * 60 * 8);
}
};
};
$scope.doDataFilter = doDataFilter;
$scope.doDataFilterReset = doDataFilterReset;
$scope.doExport = doExport;
$scope.doExport = doExport;
$scope.showPopover = showPopover;
initPeriods();
initOutputInvoicePagination();
......
......@@ -31183,6 +31183,10 @@ vatModule.controller('vatPreviewCustomInvoiceSheetController', ['$scope', '$log'
criteria = "";
vatImportService.getExportCustomInvoiceList(criteria).success(function (data, status, headers) {
if(status===204){
SweetAlert.warning("没有数据可以下载");
return;
}
vatExportService.exportToExcel(data, status, headers, 'CustomInvoice.xlsx');
});
};
......@@ -32242,6 +32246,10 @@ vatModule.controller('VatPreviewInputInvoiceController', ['$scope', '$log', '$tr
//导出进项发票数据
var downloadInputInvoice = function () {
vatPreviewService.getExportInputInvoiceList($scope.queryParams).success(function (data, status, headers) {
if(status===204){
SweetAlert.warning("没有数据可以下载");
return;
}
vatExportService.exportToExcel(data, status, headers, '进项发票信息.xlsx');
});
};
......@@ -32819,6 +32827,10 @@ vatModule.controller('vatPreviewOutputInvoiceController', ['$scope', '$log', '$t
var doExport = function ()
{
vatPreviewService.getExportOutputInvoiceList($scope.queryParams).success(function (data, status, headers) {
if(status===204){
SweetAlert.warning("没有数据可以下载");
return;
}
vatExportService.exportToExcel(data, status, headers, '销项发票信息.xlsx');
}).error(function () {
SweetAlert.error($translate.instant('PleaseContactAdministrator'));
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