Commit 3b19a6f7 authored by frank.xa.zhang's avatar frank.xa.zhang

add invoice and voucher datasource manually --part5 ---not finished yet

1.can't compute the datasource to cell data
2.can't display data in time(need exchange the report to load data)
3.can't display the content of voucher and invoice (fixed this one)

should be fixed until the function is completely
parent e6042f60
...@@ -99,4 +99,9 @@ public class ReportController { ...@@ -99,4 +99,9 @@ public class ReportController {
public OperationResultDto addDataSourceItems(@RequestBody DataSourceDto dataSource){ public OperationResultDto addDataSourceItems(@RequestBody DataSourceDto dataSource){
return reportService.addDataSourceItems(dataSource); return reportService.addDataSourceItems(dataSource);
} }
@RequestMapping(value = "getDataSourceDetailList/{dataSourceId}",method = RequestMethod.GET,produces =MediaType.APPLICATION_JSON_UTF8_VALUE)
public OperationResultDto<String> getDataSourceDetailList(@PathVariable Long datasSourceId){
return reportService.getDataSourceDetailList(datasSourceId);
}
} }
\ No newline at end of file
package pwc.taxtech.atms.dto.vatdto;
import lombok.Getter;
import lombok.Setter;
import java.math.BigDecimal;
import java.util.Date;
@Setter
@Getter
public class InputVATInvoiceItemExtendDto {
String invoiceId;
String invoiceItemId;
Integer period;
Date certificationDate;
String sellerTaxNumber;
String invoiceCode;
String invoiceNumber;
BigDecimal amount;
Integer invoiceType;
BigDecimal taxAmount;
}
...@@ -5,10 +5,7 @@ import org.apache.ibatis.annotations.Mapper; ...@@ -5,10 +5,7 @@ import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds; import org.apache.ibatis.session.RowBounds;
import pwc.taxtech.atms.MyVatMapper; import pwc.taxtech.atms.MyVatMapper;
import pwc.taxtech.atms.dto.vatdto.CellInvoiceDto; import pwc.taxtech.atms.dto.vatdto.*;
import pwc.taxtech.atms.dto.vatdto.InputInvoicePreviewQueryParam;
import pwc.taxtech.atms.dto.vatdto.InputVATInvoiceDto;
import pwc.taxtech.atms.dto.vatdto.InputVATInvoiceResultDto;
import pwc.taxtech.atms.vat.entity.InputVATInvoice; import pwc.taxtech.atms.vat.entity.InputVATInvoice;
import pwc.taxtech.atms.vat.entity.InputVATInvoiceExample; import pwc.taxtech.atms.vat.entity.InputVATInvoiceExample;
...@@ -117,4 +114,6 @@ public interface InputVATInvoiceMapper extends MyVatMapper { ...@@ -117,4 +114,6 @@ public interface InputVATInvoiceMapper extends MyVatMapper {
List<InputVATInvoiceResultDto> getInputVATInvoiceResultDto(@Param("dbName")String dbName); List<InputVATInvoiceResultDto> getInputVATInvoiceResultDto(@Param("dbName")String dbName);
List<CellInvoiceDto> selectInputInvoiceWithItem(); List<CellInvoiceDto> selectInputInvoiceWithItem();
InputVATInvoiceItemExtendDto selectInvoiceExtendDto(@Param("invoiceItemId") String invoiceItemId);
} }
\ No newline at end of file
...@@ -41,4 +41,6 @@ public interface ReportService { ...@@ -41,4 +41,6 @@ public interface ReportService {
OperationResultDto<String> getAllDataItems(Integer dataSourceType); OperationResultDto<String> getAllDataItems(Integer dataSourceType);
OperationResultDto addDataSourceItems(DataSourceDto dataSource); OperationResultDto addDataSourceItems(DataSourceDto dataSource);
OperationResultDto<String> getDataSourceDetailList(Long datasSourceId);
} }
...@@ -19,6 +19,7 @@ import pwc.taxtech.atms.vat.service.impl.report.functions.FormulaHelper; ...@@ -19,6 +19,7 @@ import pwc.taxtech.atms.vat.service.impl.report.functions.FormulaHelper;
import javax.swing.text.html.Option; import javax.swing.text.html.Option;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.sql.Struct;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -449,6 +450,10 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi ...@@ -449,6 +450,10 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
dataSourceDto.setDataSourceType(CellDataSourceType.Formula.getCode()); dataSourceDto.setDataSourceType(CellDataSourceType.Formula.getCode());
} else if (a.getType().equals(FormulaDataSourceType.KeyInSource.getCode())) { } else if (a.getType().equals(FormulaDataSourceType.KeyInSource.getCode())) {
dataSourceDto.setDataSourceType(CellDataSourceType.KeyIn.getCode()); dataSourceDto.setDataSourceType(CellDataSourceType.KeyIn.getCode());
} else if (a.getType().equals(FormulaDataSourceType.InputInvoice.getCode())) {
dataSourceDto.setDataSourceType(CellDataSourceType.InputInvoice.getCode());
} else if (a.getType().equals(FormulaDataSourceType.Voucher.getCode())) {
dataSourceDto.setDataSourceType(CellDataSourceType.Voucher.getCode());
} else { } else {
dataSourceDto.setDataSourceType(0); dataSourceDto.setDataSourceType(0);
} }
...@@ -519,7 +524,7 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi ...@@ -519,7 +524,7 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
if (report.isPresent()) { if (report.isPresent()) {
resultDto.setResult(true); resultDto.setResult(true);
ReportDto reportDto = new ReportDto(); ReportDto reportDto = new ReportDto();
CommonUtils.copyProperties(report,reportDto); CommonUtils.copyProperties(report, reportDto);
resultDto.setData(reportDto); resultDto.setData(reportDto);
} else { } else {
resultDto.setResult(false); resultDto.setResult(false);
...@@ -864,6 +869,41 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi ...@@ -864,6 +869,41 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
return operationResultDto; return operationResultDto;
} }
@Override
public OperationResultDto<String> getDataSourceDetailList(Long datasSourceId) {
OperationResultDto<String> operationResultDto = new OperationResultDto<>();
DataSource dataSource = dataSourceMapper.selectByPrimaryKey(datasSourceId);
String itemStrValue = StringUtils.EMPTY;
DataSourceDetailExample dataSourceDetailExample = new DataSourceDetailExample();
dataSourceDetailExample.createCriteria().andDataSourceIdEqualTo(datasSourceId).andDataSourceTypeEqualTo(CellDataSourceType.InputInvoice.getCode());
List<DataSourceDetail> dataSourceDetails = dataSourceDetailMapper.selectByExample(dataSourceDetailExample);
if (dataSource.getType().equals(CellDataSourceType.InputInvoice)) {
List<InputVATInvoiceItemExtendDto> inputVATInvoiceItemExtendDtos = new ArrayList<>();
for (DataSourceDetail dataSourceDetail : dataSourceDetails) {
if (StringUtils.isNotBlank(dataSourceDetail.getItemValue())) {
InputVATInvoiceItemExtendDto inputVATInvoiceItemExtendDto = inputVATInvoiceMapper.selectInvoiceExtendDto(dataSourceDetail.getItemValue());
inputVATInvoiceItemExtendDtos.add(inputVATInvoiceItemExtendDto);
}
}
itemStrValue = JSON.toJSONString(inputVATInvoiceItemExtendDtos);
} else if (dataSource.getType().equals(CellDataSourceType.Voucher)) {
List<Voucher> vouchers = new ArrayList<>();
for (DataSourceDetail dataSourceDetail : dataSourceDetails) {
if (StringUtils.isNotBlank(dataSourceDetail.getItemValue())) {
Voucher voucher = voucherMapper.selectByPrimaryKey(dataSourceDetail.getItemValue());
vouchers.add(voucher);
}
}
itemStrValue = JSON.toJSONString(vouchers);
} else {
itemStrValue = dataSourceDetails.size() > 0 ? dataSourceDetails.get(0).getItemValue() : StringUtils.EMPTY;
}
operationResultDto.setData(itemStrValue);
operationResultDto.setResult(true);
return operationResultDto;
}
private void updateCellValueForDataSourceChange(Long cellDataID, BigDecimal originalAmount, BigDecimal newAmount) { private void updateCellValueForDataSourceChange(Long cellDataID, BigDecimal originalAmount, BigDecimal newAmount) {
BigDecimal aValue = newAmount != null ? newAmount : new BigDecimal("0"); BigDecimal aValue = newAmount != null ? newAmount : new BigDecimal("0");
BigDecimal bValue = originalAmount != null ? originalAmount : new BigDecimal("0"); BigDecimal bValue = originalAmount != null ? originalAmount : new BigDecimal("0");
......
...@@ -678,4 +678,32 @@ ...@@ -678,4 +678,32 @@
JOIN InputVATInvoice ii JOIN InputVATInvoice ii
ON iii.InputVatInvoiceID = ii.ID ON iii.InputVatInvoiceID = ii.ID
</select> </select>
<resultMap id="inputVATInvoiceItemExtendDto" type="pwc.taxtech.atms.dto.vatdto.InputVATInvoiceItemExtendDto">
<id column="invoiceId" jdbcType="VARCHAR" property="invoiceId"/>
<result column="invoiceItemId" jdbcType="VARCHAR" property="invoiceItemId"/>
<result column="period" jdbcType="INTEGER" property="period"/>
<result column="certificationDate" jdbcType="TIMESTAMP" property="certificationDate"/>
<result column="sellerTaxNumber" jdbcType="VARCHAR" property="sellerTaxNumber"/>
<result column="invoiceCode" jdbcType="VARCHAR" property="invoiceCode"/>
<result column="invoiceNumber" jdbcType="VARCHAR" property="invoiceNumber"/>
<result column="amount" jdbcType="DECIMAL" property="amount"/>
<result column="invoiceType" jdbcType="INTEGER" property="invoiceType"/>
<result column="taxAmount" jdbcType="DECIMAL" property="taxAmount"/>
</resultMap>
<select id="selectInvoiceExtendDto" resultMap="inputVATInvoiceItemExtendDto">
SELECT b.ID AS invoiceId,
a.ID AS invoiceItemId,
a.PeriodID AS period,
b.CertificationDate AS certificationDate,
b.SellerTaxNumber AS sellerTaxNumber,
b.InvoiceCode AS invoiceCode,
b.InvoiceNumber AS invoiceNumber,
b.Amount AS amount,
b.InvoiceType AS invoiceType,
a.TaxAmount AS taxAmount
FROM InputVATInvoiceItem a
JOIN InputVATInvoice b
ON a.InputVATInvoiceID = b.ID
WHERE a.id = #{invoiceItemId,jdbcType=VARCHAR}
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -699,7 +699,7 @@ ...@@ -699,7 +699,7 @@
var getDataGridColumns = function () { var getDataGridColumns = function () {
var dataGridColumns; var dataGridColumns;
switch ($scope.detail.cellType) { switch ($scope.detail.cellType) {
case enums.cellDataSourceType.InputInvoice: case enums.formulaDataSourceType.InputInvoice:
//进项数据源 //进项数据源
dataGridColumns = [ dataGridColumns = [
{ {
...@@ -754,7 +754,7 @@ ...@@ -754,7 +754,7 @@
} }
]; ];
break; break;
case enums.cellDataSourceType.InputInvoiceDetail: case enums.formulaDataSourceType.InputInvoiceDetail:
//进项明细数据源 //进项明细数据源
dataGridColumns = [ dataGridColumns = [
{ {
...@@ -809,7 +809,7 @@ ...@@ -809,7 +809,7 @@
} }
]; ];
break; break;
case enums.cellDataSourceType.OutputInvoice: case enums.formulaDataSourceType.OutputInvoice:
//销项发票数据源 //销项发票数据源
dataGridColumns = [ dataGridColumns = [
{ {
...@@ -870,7 +870,7 @@ ...@@ -870,7 +870,7 @@
} }
]; ];
break; break;
case enums.cellDataSourceType.Voucher: case enums.formulaDataSourceType.Voucher:
//凭证数据源 //凭证数据源
dataGridColumns = [ dataGridColumns = [
{ {
...@@ -919,7 +919,7 @@ ...@@ -919,7 +919,7 @@
} }
]; ];
break; break;
case enums.cellDataSourceType.VoucherFilter: case enums.formulaDataSourceType.VoucherFilter:
//凭证筛选 //凭证筛选
dataGridColumns = [ dataGridColumns = [
{ {
...@@ -1010,7 +1010,7 @@ ...@@ -1010,7 +1010,7 @@
} }
]; ];
break; break;
case enums.cellDataSourceType.Report: case enums.formulaDataSourceType.Report:
//报表数据源 //报表数据源
dataGridColumns = [ dataGridColumns = [
{ {
...@@ -1048,7 +1048,7 @@ ...@@ -1048,7 +1048,7 @@
} }
]; ];
break; break;
case enums.cellDataSourceType.BSPL: case enums.formulaDataSourceType.BSPL:
//BSPL数据源 //BSPL数据源
dataGridColumns = [ dataGridColumns = [
{ {
......
...@@ -136,16 +136,15 @@ ...@@ -136,16 +136,15 @@
switch (sourceData.type) { switch (sourceData.type) {
//进项数据源 //进项数据源
case enums.formulaDataSourceType.InputInvoice: case enums.formulaDataSourceType.InputInvoice:
obj.period = sourceData.period; obj.period = item.period;
obj.date = sourceData.certificationDate ? (new Date(sourceData.certificationDate)).dateTimeToString('yyyyMMdd') : ""; obj.date = item.certificationDate ? (new Date(item.certificationDate)).dateTimeToString('yyyyMMdd') : "";
obj.saleId = sourceData.sellerTaxNumber; obj.saleId = item.sellerTaxNumber;
obj.invoiceCode = sourceData.invoiceCode; obj.invoiceCode = item.invoiceCode;
obj.invoiceNumber = sourceData.invoiceNumber; obj.invoiceNumber = item.invoiceNumber;
obj.money = sourceData.amount; obj.money = item.amount;
obj.invoiceType = getInvoiceTypeName(sourceData.invoiceType); obj.invoiceType = getInvoiceTypeName(item.invoiceType);
obj.taxMoney = sourceData.taxAmount; obj.taxMoney = item.taxAmount;
break; break;
//进项明细数据源 //进项明细数据源
case enums.formulaDataSourceType.InputInvoiceDetail: case enums.formulaDataSourceType.InputInvoiceDetail:
obj.period = sourceData.period; obj.period = sourceData.period;
...@@ -274,7 +273,7 @@ ...@@ -274,7 +273,7 @@
obj.amount = sourceData.amount; obj.amount = sourceData.amount;
} }
return obj; return;
} }
//解析发票筛选数据 //解析发票筛选数据
...@@ -445,6 +444,12 @@ ...@@ -445,6 +444,12 @@
if (sheets && sheets.length > 0) { if (sheets && sheets.length > 0) {
//todo: change to sheets[0] here later //todo: change to sheets[0] here later
var tagInfo = sheets[1].getTag(row, column); var tagInfo = sheets[1].getTag(row, column);
if (constant.regesterInformation.active) {
tagInfo = sheets[0].getTag(row, column);
}
else {
tagInfo = sheets[1].getTag(row, column);
}
if (tagInfo) { if (tagInfo) {
var jsonTagInfo = JSON.parse(tagInfo); var jsonTagInfo = JSON.parse(tagInfo);
if (jsonTagInfo.isReadOnly) if (jsonTagInfo.isReadOnly)
...@@ -604,6 +609,61 @@ ...@@ -604,6 +609,61 @@
$scope.taxCellDetail.dataSourceCount++; $scope.taxCellDetail.dataSourceCount++;
} else { } else {
var flag = true; var flag = true;
//todo: according to element to get the detail data
vatReportService.getDataSourceDetailList(sourceData.id).success(function (result) {
if (result && result.data) {
var jsonData = JSON.parse(result.data);
angular.forEach(jsonData, function (item) {
var model = getDataSourceModel(item);
//SAP日报数据源和未开票数据源需要设置需要显示的款项列
if ((enums.formulaDataSourceType.Unbilled === element.type
|| enums.formulaDataSourceType.SapDaily === element.type)
&& !$scope.taxCellDetail.visibleMoneys) {
$scope.taxCellDetail.visibleMoneys = element.visibleMoneys;
}
if (element.type == enums.formulaDataSourceType.Report) {
if (element.reportTemplateID != $scope.templateId || element.period != $scope.period) {
$scope.taxCellDetail.showFormulaSummary = false;
}
}
else if (element.type == enums.formulaDataSourceType.BSPL
|| element.type == enums.formulaDataSourceType.Judgment) {
$scope.taxCellDetail.showFormulaSummary = false;
}
model.description = element.description;
$($scope.taxCellDetail.items).each(function (itemIndex, item) {
if (item.type === element.type && item.name === element.name) {
item.dataSource.push(model);
flag = false;
return;
}
});
if (flag && element.type && element.type > 0) {
$scope.taxCellDetail.items.push({
type: element.type,
operationType: element.operationType,
createTime: element.createTime,
name: element.name,
id: element.id,
dataSource: [model]
});
if ($scope.taxCellDetail.cellType === 0) {
$scope.taxCellDetail.cellType = element.type;
$scope.taxCellDetail.cellTypeId = undefined;
}
$scope.taxCellDetail.dataSourceCount++;
}
});
}
});
var model = getDataSourceModel(element); var model = getDataSourceModel(element);
//SAP日报数据源和未开票数据源需要设置需要显示的款项列 //SAP日报数据源和未开票数据源需要设置需要显示的款项列
......
...@@ -175,6 +175,9 @@ ...@@ -175,6 +175,9 @@
} }
return $http.get('/Report/report/' + templateId + '/' + period, apiConfig.createVat()); return $http.get('/Report/report/' + templateId + '/' + period, apiConfig.createVat());
},
getDataSourceDetailList:function(dataSourceId){
return $http.get('/Report/getDataSourceDetailList/'+dataSourceId,apiConfig.createVat());
} }
}; };
......
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