Commit 45e9dc37 authored by eddie.woo's avatar eddie.woo

Merge branch 'dev_oracle' of http://code.tech.tax.asia.pwcinternal.com/root/atms into dev_oracle

parents f1eeb082 63488479
......@@ -29,6 +29,9 @@ public class CellDataDto {
private Boolean isCalculated;
private String cellValue;
private String keyinData;
@JsonProperty("cellTemplateID")
private String cellTemplateId;
@JsonProperty("reportTemplateID")
......
......@@ -25,6 +25,7 @@ public class DataSourceDto {
// 1: Formula, 2: Voucher, 3: OutputInvoice, 4: InputInvoice, 5: CustomInvoice, 6: KeyIn, 7: RelatedModel, 8: SapDaily
Integer dataSourceType;
private String keyinData;
private BigDecimal amount;
String description;
......
......@@ -13,6 +13,7 @@ public class ManualDataSourceDto {
String name;
String description;
BigDecimal amount;
String keyinData;
String projectId;
String serviceTypeId;
Integer period;
......
......@@ -212,7 +212,7 @@ public class ReportGeneratorImpl {
if (StringUtils.isBlank(resultFormula)) {
resultFormula = null;
resultFormula = " ";
}
cellData.setFormulaExp(resultFormula);
cellData.setCreateBy("Admin");
......
......@@ -625,6 +625,7 @@ public class ReportServiceImpl {
DataSourceDto dataSourceDto = new DataSourceDto();
dataSourceDto.setId(a.getId().toString());
dataSourceDto.setAmount(a.getAmount());
dataSourceDto.setKeyinData(a.getKeyinData());
dataSourceDto.setName(a.getName());
dataSourceDto.setOperationType(a.getOperationType());
dataSourceDto.setDescription(a.getDescription());
......@@ -685,6 +686,7 @@ public class ReportServiceImpl {
celldata.ifPresent(cellData -> cellDataDto.setCellId(cellData.getId().toString()));
cellDataDto.setFormula(a.getFormula());
celldata.ifPresent(cellData -> cellDataDto.setCellValue(cellData.getData()));
celldata.ifPresent(cellData -> cellDataDto.setKeyinData(cellData.getKeyinData()));
celldata.ifPresent(cellData -> cellDataDto.setFormulaExp(cellData.getFormulaExp()));
cellDataDto.setCellTemplateConfig(CellConfigTranslater.getConfigDto(a));
List<DataSourceDtoExtend> entryList = datasource.stream()
......@@ -873,10 +875,6 @@ public class ReportServiceImpl {
public OperationResultDto addCellManualDataSource(ManualDataSourceDto data, String projectId) {
OperationResultDto operationResultDto = new OperationResultDto();
String status = periodApprovalMapper.getStatusByProjectIdAndPeriod(projectId, data.getPeriod());
MyAsserts.assertTrue(status == null || status.equals(Constant.APPROVAL_DISAGREED), Exceptions.REPORT_IN_PROCESS_OR_AGREED_EXCEPTION);
try {
if (data.getCellId() == null) {
//todo: insert celldata for manual datasource
......@@ -884,8 +882,9 @@ public class ReportServiceImpl {
cellData.setId(distributedIdService.nextId());
cellData.setReportId(data.getReportId());
cellData.setCellTemplateId(Long.parseLong(data.getCellTemplateId()));
cellData.setData(data.getAmount().toString());
cellData.setFormulaExp(data.getAmount().toString());
cellData.setData(data.getAmount() == null ? null : data.getAmount().toString());
cellData.setKeyinData(data.getKeyinData());
cellData.setFormulaExp(data.getAmount() == null ? "0.0" : data.getAmount().toString());
cellData.setCreateBy("admin");
cellData.setCreateTime(new Date());
cellData.setUpdateBy("admin");
......@@ -896,12 +895,18 @@ public class ReportServiceImpl {
data.setCellId(cellData.getId());
} else {
PeriodCellData cellData = periodCellDataMapper.selectByPrimaryKey(data.getCellId());
if (cellData.getData() != data.getAmount().toString()) {
if(StringUtils.isNotBlank(data.getKeyinData())){
cellData.setKeyinData(data.getKeyinData());
if (StringUtils.isEmpty(cellData.getFormulaExp()))
cellData.setFormulaExp(data.getKeyinData());
periodCellDataMapper.updateByPrimaryKeySelective(cellData);
}else if (data.getAmount() != null && cellData.getData() != data.getAmount().toString()) {
cellData.setData(data.getAmount().toString());
if (StringUtils.isEmpty(cellData.getFormulaExp()))
cellData.setFormulaExp(data.getAmount().toString());
periodCellDataMapper.updateByPrimaryKeySelective(cellData);
}
}
List<DataSourceExtendDto> dataSourceExtendDtos = periodDataSourceMapper.getManualDataSource(data.getCellId());
......@@ -916,12 +921,14 @@ public class ReportServiceImpl {
PeriodDataSource dataSourceModel = null;
if (dataSourceExtendDtos.size() > 0) {
dataSourceModel = dataSourceExtendDtos.get(0).getDataSource();
updateCellValueForDataSourceChange(dataSourceModel, data.getAmount());
if(StringUtils.isBlank(data.getKeyinData()))
updateCellValueForDataSourceChange(dataSourceModel, data.getAmount());
originalAmount = dataSourceModel.getAmount() != null ? dataSourceModel.getAmount() : new BigDecimal("0");
dataSourceModel.setName(data.getName());
dataSourceModel.setDescription(data.getDescription());
dataSourceModel.setAmount(data.getAmount());
dataSourceModel.setUpdateBy("Admin");
dataSourceModel.setKeyinData(data.getKeyinData());
dataSourceModel.setUpdateTime(new Date());
periodDataSourceMapper.updateByPrimaryKeySelective(dataSourceModel);
} else {
......@@ -940,6 +947,7 @@ public class ReportServiceImpl {
dataSourceModel.setCreateTime(new Date());
dataSourceModel.setUpdateTime(new Date());
dataSourceModel.setCreateBy("admin");
dataSourceModel.setKeyinData(data.getKeyinData());
dataSourceModel.setUpdateBy("admin");
dataSourceModel.setProjectId(projectId);
dataSourceModel.setPeriod(data.getPeriod());
......@@ -988,7 +996,7 @@ public class ReportServiceImpl {
for (PeriodCellDataSource cellDataSource : cellDataSourceList) {
Long dataSourceId = cellDataSource.getDataSourceId();
PeriodDataSource dataSource = periodDataSourceMapper.selectByPrimaryKey(dataSourceId);
if (dataSource.getDescription().equals(cellName)) {
if (dataSource.getDescription().equals(cellName) && StringUtils.isBlank(data.getKeyinData())) {
BigDecimal changeValue = data.getAmount().subtract(dataSource.getAmount());
dataSource.setAmount(data.getAmount());
dataSource.setUpdateBy("admin");
......@@ -1003,6 +1011,11 @@ public class ReportServiceImpl {
//cellData.setFormulaExp(cellData.getData());
cellData.setUpdateTime(new Date());
periodCellDataMapper.updateByPrimaryKeySelective(cellData);
} else if(dataSource.getDescription().equals(cellName) && StringUtils.isNotBlank(data.getKeyinData())){
dataSource.setKeyinData(data.getKeyinData());
dataSource.setUpdateBy("admin");
dataSource.setUpdateTime(new Date());
periodDataSourceMapper.updateByPrimaryKeySelective(dataSource);
}
}
}
......@@ -1125,7 +1138,8 @@ public class ReportServiceImpl {
operationResultDto.setResult(false);
return operationResultDto;
}
updateCellValueForDataSourceChange(datasourceEntity, dataSource.getAmount());
if(StringUtils.isEmpty(datasourceEntity.getKeyinData()))
updateCellValueForDataSourceChange(datasourceEntity, dataSource.getAmount());
periodDataSourceMapper.updateByPrimaryKeySelective(datasourceEntity);
//todo:MarkProjectModelDirty(dataSource.projectId, dataSource.serviceTypeId, dataSource.Updater);
......@@ -1193,7 +1207,7 @@ public class ReportServiceImpl {
PeriodCellData cellData = periodCellDataMapper.selectByPrimaryKey(cellDataId);
BigDecimal cellVal = new BigDecimal("0");
try {
if (cellData != null) {
if (cellData != null && StringUtils.isEmpty(cellData.getKeyinData())) {
cellVal = new BigDecimal(cellData.getData());
Integer cellDataType = periodCellTemplateMapper
.getDataType(cellData.getCellTemplateId()
......
......@@ -319,4 +319,6 @@ public abstract class CommonIT {
MenuExample example = new MenuExample();
menuMapper.deleteByExample(example);
}
}
\ No newline at end of file
......@@ -110,6 +110,8 @@ public class PeriodCellData implements Serializable {
*/
private Integer period;
private String keyinData;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table TAX_ADMIN.PERIOD_CELL_DATA
......@@ -118,6 +120,14 @@ public class PeriodCellData implements Serializable {
*/
private static final long serialVersionUID = 1L;
public String getKeyinData() {
return keyinData;
}
public void setKeyinData(String keyinData) {
this.keyinData = keyinData;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column TAX_ADMIN.PERIOD_CELL_DATA.ID
......
......@@ -174,6 +174,8 @@ public class PeriodDataSource implements Serializable {
*/
private String projectId;
private String keyinData;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table TAX_ADMIN.PERIOD_DATA_SOURCE
......@@ -182,6 +184,14 @@ public class PeriodDataSource implements Serializable {
*/
private static final long serialVersionUID = 1L;
public String getKeyinData() {
return keyinData;
}
public void setKeyinData(String keyinData) {
this.keyinData = keyinData;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column TAX_ADMIN.PERIOD_DATA_SOURCE.ID
......
......@@ -10,6 +10,7 @@
<result column="REPORT_ID" jdbcType="DECIMAL" property="reportId" />
<result column="CELL_TEMPLATE_ID" jdbcType="DECIMAL" property="cellTemplateId" />
<result column="DATA" jdbcType="VARCHAR" property="data" />
<result column="KEYIN_DATA" jdbcType="VARCHAR" property="keyinData" />
<result column="FORMULA_EXP" jdbcType="VARCHAR" property="formulaExp" />
<result column="CREATE_BY" jdbcType="VARCHAR" property="createBy" />
<result column="CREATE_TIME" jdbcType="TIMESTAMP" property="createTime" />
......@@ -89,7 +90,7 @@
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
ID, REPORT_ID, CELL_TEMPLATE_ID, "DATA", FORMULA_EXP, CREATE_BY, CREATE_TIME, UPDATE_BY,
ID, REPORT_ID, CELL_TEMPLATE_ID, "DATA", FORMULA_EXP, CREATE_BY, CREATE_TIME, UPDATE_BY, KEYIN_DATA,
UPDATE_TIME, PROJECT_ID, PERIOD
</sql>
<select id="selectByExample" parameterType="pwc.taxtech.atms.vat.entity.PeriodCellDataExample" resultMap="BaseResultMap">
......@@ -144,11 +145,11 @@
This element is automatically generated by MyBatis Generator, do not modify.
-->
insert into PERIOD_CELL_DATA (ID, REPORT_ID, CELL_TEMPLATE_ID,
"DATA", FORMULA_EXP, CREATE_BY,
"DATA", KEYIN_DATA, FORMULA_EXP, CREATE_BY,
CREATE_TIME, UPDATE_BY, UPDATE_TIME,
PROJECT_ID, PERIOD)
values (#{id,jdbcType=DECIMAL}, #{reportId,jdbcType=DECIMAL}, #{cellTemplateId,jdbcType=DECIMAL},
#{data,jdbcType=VARCHAR}, #{formulaExp,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR},
#{data,jdbcType=VARCHAR}, #{keyinData,jdbcType=VARCHAR}, #{formulaExp,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
#{projectId,jdbcType=VARCHAR}, #{period,jdbcType=DECIMAL})
</insert>
......@@ -171,6 +172,9 @@
<if test="data != null">
"DATA",
</if>
<if test="keyinData != null">
KEYIN_DATA,
</if>
<if test="formulaExp != null">
FORMULA_EXP,
</if>
......@@ -206,6 +210,9 @@
<if test="data != null">
#{data,jdbcType=VARCHAR},
</if>
<if test="keyinData != null">
#{keyinData,jdbcType=VARCHAR},
</if>
<if test="formulaExp != null">
#{formulaExp,jdbcType=VARCHAR},
</if>
......@@ -256,7 +263,10 @@
CELL_TEMPLATE_ID = #{record.cellTemplateId,jdbcType=DECIMAL},
</if>
<if test="record.data != null">
"DATA" = #{record.data,jdbcType=VARCHAR},
"DATA" = #{record.data,jdbcType=VARCHAR},
</if>
<if test="record.keyinData != null">
KEYIN_DATA = #{record.keyinData,jdbcType=VARCHAR},
</if>
<if test="record.formulaExp != null">
FORMULA_EXP = #{record.formulaExp,jdbcType=VARCHAR},
......@@ -294,6 +304,7 @@
REPORT_ID = #{record.reportId,jdbcType=DECIMAL},
CELL_TEMPLATE_ID = #{record.cellTemplateId,jdbcType=DECIMAL},
"DATA" = #{record.data,jdbcType=VARCHAR},
KEYIN_DATA = #{record.keyinData,jdbcType=VARCHAR},
FORMULA_EXP = #{record.formulaExp,jdbcType=VARCHAR},
CREATE_BY = #{record.createBy,jdbcType=VARCHAR},
CREATE_TIME = #{record.createTime,jdbcType=TIMESTAMP},
......@@ -321,6 +332,9 @@
<if test="data != null">
"DATA" = #{data,jdbcType=VARCHAR},
</if>
<if test="keyinData != null">
KEYIN_DATA = #{keyinData,jdbcType=VARCHAR},
</if>
<if test="formulaExp != null">
FORMULA_EXP = #{formulaExp,jdbcType=VARCHAR},
</if>
......@@ -354,6 +368,7 @@
set REPORT_ID = #{reportId,jdbcType=DECIMAL},
CELL_TEMPLATE_ID = #{cellTemplateId,jdbcType=DECIMAL},
"DATA" = #{data,jdbcType=VARCHAR},
KEYIN_DATA = #{keinData,jdbcType=VARCHAR},
FORMULA_EXP = #{formulaExp,jdbcType=VARCHAR},
CREATE_BY = #{createBy,jdbcType=VARCHAR},
CREATE_TIME = #{createTime,jdbcType=TIMESTAMP},
......
......@@ -10,6 +10,7 @@
<result column="TYPE" jdbcType="DECIMAL" property="type" />
<result column="NAME" jdbcType="VARCHAR" property="name" />
<result column="AMOUNT" jdbcType="DECIMAL" property="amount" />
<result column="KEYIN_DATA" jdbcType="VARCHAR" property="keyinData" />
<result column="DESCRIPTION" jdbcType="VARCHAR" property="description" />
<result column="KEY_VALUE_DATA_ID" jdbcType="VARCHAR" property="keyValueDataId" />
<result column="CREATE_BY" jdbcType="VARCHAR" property="createBy" />
......@@ -96,7 +97,7 @@
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
ID, "TYPE", "NAME", AMOUNT, DESCRIPTION, KEY_VALUE_DATA_ID, CREATE_BY, CREATE_TIME,
ID, "TYPE", "NAME", AMOUNT, KEYIN_DATA, DESCRIPTION, KEY_VALUE_DATA_ID, CREATE_BY, CREATE_TIME,
UPDATE_BY, UPDATE_TIME, ROW_NAME, "COLUMN_NAME", ROW_INDEX, REMAP_BATCH_ID, COLUMN_INDEX,
CELL_TEMPLATE_ID, PERIOD, PROJECT_ID
</sql>
......@@ -152,14 +153,14 @@
This element is automatically generated by MyBatis Generator, do not modify.
-->
insert into PERIOD_DATA_SOURCE (ID, "TYPE", "NAME",
AMOUNT, DESCRIPTION, KEY_VALUE_DATA_ID,
AMOUNT, KEYIN_DATA, DESCRIPTION, KEY_VALUE_DATA_ID,
CREATE_BY, CREATE_TIME, UPDATE_BY,
UPDATE_TIME, ROW_NAME, "COLUMN_NAME",
ROW_INDEX, REMAP_BATCH_ID, COLUMN_INDEX,
CELL_TEMPLATE_ID, PERIOD, PROJECT_ID
)
values (#{id,jdbcType=DECIMAL}, #{type,jdbcType=DECIMAL}, #{name,jdbcType=VARCHAR},
#{amount,jdbcType=DECIMAL}, #{description,jdbcType=VARCHAR}, #{keyValueDataId,jdbcType=VARCHAR},
#{amount,jdbcType=DECIMAL}, #{keyinData,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{keyValueDataId,jdbcType=VARCHAR},
#{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR},
#{updateTime,jdbcType=TIMESTAMP}, #{rowName,jdbcType=VARCHAR}, #{columnName,jdbcType=VARCHAR},
#{rowIndex,jdbcType=DECIMAL}, #{remapBatchId,jdbcType=VARCHAR}, #{columnIndex,jdbcType=DECIMAL},
......@@ -185,6 +186,9 @@
<if test="amount != null">
AMOUNT,
</if>
<if test="keyinData != null">
KEYIN_DATA,
</if>
<if test="description != null">
DESCRIPTION,
</if>
......@@ -241,6 +245,9 @@
<if test="amount != null">
#{amount,jdbcType=DECIMAL},
</if>
<if test="keyinData != null">
#{keyinData,jdbcType=DECIMAL},
</if>
<if test="description != null">
#{description,jdbcType=VARCHAR},
</if>
......@@ -314,6 +321,9 @@
<if test="record.amount != null">
AMOUNT = #{record.amount,jdbcType=DECIMAL},
</if>
<if test="record.keyinData != null">
KEYIN_DATA = #{record.keyinData,jdbcType=DECIMAL},
</if>
<if test="record.description != null">
DESCRIPTION = #{record.description,jdbcType=VARCHAR},
</if>
......@@ -371,6 +381,7 @@
"TYPE" = #{record.type,jdbcType=DECIMAL},
"NAME" = #{record.name,jdbcType=VARCHAR},
AMOUNT = #{record.amount,jdbcType=DECIMAL},
KEYIN_DATA = #{record.keyinData,jdbcType=VARCHAR},
DESCRIPTION = #{record.description,jdbcType=VARCHAR},
KEY_VALUE_DATA_ID = #{record.keyValueDataId,jdbcType=VARCHAR},
CREATE_BY = #{record.createBy,jdbcType=VARCHAR},
......@@ -405,6 +416,9 @@
<if test="amount != null">
AMOUNT = #{amount,jdbcType=DECIMAL},
</if>
<if test="keyinData != null">
KEYIN_DATA = #{keyinData,jdbcType=DECIMAL},
</if>
<if test="description != null">
DESCRIPTION = #{description,jdbcType=VARCHAR},
</if>
......@@ -459,6 +473,7 @@
set "TYPE" = #{type,jdbcType=DECIMAL},
"NAME" = #{name,jdbcType=VARCHAR},
AMOUNT = #{amount,jdbcType=DECIMAL},
KEYIN_DATA = #{keyinData,jdbcType=VARCHAR},
DESCRIPTION = #{description,jdbcType=VARCHAR},
KEY_VALUE_DATA_ID = #{keyValueDataId,jdbcType=VARCHAR},
CREATE_BY = #{createBy,jdbcType=VARCHAR},
......
......@@ -10,6 +10,7 @@
#{item.reportId,jdbcType=DECIMAL},
#{item.cellTemplateId,jdbcType=DECIMAL},
#{item.data,jdbcType=VARCHAR},
#{item.keyinData,jdbcType=VARCHAR},
#{item.formulaExp,jdbcType=VARCHAR},
#{item.createBy,jdbcType=VARCHAR},
#{item.createTime,jdbcType=TIMESTAMP},
......@@ -31,6 +32,7 @@
REPORT_ID,
CELL_TEMPLATE_ID,
"DATA",
KEYIN_DATA,
FORMULA_EXP,
CREATE_TIME,
UPDATE_TIME,
......@@ -59,6 +61,9 @@
<when test="item.data != null">#{item.data,jdbcType=VARCHAR},</when>
<otherwise>' ',</otherwise>
</choose>
<choose>
<when test="item.keyinData != null">#{item.keyinData,jdbcType=VARCHAR},</when>
</choose>
<choose>
<when test="item.formulaExp != null">#{item.formulaExp,jdbcType=VARCHAR},</when>
<otherwise>' ',</otherwise>
......
......@@ -229,6 +229,7 @@
<result column="TYPE" jdbcType="INTEGER" property="type"/>
<result column="NAME" jdbcType="VARCHAR" property="name"/>
<result column="AMOUNT" jdbcType="DECIMAL" property="amount"/>
<result column="KEYIN_DATA" jdbcType="VARCHAR" property="keyinData"/>
<result column="DESCRIPTION" jdbcType="VARCHAR" property="description"/>
<result column="KEY_VALUE_DATA_ID" jdbcType="VARCHAR" property="keyValueDataId"/>
<result column="CREATE_BY" jdbcType="VARCHAR" property="createBy"/>
......@@ -282,6 +283,7 @@
DS.TYPE,
DS.NAME,
DS.AMOUNT,
DS.KEYIN_DATA,
DS.DESCRIPTION,
DS.KEY_VALUE_DATA_ID,
DS.CREATE_BY,
......@@ -311,6 +313,7 @@
<association property="cellData" javaType="pwc.taxtech.atms.vat.entity.CellData">
<id column="CELL_DATA_ID" jdbcType="BIGINT" property="id"/>
<result column="CELL_DATA_DATA" property="data" javaType="java.lang.String" jdbcType="VARCHAR"/>
<result column="CELL_DATA_DATA" property="data" javaType="java.lang.String" jdbcType="VARCHAR"/>
<result column="CELL_DATA_TEMPLATE_ID" property="cellTemplateId" javaType="java.lang.Long" jdbcType="BIGINT"/>
<result column="CELL_DATA_REPORT_ID" property="reportId" javaType="java.lang.Long" jdbcType="BIGINT"/>
</association>
......@@ -375,6 +378,11 @@
0,
</otherwise>
</choose>
<choose>
<when test="item.keyinData != null">
#{item.keyinData,jdbcType=VARCHAR},
</when>
</choose>
<choose>
<when test="item.description != null">
#{item.description,jdbcType=VARCHAR},
......
......@@ -174,15 +174,12 @@
};
function doConfirmEventHandler() {
swal.close();
var r = /^00\d*|^\.\d+|\.$/;
if ($scope.detail.inputValue && (isNaN($scope.detail.inputValue) || r.test($scope.detail.inputValue))) {
SweetAlert.warning($translate.instant('CheckInputValueFormat'));
return;
} else if ($scope.detail.inputValue && parseFloat($scope.detail.inputValue).toFixed(2) > 9999999999999) {
SweetAlert.warning($translate.instant('CheckInputValueLength'));
return;
}
// if ($scope.detail.inputValue && parseFloat($scope.detail.inputValue).toFixed(2) > 9999999999999) {
// SweetAlert.warning($translate.instant('CheckInputValueLength'));
// return;
// }
if ($scope.detail.dataType === 5) {
r = /^(-[1-9]\d*|[1-9]\d*|[0]{1,1})$/;
if (!r.test($scope.detail.inputValue)) {
......@@ -200,9 +197,18 @@
if (!$scope.detail.inputValue) {
$scope.detail.inputValue = "0";
}
$scope.detail.inputValue = $scope.detail.dataType === 5 ?
parseInt($scope.detail.inputValue) :
parseFloat($scope.detail.inputValue).toFixed(2);
if ($scope.detail.inputValue && ((isNaN($scope.detail.inputValue) || r.test($scope.detail.inputValue))
||parseFloat($scope.detail.inputValue).toFixed(2) > 9999999999999)){
// $scope.detail.inputValue;
$scope.detail.keyinData = $scope.detail.inputValue;
} else {
$scope.detail.inputValue = $scope.detail.dataType === 5 ?
parseInt($scope.detail.inputValue) :
parseFloat($scope.detail.inputValue).toFixed(2);
}
$scope.onConfirm();
......@@ -242,9 +248,10 @@
if(isConfirm){
var message;
var r = /^00\d*|^\.\d+|\.$/;
if ($scope.detail.inputValue && (isNaN($scope.detail.inputValue) || r.test($scope.detail.inputValue))) {
message = $translate.instant('CheckInputValueFormat');
} else if ($scope.detail.inputValue && parseFloat($scope.detail.inputValue).toFixed(2) > 9999999999999) {
// if ($scope.detail.inputValue && (isNaN($scope.detail.inputValue) || r.test($scope.detail.inputValue))) {
// message = $translate.instant('CheckInputValueFormat');
// } else
if ($scope.detail.inputValue && parseFloat($scope.detail.inputValue).toFixed(2) > 9999999999999) {
message = $translate.instant('CheckInputValueLength');
} else if ($scope.detail.dataType === 5) {
r = /^(-[1-9]\d*|[1-9]\d*|[0]{1,1})$/;
......@@ -1223,7 +1230,7 @@
dataGridColumns = [
{
dataField: 'period',
caption: $translate.instant('InvoiceQJ'),
caption: $translate.instant ('InvoiceQJ'),
alignment: 'center',
width: '10%',
visible: vatSessionService.citFlag ? false : true
......
......@@ -122,7 +122,8 @@
<div class="hand-input-container" ng-if="detail.cellType === 19">
<div class="hand-input-line">
<span>{{'HandInputValue' | translate}}:</span>
<span>{{detail.dataGridSource[0].money}}</span>
<span ng-if="!detail.keyinData">{{detail.dataGridSource[0].money}}</span>
<span ng-if="detail.keyinData">{{detail.dataGridSource[0].keyinData}}</span>
</div>
<div class="hand-input-line">
<span>{{'Memo' | translate}}:</span>
......@@ -134,7 +135,8 @@
<div class="hand-input-container" ng-show="selectedDataSourceTabIndex == 2 || (detail.dataSourceCount == 1 && detail.hasKeyIn)">
<div class="hand-input-line">
<span>{{'HandInputValue' | translate}}:</span>
<span><input id="hand-input-value" name="hand-input-value" ng-model="detail.inputValue" type="text" class="hand-input-value" /></span>
<span><input id="hand-input-value" ng-if="!detail.keyinData" name="hand-input-value" ng-model="detail.inputValue" type="text" class="hand-input-value" /></span>
<span><input id="hand-input-value" ng-if="detail.keyinData" name="hand-input-value" ng-model="detail.keyinData" type="text" class="hand-input-value" /></span>
</div>
<div class="hand-input-line">
<span>{{'Memo' | translate}}:</span>
......
......@@ -512,7 +512,11 @@
// 设置顺序: 非数值字符串 -> 单元格值覆盖修改 -> 公式或手工数据源 -> 数值
var ifShowParseFloat = true; // 用于标识单元格是否设置成数值
if (_.isString(data.value) && data.value.length > 0 && isNaN(Number(data.value))) {
if(_.isString(data.keyinData) && data.keyinData.length > 0 && isNaN(Number(data.keyinData))){
sheet.setValue(data.rowIndex, data.columnIndex, data.keyinData);
ifShowParseFloat = false; // 非数值字符串,单元格设置为字符串
}
else if (_.isString(data.value) && data.value.length > 0 && isNaN(Number(data.value))) {
sheet.setValue(data.rowIndex, data.columnIndex, data.value);
ifShowParseFloat = false; // 非数值字符串,单元格设置为字符串
}
......
......@@ -569,6 +569,7 @@
if (jsonTagInfo.cellTemplateConfig.hasKeyIn) {
$scope.taxCellDetail.inputValue = element.amount;
$scope.taxCellDetail.inputMemo = element.name;
$scope.taxCellDetail.keyinData = element.keyinData;
}
} else if (element.dataSourceType === enums.cellDataSourceType.ModelDatasource) {
var modelItem = {
......@@ -987,6 +988,7 @@
$q.all(promiss).then(function () {
//重新排序报表
$('#busy-indicator-container').show();
exportReportData = _.sortBy(exportReportData, function (item) {
return item.orderIndex;
});
......@@ -1020,6 +1022,7 @@
function exportSpread(exportReportData) {
$scope.exportReportData = exportReportData;
$timeout(function () {
$('#busy-indicator-container').show();
var mainSpread = new GC.Spread.Sheets.Workbook(document.getElementById("export"), {sheetCount: 1});
mainSpread.isPaintSuspended(true);
mainSpread.sheets.pop();
......@@ -1037,12 +1040,15 @@
mainSpread.sheets.push(currentSheet);
}
var excelIo = new GC.Spread.Excel.IO();
// here is excel IO API
excelIo.save(mainSpread.toJSON(), function (blob) {
saveAs(blob, vatSessionService.project.name+'-'+vatSessionService.month+'-纳税申报.xlsx');
$('#busy-indicator-container').hide();
}, function (e) {
alert(e);
$('#busy-indicator-container').hide();
});
// vatExportService.exportReport(content).success(function (data) {
......@@ -1162,10 +1168,19 @@
for (var i = 0; i < $scope.reportData.length; i++) {
var reportD = $scope.reportData[i];
if(manualData.keyinData && reportD.rowIndex === cellData.rowIndex
&& reportD.columnIndex === cellData.columnIndex){
reportD.keyinData = manualData.keyinData;
}
for (var j = 0; j < reportD.dataSourceList.length; j++) {
if (reportD.dataSourceList[j].rowIndex === cellData.rowIndex
&& reportD.dataSourceList[j].columnIndex === cellData.columnIndex) {
reportD.dataSourceList[j].amount = manualData.amount;
if(manualData.keyinData){
reportD.keyinData = manualData.keyinData;
reportD.dataSourceList[j].keyinData = manualData.keyinData;
} else {
reportD.dataSourceList[j].amount = manualData.amount;
}
}
}
}
......@@ -1196,6 +1211,7 @@
if (manualDs) {
manualDs.amount = manualData.amount;
manualDs.name = manualData.name;
manualDs.keyinData = manualData.keyinData;
manualDs.description = manualData.description;
}
else {
......@@ -1254,6 +1270,7 @@
if (manualDataSource) {
manualDataSource.item2.amount = manualData.amount;
manualDataSource.item2.keyinData = manualData.keyinData;
manualDataSource.item2.name = manualData.name;
manualDataSource.item2.description = manualData.description;
}
......@@ -1488,35 +1505,49 @@
//单元格详细信息点击确定时执行
$scope.confirm = function () {
$scope.handInputModel.name = $scope.taxCellDetail.inputMemo;
$scope.handInputModel.amount = $scope.taxCellDetail.inputValue;
$scope.handInputModel.description = $scope.taxCellDetail.inputMemo;
$scope.handInputModel.projectID = vatSessionService.project.id;
$scope.handInputModel.serviceTypeID = vatSessionService.project.serviceTypeID;
$scope.handInputModel.period = vatSessionService.month;
if ($scope.handInputModel.amount || $scope.handInputModel.name) {
if(vatSessionService.month)
vatSessionService.project.period=vatSessionService.month;
vatApproveService.approvalStatus(vatSessionService.project.id,vatSessionService.project.period).success(function(result){
if(result&&result=='committed'){
SweetAlert.error('报表提审中!');
}else{
$scope.handInputModel.name = $scope.taxCellDetail.inputMemo;
var r = /^(-[1-9]\d*|[1-9]\d*|[0]{1,1})$/;
if ($scope.taxCellDetail.keyinData) {
$scope.handInputModel.keyinData = $scope.taxCellDetail.keyinData;
}else {
$scope.handInputModel.amount = $scope.taxCellDetail.inputValue;
}
$scope.handInputModel.description = $scope.taxCellDetail.inputMemo;
$scope.handInputModel.projectID = vatSessionService.project.id;
$scope.handInputModel.serviceTypeID = vatSessionService.project.serviceTypeID;
$scope.handInputModel.period = vatSessionService.month;
if ($scope.handInputModel.amount || $scope.handInputModel.name || $scope.handInputModel.keyinData) {
//日志对象
logDto.ID = PWC.newGuid();
logDto.CreateTime = new Date();
logDto.UpdateTime = new Date();
logDto.OperationContent = "Amount: " + $scope.handInputModel.amount
+ "; Description: " + $scope.handInputModel.description;
+ "; Description: " + $scope.handInputModel.description + "keyinData:" + $scope.handInputModel.keyinData;
logDto.OperationName = $translate.instant('ManualInputDataSource');
logDto.Comment = comment + "(Cell ID:" + $scope.handInputModel.cellID
+ ", Cell Template ID:" + $scope.handInputModel.cellTemplateID + ")";
logDto.OperationType = enums.vatLogOperationTypeEnum.RV_ManualInput;
// 前端保存数据
return vatReportService.addCellManualData($scope.handInputModel, logDto).then(function (manualData) {
var obj = manualData.data.data;
obj.dataSourceType = manualData.dataSourceType;
$scope.updateCellByManualChange(obj);
return $q.when();
});
}
// 前端保存数据
return vatReportService.addCellManualData($scope.handInputModel, logDto).then(function (manualData) {
var obj = manualData.data.data;
obj.dataSourceType = manualData.dataSourceType;
$scope.updateCellByManualChange(obj);
return $q.when();
});
}
return $q.reject();
}
});
return $q.reject();
};
......@@ -2547,9 +2578,9 @@
$scope.commitApprove = function(){
if(vatSessionService.month)
vatSessionService.project.period=vatSessionService.month;
vatApproveService.approvalStatus(vatSessionService.project.id,vatSessionService.project.period).success(function(result){
vatApproveService.approvalStatus(vatSessionService.project.id,vatSessionService.project.period).success(function(result){
if(result&&result=='committed'){
SweetAlert.error('报表提审中或审核已通过!');
SweetAlert.error('报表提审中!');
}else{
SweetAlert.swal({
title: "warning!",
......@@ -2578,7 +2609,7 @@
$scope.doApprove = function(){
if(vatSessionService.month)
vatSessionService.project.period=vatSessionService.month;
vatSessionService.project.period=vatSessionService.month;
vatApproveService.approvalStatus(vatSessionService.project.id,vatSessionService.project.period).success(function(result){
if(result&&result=='committed'){
$("#ApprovalComment").modal('show')
......@@ -2675,12 +2706,12 @@
$scope.voucherFileID = evidence.fileID;
};
$scope.upLoadManual = function(){
$scope.upLoadManual = function(){
if(vatSessionService.month)
vatSessionService.project.period=vatSessionService.month;
vatApproveService.approvalStatus(vatSessionService.project.id,vatSessionService.project.period).success(function(result){
if(result&&result=='committed'){
SweetAlert.error('报表提审中或审核已通过!');
SweetAlert.error('报表提审中!');
}else{
var text= $(".li").find(".active").text();
$log.debug(text);
......@@ -2722,8 +2753,9 @@
}
};
$scope.multiWrite = function(){
if($scope.hasManualLoad){
if($scope.hasManualLoad){
var manualSheet = $scope.manualSpread.getActiveSheet();
var currentSheet = $scope.spread.getActiveSheet()
currentSheet.options.isProtected=false;
......@@ -2735,25 +2767,35 @@
if (jsonTagInfo.isReadOnly)
continue;
var cellValue= manualSheet.getValue(rowIndex,columnIndex);
var cellString='';
if(typeof(cellValue) == "string") cellValue = cellValue.trim();
var r = /^00\d*|^\.\d+|\.$/;
if (typeof cellValue == "undefined" || cellValue == null || cellValue == "" || cellValue == "NaN")continue;
if (cellValue && (isNaN(cellValue) || r.test(cellValue))) {
SweetAlert.warning($translate.instant('CheckInputValueFormat'));
return;
cellString=cellValue;
} else if (cellValue && parseFloat(cellValue).toFixed(2) > 9999999999999) {
SweetAlert.warning($translate.instant('CheckInputValueLength'));
return;
}
cellValue = jsonTagInfo.dataType === 5 ? parseInt(cellValue): parseFloat(cellValue).toFixed(2);
var handInputModel = {
cellID: jsonTagInfo.cellID,
cellTemplateID: jsonTagInfo.cellTemplateID,
reportID: jsonTagInfo.reportID,
amount:cellValue
};
var handInputModel = {};
if(cellString){
handInputModel = {
cellID: jsonTagInfo.cellID,
cellTemplateID: jsonTagInfo.cellTemplateID,
reportID: jsonTagInfo.reportID,
keyinData: cellString
};
}else{
handInputModel = {
cellID: jsonTagInfo.cellID,
cellTemplateID: jsonTagInfo.cellTemplateID,
reportID: jsonTagInfo.reportID,
amount: cellValue
};
}
$scope.myConfirm(handInputModel);
}
......@@ -2770,7 +2812,7 @@
handInputModel.serviceTypeID = vatSessionService.project.serviceTypeID;
handInputModel.period = vatSessionService.month;
if (handInputModel.amount || handInputModel.name) {
if (handInputModel.amount || handInputModel.name || handInputModel.keyinData) {
//日志对象
logDto.ID = PWC.newGuid();
logDto.CreateTime = new Date();
......@@ -2794,7 +2836,7 @@
return $q.reject();
};
$scope.cleanManual = function(){
$scope.cleanManual = function(){
$scope.manualSpread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"),{sheetCount: 1});
$('#ss').html('');
$scope.hasManualLoad = false;
......
......@@ -96,13 +96,9 @@
data.dataSourceType = enums.cellDataSourceType.KeyIn;
return $q.when(data);
},function (data) {
if(data.status==412){
SweetAlert.error('报表提审中或审核已通过!');
}else{
logInfo.UpdateState = $translate.instant('ManualInputFail');
SweetAlert.error($translate.instant('PleaseContactAdministrator'));
return vatOperationLogService.addOperationLog(logInfo);
}
logInfo.UpdateState = $translate.instant('ManualInputFail');
SweetAlert.error($translate.instant('PleaseContactAdministrator'));
return vatOperationLogService.addOperationLog(logInfo);
});
},
deleteCellVoucher: function (voucherId, datasourceId) {
......
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