Commit d9a72b6c authored by frank's avatar frank

Merge branch 'dev_frank' into 'dev'

add apis for report config

See merge request root/atms!12
parents 690ed87f 957b6bb2
......@@ -2,4 +2,5 @@ package pwc.taxtech.atms.constant;
public final class Constant {
public static final String Comma = ",";
public static final String Other = "其他";
}
package pwc.taxtech.atms.constant.enums;
public enum RegexMatchType {
CellNumber(1),
KeyValue (2),
Equal (3);
private Integer code;
RegexMatchType(Integer code) {
this.code = code;
}
public Integer getCode() {
return code;
}
}
package pwc.taxtech.atms.constant.enums;
public enum RoleSource {
Unknown(0),
OrganizationLevel(1),
AreaLevel(2),
BusinessUnitLevel(3),
OriginalLevel(4),
DimensionLevel(5),
/**
* //维度的原始角色
*/
DimensionOriginalLevel(6),
/**
* //维度的附加角色
*/
DimensionExraLevel(7),
/**
* //机构的原始角色
*/
OrganizationOriginaLevel(8),
/**
* 机构的附加角色
*/
OrganizationExtraLevel(9);
private Integer code;
RoleSource(Integer code) {
this.code = code;
}
public Integer getCode() {
return code;
}
}
......@@ -7,6 +7,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import pwc.taxtech.atms.dto.CellTemplateConfigDto;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.service.CellTemplateService;
import java.util.Collections;
......@@ -21,17 +22,35 @@ public class CellTemplateController {
@RequestMapping(value = "configList/{templateID}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public @ResponseBody
List<CellTemplateConfigDto> GetConfigList(@PathVariable String templateID) {
if(StringUtils.isEmpty(templateID)){
return Collections.emptyList();
OperationResultDto<List<CellTemplateConfigDto>> GetConfigList(@PathVariable String templateID) {
OperationResultDto<List<CellTemplateConfigDto>> result = new OperationResultDto<>();
if (StringUtils.isEmpty(templateID)) {
result.setData(Collections.emptyList());
}
try {
return cellTemplateService.getCellConfigList(templateID);
} catch (Exception e) {
logger.error("CellTemplateController.GetCellConfigList", e);
}
return result;
}
@RequestMapping(value = "config/{cellTemplateID}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public @ResponseBody
OperationResultDto<CellTemplateConfigDto> GetConfig(@PathVariable String cellTemplateID) {
if (StringUtils.isEmpty(cellTemplateID)) {
return new OperationResultDto<>();
}
try {
return cellTemplateService.GetCellConfigList(templateID);
return cellTemplateService.getCellConfig(cellTemplateID);
} catch (Exception e) {
logger.error("GetCellConfigList",e);
logger.error("CellTemplateController.GetConfig", e);
}
return Collections.emptyList();
return new OperationResultDto<>();
}
}
......@@ -46,7 +46,7 @@ public class RuleEngineeConfigController {
@RequestMapping(value="taxRuleSetting/Save",method = RequestMethod.POST)
public void SaveTaxRuleSettings(@RequestBody BatchUpdateTaxRuleDto batchUpdateTaxRule) {
logger.debug("RuleEngineeConfigController SaveTaxRuleSettings");
ruleEngineeConfigService.SaveTaxRuleSettings(batchUpdateTaxRule);
ruleEngineeConfigService.savetaxrulesettings(batchUpdateTaxRule);
}
}
\ No newline at end of file
......@@ -6,10 +6,10 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.util.FileCopyUtils;
import org.springframework.web.bind.annotation.*;
import pwc.taxtech.atms.common.ApplicationException;
import pwc.taxtech.atms.dto.TemplateDto;
import pwc.taxtech.atms.dto.TemplateUniqDto;
import pwc.taxtech.atms.service.TemplateService;
import javax.servlet.http.HttpServletResponse;
......@@ -21,7 +21,7 @@ import java.util.List;
@RestController
@RequestMapping(value = "api/v1/template")
public class TemplateController {
private static final Logger logger = LoggerFactory.getLogger(AccountController.class);
private static final Logger logger = LoggerFactory.getLogger(TemplateController.class);
@Autowired
TemplateService templateService;
......@@ -64,7 +64,7 @@ public class TemplateController {
}
filePath = this.getClass().getResource("").toURI().getPath();
String tempPath = filePath.substring(0,filePath.indexOf("classes")+"\\classes".length());
String tempPath = filePath.substring(0, filePath.indexOf("classes") + "\\classes".length());
templateFile = new File(tempPath + templateService.getTemplatePath(templateID));
try {
......@@ -73,11 +73,11 @@ public class TemplateController {
String customFileName = "template_" + DateTime.now().toString("yyyyMMddHHmmss") + ".xlsx";
response.setHeader("Content-Disposition", String.format("inline; filename=\"" + customFileName + "\""));
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
int len=0;
int len = 0;
byte[] buffer = new byte[1024];
OutputStream out = response.getOutputStream();
while ((len=inputStream.read(buffer))>0){
out.write(buffer,0,len);
while ((len = inputStream.read(buffer)) > 0) {
out.write(buffer, 0, len);
}
//FileCopyUtils.copy(inputStream, response.getOutputStream());
......@@ -98,6 +98,11 @@ public class TemplateController {
inputStream = null;
}
}
}
@RequestMapping(value = "getTemplateUniqList", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public @ResponseBody
List<TemplateUniqDto> getTemplateUniqList(String serviceTypeID, Integer payTaxType, Integer reportType, String industryIDs) {
return templateService.getTemplateUniqList(serviceTypeID, payTaxType, reportType, industryIDs);
}
}
package pwc.taxtech.atms.controller;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.service.TemplateFormulaService;
@RestController
@RequestMapping(value = "api/v1/templateFormula")
public class TemplateFormulaController {
@Autowired
TemplateFormulaService templateFormulaService;
private static final Logger logger = LoggerFactory.getLogger(TemplateFormulaController.class);
@RequestMapping(value = "validate", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public @ResponseBody OperationResultDto Validate(@RequestBody(required = false) String fromula) {
try {
return templateFormulaService.Validate(fromula);
} catch (Exception e) {
logger.error("TemplateFormulaController Valdate", e);
OperationResultDto result = new OperationResultDto();
result.setResult(false);
return result;
}
}
}
package pwc.taxtech.atms.dao;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds;
import pwc.taxtech.atms.MyMapper;
import pwc.taxtech.atms.dto.TemplateUniqDto;
import pwc.taxtech.atms.entitiy.Template;
import pwc.taxtech.atms.entitiy.TemplateExample;
......@@ -105,4 +108,14 @@ public interface TemplateMapper extends MyMapper {
* @mbg.generated
*/
int updateByPrimaryKey(Template record);
/**
* 获取TemplateUniqDto
* @param serviceTypeID
* @param payTaxType
* @param reportType
* @param indeustryIDs
* @return TemplateUniqDto List
*/
List<TemplateUniqDto> getTemplateUniqDtosByTemplateAndTemplateGroup(Map<String,Object> map);
}
\ No newline at end of file
package pwc.taxtech.atms.dto;
import pwc.taxtech.atms.constant.enums.RoleSource;
public class NameDto {
private String ID;
private String name;
private RoleSource RoleSource;
public String getID() {
return ID;
}
public void setID(String ID) {
this.ID = ID;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
package pwc.taxtech.atms.dto;
import org.apache.commons.lang3.StringUtils;
import pwc.taxtech.atms.constant.enums.RegexMatchType;
import java.util.AbstractMap;
public class RegexMatchObject {
/**
* GET(int columnIndex, int rowIndex);
*/
private String formularTemplate = "GET({0},{1})";
private String keyValueTemplate = "KeyValue(\"{0}\")";
private int index;
private int length;
private RegexMatchType matchType;
private AbstractMap.SimpleEntry<String, Integer> parameters;
private String expression;
private int fromNumberSystem26(String s) {
if (StringUtils.isEmpty(s)) {
return 0;
}
int n = 0;
for (int i = s.length() - 1, j = 1; i >= 0; i--, j *= 26) {
char c = Character.toUpperCase(s.charAt(i));
if (c < 'A' || c > 'Z') {
return 0;
}
n += ((int) c - 64) * j;
}
return n;
}
public String getFormularTemplate() {
return formularTemplate;
}
public void setFormularTemplate(String formularTemplate) {
this.formularTemplate = formularTemplate;
}
public String getKeyValueTemplate() {
return keyValueTemplate;
}
public void setKeyValueTemplate(String keyValueTemplate) {
this.keyValueTemplate = keyValueTemplate;
}
public int getIndex() {
return index;
}
public void setIndex(int index) {
this.index = index;
}
public int getLength() {
return length;
}
public void setLength(int length) {
this.length = length;
}
public RegexMatchType getMatchType() {
return matchType;
}
public void setMatchType(RegexMatchType matchType) {
this.matchType = matchType;
}
public AbstractMap.SimpleEntry<String, Integer> getParameters() {
return parameters;
}
public void setParameters(AbstractMap.SimpleEntry<String, Integer> parameters) {
this.parameters = parameters;
}
public String getExpression() {
if (this.matchType.equals(RegexMatchType.CellNumber.getCode())) {
return String.format(formularTemplate, fromNumberSystem26(this.parameters.getKey()) - 1, parameters.getValue() - 1);
} else if (this.matchType.equals(RegexMatchType.KeyValue.getCode())) {
return String.format(keyValueTemplate, this.parameters.getKey().substring(1));
} else if (this.matchType.equals(RegexMatchType.Equal.getCode())) {
return "==";
}
return expression;
}
}
package pwc.taxtech.atms.dto;
public class TemplateUniqDto {
private String ID;
private String code;
private String name;
private Integer orderIndex;
private Integer reportType;
private String templateGroupID;
private String templateGroupName;
private String parentID;
private String parentName;
/**
* template type
*/
private Integer payTaxType;
private String industryIDs;
private String serviceTypeID;
private boolean isActiveAssociation;
public String getID() {
return ID;
}
public void setID(String ID) {
this.ID = ID;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getOrderIndex() {
return orderIndex;
}
public void setOrderIndex(Integer orderIndex) {
this.orderIndex = orderIndex;
}
public Integer getReportType() {
return reportType;
}
public void setReportType(Integer reportType) {
this.reportType = reportType;
}
public String getTemplateGroupID() {
return templateGroupID;
}
public void setTemplateGroupID(String templateGroupID) {
this.templateGroupID = templateGroupID;
}
public String getTemplateGroupName() {
return templateGroupName;
}
public void setTemplateGroupName(String templateGroupName) {
this.templateGroupName = templateGroupName;
}
public String getParentID() {
return parentID;
}
public void setParentID(String parentID) {
this.parentID = parentID;
}
public String getParentName() {
return parentName;
}
public void setParentName(String parentName) {
this.parentName = parentName;
}
public Integer getPayTaxType() {
return payTaxType;
}
public void setPayTaxType(Integer payTaxType) {
this.payTaxType = payTaxType;
}
public String getIndustryIDs() {
return industryIDs;
}
public void setIndustryIDs(String industryIDs) {
this.industryIDs = industryIDs;
}
public String getServiceTypeID() {
return serviceTypeID;
}
public void setServiceTypeID(String serviceTypeID) {
this.serviceTypeID = serviceTypeID;
}
public boolean getIsActiveAssociation() {
return isActiveAssociation;
}
public void setIsActiveAssociation(boolean isActiveAssociation) {
this.isActiveAssociation = isActiveAssociation;
}
}
package pwc.taxtech.atms.service;
import pwc.taxtech.atms.dto.CellTemplateConfigDto;
import pwc.taxtech.atms.dto.OperationResultDto;
import java.util.List;
public interface CellTemplateService {
List<CellTemplateConfigDto> GetCellConfigList(String templateID);
OperationResultDto<List<CellTemplateConfigDto>> getCellConfigList(String templateID);
OperationResultDto<CellTemplateConfigDto> getCellConfig(String cellTemplateID);
}
......@@ -11,5 +11,5 @@ public interface RuleEngineeConfigService {
List<TaxRuleSettingDto> GetTaxRuleSetting();
void SaveTaxRuleSettings(BatchUpdateTaxRuleDto batchUpdateTaxRule);
void savetaxrulesettings(BatchUpdateTaxRuleDto batchUpdateTaxRule);
}
package pwc.taxtech.atms.service;
import pwc.taxtech.atms.dto.OperationResultDto;
public interface TemplateFormulaService {
OperationResultDto Validate(String formula);
}
package pwc.taxtech.atms.service;
import pwc.taxtech.atms.dto.TemplateDto;
import pwc.taxtech.atms.dto.TemplateUniqDto;
import java.util.List;
......@@ -13,4 +14,6 @@ public interface TemplateService {
List<TemplateDto> get(String templateGroupID, Integer reportType);
String getTemplatePath(String templateID);
List<TemplateUniqDto> getTemplateUniqList(String serviceTypeID, Integer payTaxType, Integer reportType, String industryIDs);
}
......@@ -42,8 +42,8 @@ public final class CellConfigTranslater {
cellTemplateConfigDto.setIsReadOnly(isReadOnly);
cellTemplateConfigDto.setFormulaDescription(description);
Optional<CellTemplateConfig> formulaItem = configList.stream().filter(a -> a.getDataSourceType().equals(CellDataSourceType.valueOf("Formula"))).findFirst();
if (formulaItem != null) {
Optional<CellTemplateConfig> formulaItem = configList.stream().filter(a -> a.getDataSourceType().equals(CellDataSourceType.Formula.getCode())).findFirst();
if (formulaItem.isPresent()) {
cellTemplateConfigDto.setHasFormula(true);
cellTemplateConfigDto.setFormula(formulaItem.get().getFormula());
if (StringUtils.isEmpty(cellTemplateConfigDto.getFormulaDescription())
......@@ -54,8 +54,8 @@ public final class CellConfigTranslater {
cellTemplateConfigDto.setCellTemplateID(formulaItem.get().getCellTemplateID());
}
Optional<CellTemplateConfig> voucherItem = configList.stream().filter(x -> x.getDataSourceType().equals(CellDataSourceType.valueOf("Voucher"))).findFirst();
if (voucherItem != null) {
Optional<CellTemplateConfig> voucherItem = configList.stream().filter(x -> x.getDataSourceType().equals(CellDataSourceType.Voucher.getCode())).findFirst();
if (voucherItem.isPresent()) {
cellTemplateConfigDto.setHasVoucher(true);
cellTemplateConfigDto.setVoucherKeyword(voucherItem.get().getVoucherKeyword() == null ? "" : voucherItem.get().getVoucherKeyword());
if (!StringUtils.isEmpty(voucherItem.get().getAccountCodes())) {
......@@ -63,8 +63,8 @@ public final class CellConfigTranslater {
}
}
Optional<CellTemplateConfig> invoiceItem = configList.stream().filter(x -> x.getDataSourceType().equals(CellDataSourceType.valueOf("OutputInvoice")) || x.getDataSourceType().equals(CellDataSourceType.valueOf("InputInvoice")) || x.getDataSourceType().equals(CellDataSourceType.valueOf("CustomInvoice"))).findFirst();
if (invoiceItem != null) {
Optional<CellTemplateConfig> invoiceItem = configList.stream().filter(x -> x.getDataSourceType().equals(CellDataSourceType.OutputInvoice.getCode()) || x.getDataSourceType().equals(CellDataSourceType.InputInvoice.getCode()) || x.getDataSourceType().equals(CellDataSourceType.CustomInvoice.getCode())).findFirst();
if (invoiceItem.isPresent()) {
cellTemplateConfigDto.setHasInvoice(true);
cellTemplateConfigDto.setInvoiceType(invoiceItem.get().getInvoiceType());
cellTemplateConfigDto.setInvoiceAmountType(invoiceItem.get().getInvoiceAmountType());
......@@ -84,19 +84,19 @@ public final class CellConfigTranslater {
}
}
Optional<CellTemplateConfig> keyInItem = configList.stream().filter(x -> x.getDataSourceType().equals(CellDataSourceType.valueOf("KeyIn"))).findFirst();
if (keyInItem != null) {
Optional<CellTemplateConfig> keyInItem = configList.stream().filter(x -> x.getDataSourceType().equals(CellDataSourceType.KeyIn.getCode())).findFirst();
if (keyInItem.isPresent()) {
cellTemplateConfigDto.setHasKeyIn(true);
}
Optional<CellTemplateConfig> modelItem = configList.stream().filter(x -> x.getDataSourceType().equals(CellDataSourceType.valueOf("RelatedModel"))).findFirst();
if (modelItem != null) {
Optional<CellTemplateConfig> modelItem = configList.stream().filter(x -> x.getDataSourceType().equals(CellDataSourceType.RelatedModel.getCode())).findFirst();
if (modelItem.isPresent()) {
cellTemplateConfigDto.setHasModel(true);
cellTemplateConfigDto.setModelIDs(GetList(modelItem.get().getModelIDs()));
}
Optional<CellTemplateConfig> validationItem = configList.stream().filter(x -> x.getDataSourceType().equals(CellDataSourceType.valueOf("Validation"))).findFirst();
if (validationItem != null) {
Optional<CellTemplateConfig> validationItem = configList.stream().filter(x -> x.getDataSourceType().equals(CellDataSourceType.Validation.getCode())).findFirst();
if (validationItem.isPresent()) {
cellTemplateConfigDto.setHasValidation(true);
cellTemplateConfigDto.setValidation(validationItem.get().getValidation());
cellTemplateConfigDto.setValidationDescription(validationItem.get().getValidationDescription());
......@@ -110,6 +110,6 @@ public final class CellConfigTranslater {
return null;
}
return Arrays.asList(joinString.split(Constant.Comma));
return new ArrayList<>(Arrays.asList(joinString.split(Constant.Comma)));
}
}
package pwc.taxtech.atms.service.impl;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.dao.CellTemplateMapper;
import pwc.taxtech.atms.dto.CellTemplateConfigDto;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.entitiy.CellTemplate;
import pwc.taxtech.atms.entitiy.CellTemplateConfig;
import pwc.taxtech.atms.entitiy.CellTemplateConfigExample;
import pwc.taxtech.atms.entitiy.CellTemplateExample;
import pwc.taxtech.atms.service.CellTemplateService;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
......@@ -15,19 +19,56 @@ import java.util.stream.Collectors;
public class CellTemplateServiceImpl extends AbstractService implements CellTemplateService {
@Override
public List<CellTemplateConfigDto> GetCellConfigList(String templateID) {
List<CellTemplateConfigDto> result = new ArrayList<>();
public OperationResultDto<List<CellTemplateConfigDto>> getCellConfigList(String templateID) {
OperationResultDto<List<CellTemplateConfigDto>> result = new OperationResultDto<>();
CellTemplateExample example = new CellTemplateExample();
example.createCriteria().andReportTemplateIDEqualTo(templateID);
List<CellTemplate> cellTemplateList = cellTemplateMapper.selectByExample(example);
List<CellTemplateConfig> configList = cellTemplateConfigMapper.getCellTemplateConfigByTemplateID(templateID);
if (cellTemplateList.isEmpty()) {
result.setData(Collections.emptyList());
return result;
}
List<CellTemplateConfigDto> rData = new ArrayList<>();
for (CellTemplate x : cellTemplateList) {
result.add(GetConfigDto(x, configList.stream().filter(a -> a.getCellTemplateID().equalsIgnoreCase(x.getID())).collect(Collectors.toList())));
rData.add(GetConfigDto(x, configList.stream().filter(a -> a.getCellTemplateID().equalsIgnoreCase(x.getID())).collect(Collectors.toList())));
}
if (rData.size() > 0) {
result.setResult(true);
result.setData(rData);
} else {
result.setData(Collections.emptyList());
}
return result;
}
@Override
public OperationResultDto<CellTemplateConfigDto> getCellConfig(String cellTemplateID) {
OperationResultDto<CellTemplateConfigDto> result = new OperationResultDto<>();
CellTemplate config = cellTemplateMapper.selectByPrimaryKey(cellTemplateID);
if (config.equals(null)) {
result.setResultMsg("NoData");
return result;
}
CellTemplateConfigExample example = new CellTemplateConfigExample();
example.createCriteria().andCellTemplateIDEqualTo(cellTemplateID);
List<CellTemplateConfig> configList = cellTemplateConfigMapper.selectByExample(example);
result.setData(GetConfigDto(config, configList));
if (result.getData().equals(null)) {
result.setResultMsg("NoData");
return result;
}
result.setResult(true);
return result;
}
......
package pwc.taxtech.atms.service.impl;
import org.apache.commons.lang3.StringUtils;
import pwc.taxtech.atms.constant.enums.RegexMatchType;
import pwc.taxtech.atms.dto.RegexMatchObject;
import java.util.AbstractMap;
import java.util.Stack;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public final class FormulaHelper {
private Pattern regexPattern, equalPattern, keyValuePattern;
private String strPattern = "(?=\\+|-|\\*|/|,|\\(|$|)(?!\")(((?<columnNumber>[A-Z]{1,3})(?<rowNumber>[0-9]{1,7}))|(?<keyCode>@[a-zA-Z0-9.]{1,}))(?=\\+|-|\\*|/| |,|\\)|>|=|<|$|^)(?!\")";
private String strKeyValuePattern = "(?=\\+|-|\\*|/|,|\\(|$|)(?!\")(?<keyCode>@[a-zA-Z0-9.]{1,})(?=\\+|-|\\*|/| |,|\\)|>|=|<|$|^)(?!\")";
private String strEqualPattern = "(?<![<>])(?<equal>=)";
public FormulaHelper() {
regexPattern = Pattern.compile(strPattern);
equalPattern = Pattern.compile(strEqualPattern);
keyValuePattern = Pattern.compile(strKeyValuePattern);
}
public String FormatFormula(String formula) {
Matcher equalMatchResult = equalPattern.matcher(formula);
Stack<RegexMatchObject> equalMatchObjectStack = new Stack<>();
while (equalMatchResult.find()) {
if (StringUtils.isNotBlank(equalMatchResult.group("equal"))) {
RegexMatchObject object = new RegexMatchObject();
object.setIndex(equalMatchResult.start());
object.setLength(equalMatchResult.end() - equalMatchResult.start() + 1);
object.setMatchType(RegexMatchType.Equal);
object.setParameters(new AbstractMap.SimpleEntry<>(equalMatchResult.group("equal"), -1));
equalMatchObjectStack.push(object);
}
}
while (equalMatchObjectStack.size() > 0) {
RegexMatchObject obj = equalMatchObjectStack.pop();
formula = formula.substring(0, obj.getIndex()) + obj.getExpression() + formula.substring(obj.getIndex() + obj.getLength());
}
Matcher regexResult = regexPattern.matcher(formula);
Stack<RegexMatchObject> regexMatchObjectStack = new Stack<>();
while (regexResult.find()) {
if (StringUtils.isNotBlank(regexResult.group("columnNumber")) && StringUtils.isNotBlank(regexResult.group("rowNumber"))) {
RegexMatchObject object = new RegexMatchObject();
object.setIndex(regexResult.start());
object.setLength(regexResult.end() - regexResult.start() + 1);
object.setMatchType(RegexMatchType.CellNumber);
object.setParameters(new AbstractMap.SimpleEntry<>(regexResult.group("columnNumber"), Integer.parseInt(regexResult.group("rowNumber"))));
regexMatchObjectStack.push(object);
}
if (StringUtils.isNotBlank(regexResult.group("keyCode"))) {
RegexMatchObject object = new RegexMatchObject();
object.setIndex(regexResult.start());
object.setLength(regexResult.end() - regexResult.start() + 1);
object.setMatchType(RegexMatchType.CellNumber);
object.setParameters(new AbstractMap.SimpleEntry<>(regexResult.group("keyCode"), -1));
regexMatchObjectStack.push(object);
}
}
while (!regexMatchObjectStack.empty()) {
RegexMatchObject obj = regexMatchObjectStack.pop();
formula = formula.substring(0, obj.getIndex()) + obj.getExpression() + formula.substring(obj.getIndex(), obj.getLength());
}
return formula.trim();
}
}
......@@ -44,7 +44,7 @@ public class RuleEngineeConfigServiceImpl extends AbstractService implements Rul
List<String> orgIDs = organizationMapper.selectOnlyIDAndParentID().stream().map(OrganizationDto::getID)
.collect(Collectors.toList());
List<TaxPayerReportRule> rules = taxPayerReportRuleMapper.selectByExample(new TaxPayerReportRuleExample());
List<TaxPayerReportRule> filterRules = new ArrayList<TaxPayerReportRule>();
List<TaxPayerReportRule> filterRules = new ArrayList<>();
for (TaxPayerReportRule rule : rules) {
String[] selectedOrgIds = rule.getOrganizationID().split(",");
......@@ -61,7 +61,7 @@ public class RuleEngineeConfigServiceImpl extends AbstractService implements Rul
}
}
List<TaxPayerReportRuleDto> dtoList = new ArrayList<TaxPayerReportRuleDto>();
List<TaxPayerReportRuleDto> dtoList = new ArrayList<>();
for (TaxPayerReportRule rule : filterRules) {
TaxPayerReportRuleDto ruleDto = new TaxPayerReportRuleDto();
CommonUtils.copyProperties(rule, ruleDto);
......@@ -82,8 +82,8 @@ public class RuleEngineeConfigServiceImpl extends AbstractService implements Rul
}
@Override
@Transactional
public void SaveTaxRuleSettings(BatchUpdateTaxRuleDto batchUpdateTaxRule) {
@Transactional(readOnly = true)
public void savetaxrulesettings(BatchUpdateTaxRuleDto batchUpdateTaxRule) {
for (TaxRuleSettingOperation trso : batchUpdateTaxRule.getTaxRuleSettingOperations()) {
TaxRuleSetting taxRuleSetting = new TaxRuleSetting();
CommonUtils.copyProperties(trso.getTaxRuleSetting(), taxRuleSetting);
......@@ -126,12 +126,12 @@ public class RuleEngineeConfigServiceImpl extends AbstractService implements Rul
taxPayerReportRule.setCreateTime(new Date());
taxPayerReportRule.setUpdateTime(new Date());
SaveOrganizationServiceTemplateGroup(taxPayerReportRule,tprrdo.getAction());
if(tprrdo.getAction()=="Add") {
if(tprrdo.getAction().equals("Add")) {
taxPayerReportRuleMapper.insert(taxPayerReportRule);
operationService.AddDataAddLog(taxPayerReportRule, OperationModule.RuleEngineConfig, authUserHelper.getCurrentUserID(),
"AddRuleEngineConfiguration", "纳税类型", "纳税类型添加特殊机构", OperateLogType.OperationLogRuleEngine);
}
else if(tprrdo.getAction()=="Update") {
else if(tprrdo.getAction().equals("Update")) {
TaxPayerReportRule old = taxPayerReportRuleMapper.selectByPrimaryKey(reportDto.getID());
TaxPayerReportRule original = new TaxPayerReportRule();
CommonUtils.copyProperties(old, original);
......@@ -147,7 +147,7 @@ public class RuleEngineeConfigServiceImpl extends AbstractService implements Rul
"UpdateRuleEngineConfiguration", "纳税类型", taxPayerReportRule.getIsDefault() ? "默认纳税类型或默认纳税报表" : "纳税类型更新特殊机构", OperateLogType.OperationLogRuleEngine);
}
else if(tprrdo.getAction()=="Delete") {
else if(tprrdo.getAction().equals("Delete")) {
taxPayerReportRuleMapper.deleteByPrimaryKey(taxPayerReportRule.getID());
operationService.DeleteDataAddLog(reportDto, OperationModule.RuleEngineConfig, authUserHelper.getCurrentUserID(),
"DeleteRuleEngineConfiguration", "纳税类型", "纳税类型删除特殊机构", OperateLogType.OperationLogRuleEngine);
......@@ -184,7 +184,7 @@ public class RuleEngineeConfigServiceImpl extends AbstractService implements Rul
example.createCriteria().andOrganizationIDEqualTo(taxPayerReportRule.getOrganizationID()).andServiceTypeIDEqualTo("2");
Optional<OrganizationServiceTemplateGroup> thisOrgTemplate = organizationServiceTemplateGroupMapper.selectByExample(example).stream().findFirst();
if(action=="Delete") {
if(action.equals("Delete")) {
if(thisOrgTemplate.isPresent()) {
organizationServiceTemplateGroupMapper.deleteByPrimaryKey(thisOrgTemplate.get().getID());
}
......@@ -193,7 +193,7 @@ public class RuleEngineeConfigServiceImpl extends AbstractService implements Rul
{
if(thisOrgTemplate.isPresent()) {
OrganizationServiceTemplateGroup organizationServiceTemplateGroup = thisOrgTemplate.get();
if(organizationServiceTemplateGroup.getTemplateGroupID()==taxPayerReportRule.getTemplateGroupID()) {
if(organizationServiceTemplateGroup.getTemplateGroupID().equals(taxPayerReportRule.getTemplateGroupID())) {
//不用改
}
else
......
package pwc.taxtech.atms.service.impl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.service.TemplateFormulaService;
@Service
public class TemplateFormulaServiceImpl extends AbstractService implements TemplateFormulaService {
private FormulaHelper _formulaHelper = new FormulaHelper();
//private static ScriptEngine m_engine = Python.CreateEngine();
@Override
public OperationResultDto Validate(String formula) {
OperationResultDto result = new OperationResultDto();
if (StringUtils.isBlank(formula)) {
result.setResult(true);
return result;
}
try {
String tidyFormula = _formulaHelper.FormatFormula(formula);
/*todo: find the replace solution for here to check formual is correct or not
//var sourceCode = m_engine.CreateScriptSourceFromString(tidyFormula, SourceCodeKind.AutoDetect);
//var compileCode = sourceCode.Compile();
rtn.Result = compileCode != null;*/
result.setResult(true);
return result;
} catch (Exception e) {
result.setResult(false);
result.setResultMsg(e.getMessage());
}
return null;
}
}
......@@ -2,13 +2,18 @@ package pwc.taxtech.atms.service.impl;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.common.CommonUtils;
import pwc.taxtech.atms.constant.Constant;
import pwc.taxtech.atms.dto.NameDto;
import pwc.taxtech.atms.dto.TemplateDto;
import pwc.taxtech.atms.dto.TemplateUniqDto;
import pwc.taxtech.atms.entitiy.Template;
import pwc.taxtech.atms.entitiy.TemplateExample;
import pwc.taxtech.atms.service.TemplateService;
import java.util.ArrayList;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
import static java.util.stream.Collectors.groupingBy;
@Service
public class TemplateServiceImpl extends AbstractService implements TemplateService {
......@@ -50,4 +55,63 @@ public class TemplateServiceImpl extends AbstractService implements TemplateServ
}
return result;
}
@Override
public List<TemplateUniqDto> getTemplateUniqList(String serviceTypeID, Integer payTaxType, Integer reportType, String industryIDs) {
Map<String, Object> map = new HashMap<>(4);
map.put("serviceTypeID", serviceTypeID);
map.put("payTaxType", payTaxType);
map.put("reportType", reportType);
map.put("industryIDs", industryIDs);
List<TemplateUniqDto> templatedbList = templateMapper.getTemplateUniqDtosByTemplateAndTemplateGroup(map);
Map<String, Map<String, List<TemplateUniqDto>>> groupList = templatedbList.stream().filter(sa -> sa.getIsActiveAssociation()).collect(groupingBy(TemplateUniqDto::getTemplateGroupID, Collectors.groupingBy(TemplateUniqDto::getTemplateGroupName)));
List<NameDto> groupListResult = new ArrayList<>();
groupList.forEach((key, value) -> {
NameDto temp = new NameDto();
temp.setID(key);
value.forEach((key2, value2) -> {
temp.setName(key2);
});
groupListResult.add(temp);
});
List<TemplateUniqDto> result = new ArrayList<>();
for (NameDto group : groupListResult) {
TemplateUniqDto parent = new TemplateUniqDto();
parent.setID(group.getID());
parent.setCode("");
parent.setName(group.getName());
result.add(parent);
List<TemplateUniqDto> subList = templatedbList.stream().filter(sa -> sa.getTemplateGroupID() == group.getID() && sa.getIsActiveAssociation()).collect(Collectors.toList());
subList.forEach(sa -> {
sa.setParentID(sa.getTemplateGroupID());
sa.setParentName(sa.getTemplateGroupName());
});
result.addAll(subList);
}
List<TemplateUniqDto> noGroupTemplateList = templatedbList.stream().filter(sa -> !sa.getIsActiveAssociation()).collect(Collectors.toList());
if (!noGroupTemplateList.isEmpty()) {
TemplateUniqDto parent = new TemplateUniqDto();
parent.setID(UUID.fromString("").toString());
parent.setCode("");
parent.setName(Constant.Other);
result.add(parent);
noGroupTemplateList.forEach(sa -> {
sa.setParentID(parent.getID());
sa.setParentName(parent.getName());
});
result.addAll(noGroupTemplateList);
}
return result;
}
}
......@@ -398,4 +398,37 @@
order by ${orderByClause}
</if>
</select>
<resultMap id="TemplateUniqDto" type="pwc.taxtech.atms.dto.TemplateUniqDto">
<id column="ID" jdbcType="VARCHAR" property="ID" />
<result column="Code" jdbcType="VARCHAR" property="Code" />
<result column="Name" jdbcType="VARCHAR" property="Name" />
<result column="OrderIndex" jdbcType="INTEGER" property="OrderIndex" />
<result column="ReportType" jdbcType="INTEGER" property="ReportType" />
<result column="TemplateGroupID" jdbcType="VARCHAR" property="TemplateGroupID" />
<result column="TemplateGroupName" jdbcType="VARCHAR" property="TemplateGroupName" />
<result column="ParentID" jdbcType="VARCHAR" property="ParentID" />
<result column="ParentName" jdbcType="VARCHAR" property="ParentName" />
<result column="PayTaxType" jdbcType="INTEGER" property="PayTaxType" />
<result column="IndustryIDs" jdbcType="VARCHAR" property="IndustryIDs" />
<result column="ServiceTypeID" jdbcType="VARCHAR" property="ServiceTypeID" />
<result column="IsActiveAssociation" jdbcType="INTEGER" property="IsActiveAssociation" />
</resultMap>
<select id="getTemplateUniqDtosByTemplateAndTemplateGroup" parameterType="map" resultMap="TemplateUniqDto" >
SELECT p.ID,p.Code,p.Name,p.ReportType,q.ID as TemplateGroupID,q.Name as TemplateGroupName,p.IsActiveAssociation FROM Template p join TemplateGroup q on p.templategroupID=q.ID
<if test="serviceTypeID">
WHERE q.ServiceTypeID=#{serviceTypeID,jdbcType=VARCHAR}
</if>
<if test="payTaxType!=null">
AND q.PayTaxType = #{payTaxType,jdbcType=INTEGER}
</if>
<if test="reportType!=null">
AND p.ReportType =#{reportType,jdbcType=INTEGER}
</if>
<if test="industryIDs">
AND q.IndustryIDs =#{industryID,jdbcType=VARCHAR}
</if>
ORDER BY p.TemplateGroupID, p.OrderIndex
</select>
</mapper>
\ No newline at end of file
......@@ -3,7 +3,7 @@
'templateService', 'templateFormulaService', 'stdAccountService', 'spreadJsTipService', 'enums', 'KeyValueConfigService', 'modelConfigurationService', 'industryService',
'formulaService', 'serviceTypeService', 'mentioUtil', 'region',
function ($scope, $log, $timeout, $translate, $rootScope, $interval, $compile, $uibModal, $q, SweetAlert, templateGroupService, templateService, templateFormulaService,
stdAccountService, spreadJsTipService, enums, KeyValueConfigService, modelConfigurationService, industryService, formulaService, serviceTypeService, mentioUtil, region) {
stdAccountService, spreadJsTipService, enums, KeyValueConfigService, modelConfigurationService, industryService, formulaService, serviceTypeService, mentioUtil, region) {
'use strict';
var keyValueExp = /@\S*/g;
......@@ -23,7 +23,6 @@
};
var serviceTypeMapping = {
VAT: $translate.instant('VAT'),
RPT: $translate.instant('RPT'),
......@@ -425,56 +424,56 @@
categoryOptions: [],
rateOptions: [],
amountTypeOptions: [
{ name: 'PleaseSelect', value: 0 },
{ name: 'TotalAmount', value: 1 },
{ name: 'TaxAmount', value: 2 },
{ name: 'CopyNumber', value: 3 }
{name: 'PleaseSelect', value: 0},
{name: 'TotalAmount', value: 1},
{name: 'TaxAmount', value: 2},
{name: 'CopyNumber', value: 3}
]
},
{
type: 'Income',
value: 1,
categoryOptions: _.chain(enums.invoiceType).pairs().map(function (it) {
return { key: $translate.instant(it[0]), value: it[1], ticked: false };
return {key: $translate.instant(it[0]), value: it[1], ticked: false};
}).value(),
rateOptions: [
{ key: '17%', value: '17%', ticked: false },
{ key: '13%', value: '13%', ticked: false },
{ key: '11%', value: '11%', ticked: false },
{ key: '6%', value: '6%', ticked: false },
{ key: '5%', value: '5%', ticked: false },
{ key: '4%', value: '4%', ticked: false },
{ key: '3%', value: '3%', ticked: false },
{ key: '1.5%', value: '1.5%', ticked: false }
{key: '17%', value: '17%', ticked: false},
{key: '13%', value: '13%', ticked: false},
{key: '11%', value: '11%', ticked: false},
{key: '6%', value: '6%', ticked: false},
{key: '5%', value: '5%', ticked: false},
{key: '4%', value: '4%', ticked: false},
{key: '3%', value: '3%', ticked: false},
{key: '1.5%', value: '1.5%', ticked: false}
],
amountTypeOptions: [
{ name: 'PleaseSelect', value: 0 },
{ name: 'TotalAmount', value: 1 },
{ name: 'TaxAmount', value: 2 },
{ name: 'CopyNumber', value: 3 }
{name: 'PleaseSelect', value: 0},
{name: 'TotalAmount', value: 1},
{name: 'TaxAmount', value: 2},
{name: 'CopyNumber', value: 3}
]
},
{
type: 'Output',
value: 2,
categoryOptions: _.chain(enums.outputInvoiceType).pairs().map(function (it) {
return { key: $translate.instant(it[0]), value: it[1], ticked: false };
return {key: $translate.instant(it[0]), value: it[1], ticked: false};
}).value(),
rateOptions: [
{ key: '17%', value: '17%', ticked: false },
{ key: '13%', value: '13%', ticked: false },
{ key: '11%', value: '11%', ticked: false },
{ key: '6%', value: '6%', ticked: false },
{ key: '5%', value: '5%', ticked: false },
{ key: '4%', value: '4%', ticked: false },
{ key: '3%', value: '3%', ticked: false },
{ key: '1.5%', value: '1.5%', ticked: false }
{key: '17%', value: '17%', ticked: false},
{key: '13%', value: '13%', ticked: false},
{key: '11%', value: '11%', ticked: false},
{key: '6%', value: '6%', ticked: false},
{key: '5%', value: '5%', ticked: false},
{key: '4%', value: '4%', ticked: false},
{key: '3%', value: '3%', ticked: false},
{key: '1.5%', value: '1.5%', ticked: false}
],
amountTypeOptions: [
{ name: 'PleaseSelect', value: 0 },
{ name: 'TotalAmount', value: 1 },
{ name: 'TaxAmount', value: 2 },
{ name: 'CopyNumber', value: 3 }
{name: 'PleaseSelect', value: 0},
{name: 'TotalAmount', value: 1},
{name: 'TaxAmount', value: 2},
{name: 'CopyNumber', value: 3}
]
},
{
......@@ -483,10 +482,10 @@
categoryOptions: [],
rateOptions: [],
amountTypeOptions: [
{ name: 'PleaseSelect', value: 0 },
{ name: 'TotalAmount', value: 1 },
{ name: 'TaxAmount', value: 2 },
{ name: 'CopyNumber', value: 3 }
{name: 'PleaseSelect', value: 0},
{name: 'TotalAmount', value: 1},
{name: 'TaxAmount', value: 2},
{name: 'CopyNumber', value: 3}
]
}
];
......@@ -496,7 +495,7 @@
// 选中某一发票类型级联更新税率与金额类型列表
var selectInvoiceOption = function (editModel, invoiceType, isInit) {
var selectedInvoice = _.where($scope.invoiceOptions, { value: invoiceType });
var selectedInvoice = _.where($scope.invoiceOptions, {value: invoiceType});
var op = selectedInvoice.length === 0 ? $scope.invoiceOptions[0] : selectedInvoice[0];
// 如果获取到的editModel.invoiceCategory为[ 99 ],代表发票类型全选;
......@@ -528,7 +527,7 @@
});
var choseAmoutType = isInit && editModel.invoiceAmountType && editModel.invoiceAmountType > 0 ?
_.where(op.amountTypeOptions, { value: editModel.invoiceAmountType })[0] : op.amountTypeOptions[0];
_.where(op.amountTypeOptions, {value: editModel.invoiceAmountType})[0] : op.amountTypeOptions[0];
editModel.chosenInvoiceOption = {
type: op.type,
......@@ -564,12 +563,12 @@
});
_spread = spread;
var activeSheet = _spread.getActiveSheet();
var activeSheet = _spread.getSheet(1);
//设置整个sheet不可编辑
activeSheet.setIsProtected(true);
activeSheet.protectionOption({
activeSheet.isProtected = true;
activeSheet.options.protectionOption = {
allowEditObjects: false
});
};
$scope.activeSheet = activeSheet;
......@@ -644,7 +643,7 @@
if (isHideContextMenu) {
hideSpreadContextMenu();
} else {
$contextMenu.css({ left: e.pageX, top: e.pageY });
$contextMenu.css({left: e.pageX, top: e.pageY});
$contextMenu.show();
$(document).on("click.contextmenu", function () {
......@@ -728,7 +727,7 @@
for (var i = 0; i < spans[k].rowCount; i++) {
for (var j = 0; j < spans[k].colCount; j++) {
if (i > 0 || j > 0) {
exceptedCells.push({ rowIndex: spans[k].row + i, columnIndex: spans[k].col + j });
exceptedCells.push({rowIndex: spans[k].row + i, columnIndex: spans[k].col + j});
}
}
}
......@@ -747,8 +746,8 @@
var col = startCol + j;
if (_.every(exceptedCells, function (c) {
return c.rowIndex !== row || c.columnIndex !== col;
})) {
validPosition.push({ rowIndex: row, columnIndex: col });
})) {
validPosition.push({rowIndex: row, columnIndex: col});
}
}
}
......@@ -761,20 +760,20 @@
var confirmWarningWindow = function (title, text) {
var deferred = $q.defer();
SweetAlert.swal({
title: title,
text: text,
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
allowOutsideClick: false,
confirmButtonText: $translate.instant('Confirm'),
cancelButtonText: $translate.instant('Cancel'),
closeOnConfirm: true,
closeOnCancel: true
},
function (isConfirm) {
deferred.resolve(isConfirm);
});
title: title,
text: text,
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
allowOutsideClick: false,
confirmButtonText: $translate.instant('Confirm'),
cancelButtonText: $translate.instant('Cancel'),
closeOnConfirm: true,
closeOnCancel: true
},
function (isConfirm) {
deferred.resolve(isConfirm);
});
return deferred.promise;
};
......@@ -803,7 +802,7 @@
selectInvoiceOption($scope.editModel, $scope.editModel.invoiceType, true);
// invoiceOption: Used to save invoice tax rate and amount type options temporarily
$scope.invoiceOption = _.findWhere($scope.invoiceOptions, { type: $scope.editModel.chosenInvoiceOption.type });
$scope.invoiceOption = _.findWhere($scope.invoiceOptions, {type: $scope.editModel.chosenInvoiceOption.type});
$scope.mentionApi.triggerValidator($scope.editModel.formula, $scope.editReportFormulaForm.formula);
$scope.mentionApiForValidation.triggerValidator($scope.editModel.validation, $scope.editReportFormulaForm.validation);
......@@ -865,10 +864,10 @@
}
},
columns: [
{ caption: $translate.instant('SubjectCodeCol'), dataField: 'code' },
{ caption: $translate.instant('SubjectNameCol'), dataField: 'name' },
{ caption: $translate.instant('SubjectDirectionCol'), dataField: 'directionName' },
{ caption: $translate.instant('SubjectTypeCol'), dataField: 'AcctPropName' },
{caption: $translate.instant('SubjectCodeCol'), dataField: 'code'},
{caption: $translate.instant('SubjectNameCol'), dataField: 'name'},
{caption: $translate.instant('SubjectDirectionCol'), dataField: 'directionName'},
{caption: $translate.instant('SubjectTypeCol'), dataField: 'AcctPropName'},
{
alignment: 'center',
width: '40px',
......@@ -921,12 +920,12 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasVoucher"/>');
}
},
columns: [
{ caption: $translate.instant('ModelCode'), dataField: 'code', visible: false },
{ caption: $translate.instant('ModelName'), dataField: 'name' },
{ caption: $translate.instant('ModelDescription'), dataField: 'description' },
{ caption: $translate.instant('ModelFeature'), dataField: 'featureName' },
{ caption: $translate.instant('ModelType'), dataField: 'modelTypeName' },
{ caption: $translate.instant('ModelOrganization'), dataField: 'organizationName' },
{caption: $translate.instant('ModelCode'), dataField: 'code', visible: false},
{caption: $translate.instant('ModelName'), dataField: 'name'},
{caption: $translate.instant('ModelDescription'), dataField: 'description'},
{caption: $translate.instant('ModelFeature'), dataField: 'featureName'},
{caption: $translate.instant('ModelType'), dataField: 'modelTypeName'},
{caption: $translate.instant('ModelOrganization'), dataField: 'organizationName'},
{
alignment: 'center',
width: '40px',
......@@ -1081,7 +1080,7 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>');
var operatorMatches = ngModelValue.match(notDuplicateOperatorExp);
if (_.any(operatorMatches, function (m) {
return m.length > 1;
})) {
})) {
ngModel.$setValidity('operatorDuplicateValidator', false);
return false;
}
......@@ -1151,7 +1150,7 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>');
$scope.editModel.formula = $.trim($scope.editModel.formula) + e.formula + '(' + e.param;
}
}
},
}
};
/*********************** End Formula Editor ***********************************/
......@@ -1262,7 +1261,7 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>');
var operatorMatches = ngModelValue.match(notDuplicateOperatorExp);
if (_.any(operatorMatches, function (m) {
return m.length > 1;
})) {
})) {
ngModel.$setValidity('operatorDuplicateValidator', false);
return false;
}
......@@ -1337,33 +1336,33 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>');
/*********************** End Formula Editor ***********************************/
//模板另存为
//模板另存为
var saveTemplateGroup = function () {
var groupName = $scope.groupName;
if (groupName === '' || groupName === undefined) {
SweetAlert.warning($translate.instant('InputTemplateGroupNameWarning'));
return;
}
$scope.newTemplateGroup.Name = groupName;
$scope.newTemplateGroup.ServiceTypeID = $scope.curServiceTypeId;
$scope.newTemplateGroup.CopyFrom = $scope.curTemplateGroup.id;
$scope.newTemplateGroup.groupType = $scope.curTemplateGroup.groupType;
$scope.newTemplateGroup.payTaxType = $scope.curTemplateGroup.payTaxType;
$scope.newTemplateGroup.industryIDs = $scope.curTemplateGroup.industryIDs;
$scope.newTemplateGroup.ChangedFormulas = $scope.formulasArrayTemp;
templateGroupService.addTemplateGroup($scope.newTemplateGroup).success(function (or) {
if (or && or.result) {
SweetAlert.success($translate.instant('TemplateGroupSaveAsSuccess'));
loadTemplateGroup();
$('#templateName').val('');
$('.templates-save-form').css('display', 'none');
} else {
SweetAlert.warning($translate.instant(or.resultMsg));
var groupName = $scope.groupName;
if (groupName === '' || groupName === undefined) {
SweetAlert.warning($translate.instant('InputTemplateGroupNameWarning'));
return;
}
});
};
$scope.newTemplateGroup.Name = groupName;
$scope.newTemplateGroup.ServiceTypeID = $scope.curServiceTypeId;
$scope.newTemplateGroup.CopyFrom = $scope.curTemplateGroup.id;
$scope.newTemplateGroup.groupType = $scope.curTemplateGroup.groupType;
$scope.newTemplateGroup.payTaxType = $scope.curTemplateGroup.payTaxType;
$scope.newTemplateGroup.industryIDs = $scope.curTemplateGroup.industryIDs;
$scope.newTemplateGroup.ChangedFormulas = $scope.formulasArrayTemp;
templateGroupService.addTemplateGroup($scope.newTemplateGroup).success(function (or) {
if (or && or.result) {
SweetAlert.success($translate.instant('TemplateGroupSaveAsSuccess'));
loadTemplateGroup();
$('#templateName').val('');
$('.templates-save-form').css('display', 'none');
} else {
SweetAlert.warning($translate.instant(or.resultMsg));
}
});
};
var loadTemplateMenu = function () {
......@@ -1411,21 +1410,21 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>');
// 如果发票类型全选,则将editModel.invoiceCategory设置为[ 99 ];
// 否则将选中的发票类型存入editModel.invoiceCategory数组,如[1, 2, 3]
if ($scope.editModel.chosenInvoiceOption.categoryOptions.length > 0 &&
_.every($scope.editModel.chosenInvoiceOption.categoryOptions, { ticked: true })) {
_.every($scope.editModel.chosenInvoiceOption.categoryOptions, {ticked: true})) {
$scope.editModel.invoiceCategory = [Number(constant.selectAllValue)];
} else {
$scope.editModel.invoiceCategory = _.chain($scope.editModel.chosenInvoiceOption.categoryOptions)
.where({ ticked: true }).pluck('value').value();
.where({ticked: true}).pluck('value').value();
}
// 如果税率全选,则将editModel.taxRate设置为[ '99' ];
// 否则将选中的税率存入editModel.taxRate数组,如['17%', '11%', '6%']
if ($scope.editModel.chosenInvoiceOption.rateOptions.length > 0 &&
_.every($scope.editModel.chosenInvoiceOption.rateOptions, { ticked: true })) {
_.every($scope.editModel.chosenInvoiceOption.rateOptions, {ticked: true})) {
$scope.editModel.taxRate = [constant.selectAllValue];
} else {
$scope.editModel.taxRate = _.chain($scope.editModel.chosenInvoiceOption.rateOptions)
.where({ ticked: true }).pluck('value').value();
.where({ticked: true}).pluck('value').value();
}
$scope.editModel.invoiceType = $scope.editModel.chosenInvoiceOption.value;
......@@ -1549,17 +1548,17 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>');
var groupedParamList = _.groupBy(result[2].data.data, 'formulaID');
var paramList = result[1].data.data;
_.each(groupedParamList, function (val, key) {
var formula = _.findWhere(formulaList, { id: key });
var formula = _.findWhere(formulaList, {id: key});
if (formula) {
formula.params = _.chain(val)
.map(function (p) {
return { id: p.formulaParamID, index: p.paramIndex };
return {id: p.formulaParamID, index: p.paramIndex};
})
.sortBy(function (p) {
return p.index;
}).value();
_.each(formula.params, function (p, idx) {
var param = _.findWhere(paramList, { id: p.id });
var param = _.findWhere(paramList, {id: p.id});
_.extend(p, param);
});
}
......@@ -1578,14 +1577,14 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>');
var modelTypes = _.invert(enums.modelType);
_.each(data, function (m) {
if (m.type.toString() === modelTypes.SystemCommonModel) {
if (!_.some(rtn, { id: m.id })) {
if (!_.some(rtn, {id: m.id})) {
m.orgID = null;
m.organizationName = $translate.instant('All');
m.featureName = $translate.instant(enums.modelFeature[m.feature]);
rtn.push(m);
}
} else {
var existsModel = _.findWhere(rtn, { id: m.id });
var existsModel = _.findWhere(rtn, {id: m.id});
if (!existsModel) {
m.featureName = $translate.instant(enums.modelFeature[m.feature]);
rtn.push(m);
......@@ -1691,8 +1690,8 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>');
newValue.value <= 0 ||
newValue.invoiceAmountType.value <= 0 ||
newValue.value !== 3 &&
(_.every(newValue.categoryOptions, { ticked: false }) ||
_.every(newValue.rateOptions, { ticked: false })))) {
(_.every(newValue.categoryOptions, {ticked: false}) ||
_.every(newValue.rateOptions, {ticked: false})))) {
$scope.editReportFormulaForm.invoice.$setValidity('invoiceNotSelectValidator', false);
} else {
$scope.editReportFormulaForm.invoice.$setValidity('invoiceNotSelectValidator', true);
......@@ -1706,8 +1705,8 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>');
$scope.editModel.chosenInvoiceOption.value <= 0 ||
$scope.editModel.chosenInvoiceOption.invoiceAmountType.value <= 0 ||
$scope.editModel.chosenInvoiceOption.value !== 3 &&
(_.every($scope.editModel.chosenInvoiceOption.rateOptions, { ticked: false }) ||
_.every($scope.editModel.chosenInvoiceOption.categoryOptions, { ticked: false }))) {
(_.every($scope.editModel.chosenInvoiceOption.rateOptions, {ticked: false}) ||
_.every($scope.editModel.chosenInvoiceOption.categoryOptions, {ticked: false}))) {
$scope.editReportFormulaForm.invoice.$setValidity('invoiceNotSelectValidator', false);
}
});
......@@ -2064,7 +2063,8 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>');
$('#' + dxControl.templateDropDownId).dxDropDownBox({
value: selectName,
showClearButton: false,
onContentReady: function (args) { },
onContentReady: function (args) {
},
contentTemplate: function (e) {
// thisData.DropDownEvent = e;
var value = e.component.option("value");
......@@ -2104,7 +2104,7 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>');
$scope.selectFormula = null;
$scope.cancelHide = false;
$scope.firedName = '';
$scope.firedType === '0';
$scope.firedType = '0';
$scope.firedParams = '';
$scope.editFormula = '';
$scope.editParams = '';
......@@ -2113,7 +2113,7 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>');
$scope.selectFormulaForValidation = null;
$scope.cancelHideForValidation = false;
$scope.firedValidationName = '';
$scope.firedValidationType === '0';
$scope.firedValidationType = '0';
$scope.firedValidationParams = '';
$scope.editFormulaForValidation = '';
$scope.editParamsForValidation = '';
......@@ -2165,10 +2165,10 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>');
});
var tabs = [
{ id: 0, text: $translate.instant('AutoCalculateTab') },
{ id: 1, text: $translate.instant('ManualInputTab') },
{ id: 2, text: $translate.instant('ModelTab') },
{ id: 3, text: $translate.instant('ValidationTab') }
{id: 0, text: $translate.instant('AutoCalculateTab')},
{id: 1, text: $translate.instant('ManualInputTab')},
{id: 2, text: $translate.instant('ModelTab')},
{id: 3, text: $translate.instant('ValidationTab')}
];
$scope.tabOptions = {
dataSource: tabs,
......
......@@ -5,32 +5,38 @@
</div>
<div class="menu-dropdown">
<div class="dropdown">
<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true"
aria-expanded="true">
{{curServiceTypeName}}
<span class="caret"></span>
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
<li ng-repeat="s in getServiceTypeList()"><a href="#" ng-click="toggleServiceType(s)">{{s.name}}</a></li>
<li ng-repeat="s in getServiceTypeList()">
<a href="#" ng-click="toggleServiceType(s)">{{s.name}}</a>
</li>
</ul>
</div>
</div>
<div class="menu-log">
<button class="btn btn-not-important log-btn" ng-click="showOperateLogPop()"><i class="material-icons">description</i><span translate="log"></span></button>
<button class="btn btn-not-important log-btn" ng-click="showOperateLogPop()">
<i class="material-icons">description</i>
<span translate="log"></span>
</button>
</div>
</div>
<div class="tab-content-container">
<div class="templates-top">
<div class="form-group">
<span class="tab-content-select-lable" ng-show="curServiceTypeId !=='12'">{{'IndustryColon' | translate}}</span>
<div id="dx-select-industry" class="tab-content-select industry col-md-2" ng-show="curServiceTypeId !=='12'"
dx-select-box="dataSourceIndustryList" dx-item-alias="itemObj">
<div id="dx-select-industry" class="tab-content-select industry col-md-2" ng-show="curServiceTypeId !=='12'" dx-select-box="dataSourceIndustryList"
dx-item-alias="itemObj">
<div data-options="dxTemplate: { name: 'industryItem' }" class="dx-item-content dx-list-item-content" title="{{itemObj.name}}">
{{itemObj.name}}
</div>
</div>
<span class="tab-content-select-lable" translate="ReportType" ng-show="curServiceTypeId === '2'"></span>
<div class="tab-content-select reportType col-md-2" id="dx-select-pay-tax-type" ng-show="curServiceTypeId === '2'"
dx-select-box="dataSourcePayTaxTypeList" dx-item-alias="itemObj">
<div class="tab-content-select reportType col-md-2" id="dx-select-pay-tax-type" ng-show="curServiceTypeId === '2'" dx-select-box="dataSourcePayTaxTypeList"
dx-item-alias="itemObj">
<div data-options="dxTemplate: { name: 'filingTypeItem' }" class="dx-item-content dx-list-item-content" title="{{itemObj.name}}">
{{itemObj.name}}
</div>
......@@ -40,14 +46,15 @@
</div>
<span class="tab-content-select-lable" translate="ReportType" ng-show="curServiceTypeId === '6' || curServiceTypeId === '11' || curServiceTypeId === '99'"></span>
<div class="tab-content-select reportType col-md-2" id="dx-select-report-type" ng-show="curServiceTypeId === '6' || curServiceTypeId === '11' || curServiceTypeId === '99'"
dx-select-box="detailReportTypeList" dx-item-alias="itemObj">
dx-select-box="detailReportTypeList" dx-item-alias="itemObj">
<div data-options="dxTemplate: { name: 'reportTypeItem' }" class="dx-item-content dx-list-item-content" title="{{itemObj.name}}">
{{itemObj.name}}
</div>
</div>
<span class="tab-content-select-lable" translate="SelectReport"></span>
<div class="tab-content-select selectReport col-md-2" id="dx-select-template"></div>
<button id="btnSaveAs" class="btn btn-third" atms-permission permission-control-type="ngIf" permission-code="{{$root.adminPermission.systemConfiguration.declarationFormConfiguration.addCode}}" translate="TemplateGroupSaveAs" ng-click="toggleSaveAs();"></button>&nbsp;&nbsp;&nbsp;&nbsp;
<button id="btnSaveAs" class="btn btn-third" atms-permission permission-control-type="ngIf" permission-code="{{$root.adminPermission.systemConfiguration.declarationFormConfiguration.addCode}}"
translate="TemplateGroupSaveAs" ng-click="toggleSaveAs();"></button>&nbsp;&nbsp;&nbsp;&nbsp;
<span export-button="" style="float: right; margin-right: 0px; margin-top: 7px"></span>
</div>
<!--<select ng-model="curTemplate" ng-options="(t.name+ '_' + t.code) for t in templates" ng-change="loadSheet(curTemplate)"></select>-->
......@@ -69,7 +76,9 @@
</div>-->
<div id="report-view" class="right spread-div"></div>
<ul id="spreadContextMenu" class="dropdown-menu" role="menu" style="display: none">
<li><a class="localize" data-action="applyRowColName">{{'ApplyRowColName' | translate}}</a></li>
<li>
<a class="localize" data-action="applyRowColName">{{'ApplyRowColName' | translate}}</a>
</li>
</ul>
</div>
......@@ -87,185 +96,183 @@
</span>
</div>
<div id="editReportFormulaContent">
<div class="modal-header editReportFormulaPop-modal-header">
<div class="modal-title" id="editReportFormulaTitle">
<span>{{'ReportConfigurationEdit' | translate }}-</span>
<span class="title-info">{{'Cell' | translate}}:{{editModel.cell}}</span>
<span class="title-separator">|</span>
<div class="modal-header editReportFormulaPop-modal-header">
<div class="modal-title" id="editReportFormulaTitle">
<span>{{'ReportConfigurationEdit' | translate }}-</span>
<span class="title-info">{{'Cell' | translate}}:{{editModel.cell}}</span>
<span class="title-separator">|</span>
<span class="title-info">
{{'CellRowName' | translate}}:
<input type="text" class="edit-input form-control" ng-if="!editModel.isSystemType" ng-model="editModel.rowName">
<span ng-if="editModel.isSystemType">{{editModel.rowName}}</span>
</span>
<span class="title-separator">|</span>
</span>
<span class="title-separator">|</span>
<span class="title-info">
{{'CellColumnName' | translate}}:
<input type="text" ng-if="!editModel.isSystemType" class="edit-input form-control" ng-model="editModel.columnName" />
<span ng-if="editModel.isSystemType">{{editModel.columnName}}</span>
</span>
</div>
</span>
</div>
<div class="modal-body editReportFormulaPop-modal-body">
<form class="form-horizontal" id="editReportFormulaForm" name="editReportFormulaForm" novalidate="novalidate" style="padding-left:35px;">
<div dx-tabs="tabOptions"></div>
<div class="form-group formula-group" ng-show="selectedTab === 0">
<label class="checkbox-inline bold" ng-class="{ 'disabled': !hasEditPermission || !ToggleSaveAs }">
<input type="checkbox" ng-model="editModel.hasFormula" ng-disabled="!hasEditPermission || !ToggleSaveAs">{{'FormulaConfig' | translate}}
</label>
<div ng-messages="editReportFormulaForm.formula.$error" class="has-error label bold">
<span ng-message="requiredValidator">{{'RequiredValidator' | translate}}</span>
<span ng-message="keyValueNotEmptyValidator">{{'KeyValueNotEmptyValidator' | translate}}</span>
<span ng-message="keyValueSeparatorValidator">{{'KeyValueSeparatorValidator' | translate}}</span>
<span ng-message="operatorDuplicateValidator">{{'OperatorDuplicateValidator' | translate}}</span>
<span ng-message="missingExpressionValidator">{{'MissingExpressionValidator' | translate}}</span>
<span ng-message="missingOperatorValidator">{{'MissingOperatorValidator' | translate}}</span>
<span ng-message="formulaFormatValidator">{{'FormulaFormatValidator' | translate}}</span>
</div>
<mention-input class="inputer" input-class="form-control" input-id="formula" mention-list="mentionList" display-mode="'textarea'"
formula-list="formulaList" show-name="true" mention-api="mentionApi" input-readonly="!hasEditPermission || !ToggleSaveAs || !editModel.hasFormula"
ng-model="editModel.formula" fired-name="firedName" fired-tag-type="firedType" fired-formula-params="firedParams" double-click="editFormulaParamOrKeyValue($event)"
include-btn="true" btn-click="showSelectKeyValuePop()" btn2-click="showSelectFormulaPop()" custom-validator="mentionMenuValidator(value, ngModel)"
input-focus="cancelHideTranslator($event)" input-blur="timerHideTranslator();asyncFormulaValidate();"></mention-input>
<formula-translator formula-list="formulaList" account-data-source="accountDataSource" formula-name="firedName" formula-params="firedParams" hide-mode="'notVisible'"
translator-focus="cancelHideTranslator()" translator-blur="timerHideTranslator();"></formula-translator>
</div>
<div class="modal-body editReportFormulaPop-modal-body">
<form class="form-horizontal" id="editReportFormulaForm" name="editReportFormulaForm" novalidate="novalidate" style="padding-left:35px;">
<div dx-tabs="tabOptions"></div>
<div class="form-group formula-group" ng-show="selectedTab === 0">
<label class="checkbox-inline bold" ng-class="{ 'disabled': !hasEditPermission || !ToggleSaveAs }">
<input type="checkbox" ng-model="editModel.hasFormula" ng-disabled="!hasEditPermission || !ToggleSaveAs">{{'FormulaConfig' | translate}}
</label>
<div ng-messages="editReportFormulaForm.formula.$error" class="has-error label bold">
<span ng-message="requiredValidator">{{'RequiredValidator' | translate}}</span>
<span ng-message="keyValueNotEmptyValidator">{{'KeyValueNotEmptyValidator' | translate}}</span>
<span ng-message="keyValueSeparatorValidator">{{'KeyValueSeparatorValidator' | translate}}</span>
<span ng-message="operatorDuplicateValidator">{{'OperatorDuplicateValidator' | translate}}</span>
<span ng-message="missingExpressionValidator">{{'MissingExpressionValidator' | translate}}</span>
<span ng-message="missingOperatorValidator">{{'MissingOperatorValidator' | translate}}</span>
<span ng-message="formulaFormatValidator">{{'FormulaFormatValidator' | translate}}</span>
</div>
<div class="form-group row-instructions" ng-show="selectedTab === 0">
<label class="bold">{{'FillingInstructions' | translate}}:</label>
<textarea class="form-control" ng-model="editModel.formulaDescription" ng-readonly="!hasEditPermission || !ToggleSaveAs"></textarea>
<mention-input class="inputer" input-class="form-control" input-id="formula" mention-list="mentionList" display-mode="'textarea'"
formula-list="formulaList" show-name="true" mention-api="mentionApi" input-readonly="!hasEditPermission || !ToggleSaveAs || !editModel.hasFormula"
ng-model="editModel.formula" fired-name="firedName" fired-tag-type="firedType" fired-formula-params="firedParams"
double-click="editFormulaParamOrKeyValue($event)" include-btn="true" btn-click="showSelectKeyValuePop()"
btn2-click="showSelectFormulaPop()" custom-validator="mentionMenuValidator(value, ngModel)" input-focus="cancelHideTranslator($event)"
input-blur="timerHideTranslator();asyncFormulaValidate();"></mention-input>
<formula-translator formula-list="formulaList" account-data-source="accountDataSource" formula-name="firedName" formula-params="firedParams"
hide-mode="'notVisible'" translator-focus="cancelHideTranslator()" translator-blur="timerHideTranslator();"></formula-translator>
</div>
<div class="form-group row-instructions" ng-show="selectedTab === 0">
<label class="bold">{{'FillingInstructions' | translate}}:</label>
<textarea class="form-control" ng-model="editModel.formulaDescription" ng-readonly="!hasEditPermission || !ToggleSaveAs"></textarea>
</div>
<div class="form-group voucher-group" ng-show="selectedTab === 1">
<label class="checkbox-inline bold" ng-class="{ 'disabled': !hasEditPermission || !ToggleSaveAs }">
<input type="checkbox" name="voucher" ng-model="editModel.hasVoucher" ng-disabled="!hasEditPermission || !ToggleSaveAs">{{'VoucherFilter' | translate}}
</label>
<div ng-messages="editReportFormulaForm.voucher.$error" class="has-error label bold">
<span ng-message="voucherNotSelectValidator">{{'VoucherNotSelectValidator' | translate}}</span>
</div>
<div class="form-group voucher-group" ng-show="selectedTab === 1">
<label class="checkbox-inline bold" ng-class="{ 'disabled': !hasEditPermission || !ToggleSaveAs }">
<input type="checkbox" name="voucher" ng-model="editModel.hasVoucher"
ng-disabled="!hasEditPermission || !ToggleSaveAs">{{'VoucherFilter' | translate}}
<div>
<label class="radio-inline" ng-disabled="!hasEditPermission || !ToggleSaveAs || !editModel.hasVoucher">
<input type="radio" name="voucherFilterTypes" ng-value="0" ng-model="voucherFilterType" ng-disabled="!hasEditPermission || !ToggleSaveAs || !editModel.hasVoucher"> {{'Account' | translate}}
</label>
<div ng-messages="editReportFormulaForm.voucher.$error" class="has-error label bold">
<span ng-message="voucherNotSelectValidator">{{'VoucherNotSelectValidator' | translate}}</span>
</div>
<div>
<label class="radio-inline" ng-disabled="!hasEditPermission || !ToggleSaveAs || !editModel.hasVoucher">
<input type="radio" name="voucherFilterTypes" ng-value="0" ng-model="voucherFilterType"
ng-disabled="!hasEditPermission || !ToggleSaveAs || !editModel.hasVoucher"> {{'Account' | translate}}
</label>
<label class="radio-inline" ng-disabled="!hasEditPermission || !ToggleSaveAs || !editModel.hasVoucher">
<input type="radio" name="voucherFilterTypes" ng-value="1" ng-model="voucherFilterType"
ng-disabled="!hasEditPermission || !ToggleSaveAs || !editModel.hasVoucher"> {{'SummaryKeyword' | translate}}
</label>
</div>
<div class="options-row">
<button type="button" class="btn btn-edit" ng-show="voucherFilterType === 0"
ng-disabled="!hasEditPermission || !ToggleSaveAs || !editModel.hasVoucher"
data-toggle="modal" ng-click="showSelectAccountPop()">
<i class="material-icons" aria-hidden="true">add_circle_outline</i>{{'Add' | translate}}
</button>
<input type="text" class="form-control input-summary" ng-show="voucherFilterType === 1"
ng-readonly="!hasEditPermission || !ToggleSaveAs || !editModel.hasVoucher"
ng-model="editModel.voucherKeyword"
placeholder="{{'InputSummaryKeyword' | translate}}">
</div>
</div>
<div class="dx-viewport grid-container" ng-show="selectedTab === 1 && voucherFilterType === 0"
ng-class="{ 'row1': selectedAccount.length <= 1, 'row2': selectedAccount.length === 2, 'row3': selectedAccount.length >= 3 }">
<div id="voucherGrid" dx-data-grid="voucherGridOptions"></div>
</div>
<div class="checkbox" ng-show="selectedTab === 1"
ng-class="{ 'disabled': !hasEditPermission || !ToggleSaveAs }">
<label class="bold">
<input type="checkbox" name="invoice" ng-model="editModel.hasInvoice"
ng-disabled="!hasEditPermission || !ToggleSaveAs">{{'InvoiceFilter' | translate}}
<label class="radio-inline" ng-disabled="!hasEditPermission || !ToggleSaveAs || !editModel.hasVoucher">
<input type="radio" name="voucherFilterTypes" ng-value="1" ng-model="voucherFilterType" ng-disabled="!hasEditPermission || !ToggleSaveAs || !editModel.hasVoucher"> {{'SummaryKeyword' | translate}}
</label>
<span ng-messages="editReportFormulaForm.invoice.$error" class="has-error label bold">
<span ng-message="invoiceNotSelectValidator">{{'InvoiceNotSelectValidator' | translate}}</span>
</span>
</div>
<div class="form-group invoice-group" ng-show="selectedTab === 1">
<div class="select-invoice-amount-type" id="dx-invoice-type-select" data-ng-model="invoiceOption" dx-select-box="dataSourceInvoice"></div>
<span isteven-multi-select ng-if="!(!editModel.chosenInvoiceOption.categoryOptions || editModel.chosenInvoiceOption.categoryOptions.length === 0)"
input-model="editModel.chosenInvoiceOption.categoryOptions" output-model="selectedCategoryOptions" tick-property="ticked" button-label="key"
item-label="key" max-labels="1" helper-elements="all none" translation="langSetting" is-disabled="!hasEditPermission || !ToggleSaveAs || !editModel.hasInvoice"
on-item-click="refreshCategorySelect(data)" class="invoice-category-select"></span>
<span isteven-multi-select ng-hide="!(!editModel.chosenInvoiceOption.rateOptions || editModel.chosenInvoiceOption.rateOptions.length === 0)"
input-model="editModel.chosenInvoiceOption.rateOptions" output-model="selectedRateOptions" tick-property="ticked" button-label="key"
item-label="key" max-labels="2" helper-elements="all none" translation="langSetting" is-disabled="!hasEditPermission || !ToggleSaveAs || !editModel.hasInvoice"
on-item-click="refreshTaxRateSelect(data)" class="tax-rate-select"></span>
<div class="select-invoice-amount-type" data-ng-model="editModel.chosenInvoiceOption.invoiceAmountType" dx-select-box="dataSourceInvoiceAmount"></div>
<div class="options-row">
<button type="button" class="btn btn-edit" ng-show="voucherFilterType === 0" ng-disabled="!hasEditPermission || !ToggleSaveAs || !editModel.hasVoucher"
data-toggle="modal" ng-click="showSelectAccountPop()">
<i class="material-icons" aria-hidden="true">add_circle_outline</i>{{'Add' | translate}}
</button>
<input type="text" class="form-control input-summary" ng-show="voucherFilterType === 1" ng-readonly="!hasEditPermission || !ToggleSaveAs || !editModel.hasVoucher"
ng-model="editModel.voucherKeyword" placeholder="{{'InputSummaryKeyword' | translate}}">
</div>
<div class="checkbox" ng-show="selectedTab === 1"
ng-class="{ 'disabled': !hasEditPermission || !ToggleSaveAs }">
<label class="bold">
<input type="checkbox" ng-model="editModel.hasKeyIn" ng-disabled="!hasEditPermission || !ToggleSaveAs">{{'ManualInput' | translate}}
</label>
</div>
<div class="dx-viewport grid-container" ng-show="selectedTab === 1 && voucherFilterType === 0" ng-class="{ 'row1': selectedAccount.length <= 1, 'row2': selectedAccount.length === 2, 'row3': selectedAccount.length >= 3 }">
<div id="voucherGrid" dx-data-grid="voucherGridOptions"></div>
</div>
<div class="checkbox" ng-show="selectedTab === 1" ng-class="{ 'disabled': !hasEditPermission || !ToggleSaveAs }">
<label class="bold">
<input type="checkbox" name="invoice" ng-model="editModel.hasInvoice" ng-disabled="!hasEditPermission || !ToggleSaveAs">{{'InvoiceFilter' | translate}}
</label>
<span ng-messages="editReportFormulaForm.invoice.$error" class="has-error label bold">
<span ng-message="invoiceNotSelectValidator">{{'InvoiceNotSelectValidator' | translate}}</span>
</span>
</div>
<div class="form-group invoice-group" ng-show="selectedTab === 1">
<div class="select-invoice-amount-type" id="dx-invoice-type-select" data-ng-model="invoiceOption" dx-select-box="dataSourceInvoice"></div>
<span isteven-multi-select ng-if="!(!editModel.chosenInvoiceOption.categoryOptions || editModel.chosenInvoiceOption.categoryOptions.length === 0)"
input-model="editModel.chosenInvoiceOption.categoryOptions" output-model="selectedCategoryOptions"
tick-property="ticked" button-label="key" item-label="key" max-labels="1" helper-elements="all none"
translation="langSetting" is-disabled="!hasEditPermission || !ToggleSaveAs || !editModel.hasInvoice"
on-item-click="refreshCategorySelect(data)" class="invoice-category-select"></span>
<span isteven-multi-select ng-hide="!(!editModel.chosenInvoiceOption.rateOptions || editModel.chosenInvoiceOption.rateOptions.length === 0)"
input-model="editModel.chosenInvoiceOption.rateOptions" output-model="selectedRateOptions" tick-property="ticked"
button-label="key" item-label="key" max-labels="2" helper-elements="all none" translation="langSetting"
is-disabled="!hasEditPermission || !ToggleSaveAs || !editModel.hasInvoice" on-item-click="refreshTaxRateSelect(data)"
class="tax-rate-select"></span>
<div class="select-invoice-amount-type" data-ng-model="editModel.chosenInvoiceOption.invoiceAmountType" dx-select-box="dataSourceInvoiceAmount"></div>
</div>
<div class="checkbox" ng-show="selectedTab === 1" ng-class="{ 'disabled': !hasEditPermission || !ToggleSaveAs }">
<label class="bold">
<input type="checkbox" ng-model="editModel.hasKeyIn" ng-disabled="!hasEditPermission || !ToggleSaveAs">{{'ManualInput' | translate}}
</label>
</div>
<div class="form-group model-group" ng-show="selectedTab === 2">
<label class="checkbox-inline bold" ng-class="{ 'disabled': !hasEditPermission || !ToggleSaveAs }">
<input type="checkbox" name="model" ng-model="editModel.hasModel" ng-disabled="!hasEditPermission || !ToggleSaveAs">{{'LinkModel' | translate}}
</label>
<div ng-messages="editReportFormulaForm.model.$error" class="has-error label bold">
<span ng-message="modelNotSelectValidator">{{'ModelNotSelectValidator' | translate}}</span>
</div>
<div class="form-group model-group" ng-show="selectedTab === 2">
<label class="checkbox-inline bold" ng-class="{ 'disabled': !hasEditPermission || !ToggleSaveAs }">
<input type="checkbox" name="model" ng-model="editModel.hasModel" ng-disabled="!hasEditPermission || !ToggleSaveAs">{{'LinkModel' | translate}}
</label>
<div ng-messages="editReportFormulaForm.model.$error" class="has-error label bold">
<span ng-message="modelNotSelectValidator">{{'ModelNotSelectValidator' | translate}}</span>
</div>
<div class="options-row">
<button type="button" class="btn btn-edit" ng-disabled="!hasEditPermission || !ToggleSaveAs || !editModel.hasModel" data-toggle="modal" ng-click="showSelectModelPop()">
<i class="material-icons" aria-hidden="true">add_circle_outline</i>{{'Add' | translate}}
</button>
</div>
<div class="options-row">
<button type="button" class="btn btn-edit" ng-disabled="!hasEditPermission || !ToggleSaveAs || !editModel.hasModel" data-toggle="modal"
ng-click="showSelectModelPop()">
<i class="material-icons" aria-hidden="true">add_circle_outline</i>{{'Add' | translate}}
</button>
</div>
<div class="dx-viewport grid-container last-grid" ng-show="selectedTab === 2"
ng-class="{ 'row1': selectedModel.length <= 1, 'row2': selectedModel.length === 2,
</div>
<div class="dx-viewport grid-container last-grid" ng-show="selectedTab === 2" ng-class="{ 'row1': selectedModel.length <= 1, 'row2': selectedModel.length === 2,
'row3': selectedModel.length === 3,
'row4': selectedModel.length === 4,
'row5': selectedModel.length === 5,
'row6': selectedModel.length >= 6,
}">
<div id="modelGrid" dx-data-grid="modelGridOptions"></div>
<div id="modelGrid" dx-data-grid="modelGridOptions"></div>
</div>
<div class="form-group validation-group" ng-show="selectedTab === 3">
<label class="checkbox-inline bold" ng-class="{ 'disabled': !hasEditPermission || !ToggleSaveAs }">
<input type="checkbox" ng-model="editModel.hasValidation" ng-disabled="!hasEditPermission || !ToggleSaveAs">{{'ValidationConfig' | translate}}
</label>
<div ng-messages="editReportFormulaForm.validation.$error" class="has-error label bold">
<span ng-message="requiredValidator">{{'RequiredValidator' | translate}}</span>
<span ng-message="keyValueNotEmptyValidator">{{'KeyValueNotEmptyValidator' | translate}}</span>
<span ng-message="keyValueSeparatorValidator">{{'KeyValueSeparatorValidator' | translate}}</span>
<span ng-message="operatorDuplicateValidator">{{'OperatorDuplicateValidator' | translate}}</span>
<span ng-message="missingExpressionValidator">{{'MissingExpressionValidator' | translate}}</span>
<span ng-message="missingOperatorValidator">{{'MissingOperatorValidator' | translate}}</span>
<span ng-message="formulaFormatValidator">{{'FormulaFormatValidator' | translate}}</span>
</div>
<div class="form-group validation-group" ng-show="selectedTab === 3">
<label class="checkbox-inline bold" ng-class="{ 'disabled': !hasEditPermission || !ToggleSaveAs }">
<input type="checkbox" ng-model="editModel.hasValidation" ng-disabled="!hasEditPermission || !ToggleSaveAs">{{'ValidationConfig' | translate}}
</label>
<div ng-messages="editReportFormulaForm.validation.$error" class="has-error label bold">
<span ng-message="requiredValidator">{{'RequiredValidator' | translate}}</span>
<span ng-message="keyValueNotEmptyValidator">{{'KeyValueNotEmptyValidator' | translate}}</span>
<span ng-message="keyValueSeparatorValidator">{{'KeyValueSeparatorValidator' | translate}}</span>
<span ng-message="operatorDuplicateValidator">{{'OperatorDuplicateValidator' | translate}}</span>
<span ng-message="missingExpressionValidator">{{'MissingExpressionValidator' | translate}}</span>
<span ng-message="missingOperatorValidator">{{'MissingOperatorValidator' | translate}}</span>
<span ng-message="formulaFormatValidator">{{'FormulaFormatValidator' | translate}}</span>
</div>
<mention-input class="inputer" input-class="form-control" input-id="validation" mention-list="mentionList" display-mode="'textarea'"
formula-list="formulaList" show-name="true" mention-api="mentionApiForValidation" input-readonly="!hasEditPermission || !ToggleSaveAs || !editModel.hasValidation"
ng-model="editModel.validation" fired-name="firedValidationName" fired-tag-type="firedValidationType" fired-formula-params="firedValidationParams" double-click="editFormulaParamOrKeyValueForValidation($event)"
include-btn="true" btn-click="showSelectKeyValuePopForValidation()" btn2-click="showSelectFormulaPopForValidation()" custom-validator="mentionMenuValidatorForValidation(value, ngModel)"
input-focus="cancelHideTranslatorForValidation($event)" input-blur="timerHideTranslatorForValidation();asyncFormulaValidateForValidation();"></mention-input>
<formula-translator formula-list="formulaList" account-data-source="accountDataSource" formula-name="firedValidationName" formula-params="firedValidationParams" hide-mode="'notVisible'"
translator-focus="cancelHideTranslatorForValidation()" translator-blur="timerHideTranslatorForValidation();"></formula-translator>
<mention-input class="inputer" input-class="form-control" input-id="validation" mention-list="mentionList" display-mode="'textarea'"
formula-list="formulaList" show-name="true" mention-api="mentionApiForValidation" input-readonly="!hasEditPermission || !ToggleSaveAs || !editModel.hasValidation"
ng-model="editModel.validation" fired-name="firedValidationName" fired-tag-type="firedValidationType"
fired-formula-params="firedValidationParams" double-click="editFormulaParamOrKeyValueForValidation($event)"
include-btn="true" btn-click="showSelectKeyValuePopForValidation()" btn2-click="showSelectFormulaPopForValidation()"
custom-validator="mentionMenuValidatorForValidation(value, ngModel)" input-focus="cancelHideTranslatorForValidation($event)"
input-blur="timerHideTranslatorForValidation();asyncFormulaValidateForValidation();"></mention-input>
<formula-translator formula-list="formulaList" account-data-source="accountDataSource" formula-name="firedValidationName"
formula-params="firedValidationParams" hide-mode="'notVisible'" translator-focus="cancelHideTranslatorForValidation()"
translator-blur="timerHideTranslatorForValidation();"></formula-translator>
</div>
<div class="form-group validation-instructions" ng-show="selectedTab === 3">
<label class="bold">{{'ValidationInstructions' | translate}}:</label>
<textarea class="form-control" ng-model="editModel.validationDescription" ng-readonly="!hasEditPermission || !ToggleSaveAs"></textarea>
</div>
<div ng-show="selectedTab === 3 && hasEditPermission && ToggleSaveAs" class="flex-row-start-center" style="margin: 15px 0 15px -15px;">
<span>{{'IsInputNecessary' | translate}}:</span>
<div class="btn-group switch-group" data-toggle="buttons">
<label class="btn btn-primary" ng-class="{'active':editModel.hasFormula}" ng-click="editModel.hasFormula=true;">
<input type="radio" autocomplete="off" />{{'on'|translate}}
</label>
<label class="btn btn-primary" ng-class="{'active':!editModel.hasFormula}" ng-click="editModel.hasFormula=false;">
<input type="radio" autocomplete="off" />{{'off'|translate}}
</label>
</div>
<div class="form-group validation-instructions" ng-show="selectedTab === 3">
<label class="bold">{{'ValidationInstructions' | translate}}:</label>
<textarea class="form-control" ng-model="editModel.validationDescription" ng-readonly="!hasEditPermission || !ToggleSaveAs"></textarea>
</div>
<div ng-show="selectedTab === 3 && hasEditPermission && ToggleSaveAs" class="flex-row-start-center" style="margin: 15px 0 15px -15px;">
<span>{{'IsInputNecessary' | translate}}:</span>
<div class="btn-group switch-group" data-toggle="buttons">
<label class="btn btn-primary" ng-class="{'active':editModel.hasFormula}" ng-click="editModel.hasFormula=true;">
<input type="radio" autocomplete="off" />{{'on'|translate}}
</label>
<label class="btn btn-primary" ng-class="{'active':!editModel.hasFormula}" ng-click="editModel.hasFormula=false;">
<input type="radio" autocomplete="off" />{{'off'|translate}}
</label>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" ng-disabled="hasError()" ng-show="hasEditPermission && ToggleSaveAs" ng-click="saveFormulaToTemp()">
{{'Confirm' | translate }}
</button>
<button type="button" class="btn btn-third" ng-show="hasEditPermission && ToggleSaveAs" ng-click="hidePanel();">{{'Cancel' | translate }}</button>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" ng-disabled="hasError()" ng-show="hasEditPermission && ToggleSaveAs" ng-click="saveFormulaToTemp()">
{{'Confirm' | translate }}
</button>
<button type="button" class="btn btn-third" ng-show="hasEditPermission && ToggleSaveAs" ng-click="hidePanel();">{{'Cancel' | translate }}
</button>
</div>
</div>
</div>
<div class="modal fade" id="selectFormulaPop" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" data-backdrop="static" data-keyboard="false">
<div class="modal fade" id="selectFormulaPop" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" data-backdrop="static"
data-keyboard="false">
<div class="modal-dialog" style="width:570px;" role="grid">
<div class="modal-content">
<div class="modal-body">
......@@ -275,22 +282,28 @@
</div>
</div>
</div>
<account-multi-selector is-show="isShowAccounts" account-data-source="accountDataSource" selector-api="accountSelectorApi" data-title="accountTitle" selected-account-codes="editModel.accountCodes" selector-options="accountSelectorOptions"></account-multi-selector>
<model-multi-selector is-show="isShowModels" model-data-source="modelDataSource" selector-api="modelSelectorApi" data-title="modelTitle" selected-model-ids="editModel.modelIDs" selector-options="modelSelectorOptions"></model-multi-selector>
<account-multi-selector is-show="isShowAccounts" account-data-source="accountDataSource" selector-api="accountSelectorApi"
data-title="accountTitle" selected-account-codes="editModel.accountCodes" selector-options="accountSelectorOptions"></account-multi-selector>
<model-multi-selector is-show="isShowModels" model-data-source="modelDataSource" selector-api="modelSelectorApi" data-title="modelTitle"
selected-model-ids="editModel.modelIDs" selector-options="modelSelectorOptions"></model-multi-selector>
<operate-log is-show="isShowLog"></operate-log>
<!-- 编辑报表 -->
<edit-template-modal template-model="templateModel" on-closed="selectTemplate(model)" is-update="isUpdateTemplate" operate-type="operateTemplateType"></edit-template-modal>
<!--编辑报表模板-->
<edit-templategroup-modal object-model="templateGroupModel" on-closed="selectTemplateGroup(model)" is-update="isUpdateTemplateGroup" operate-type="operateTemplateGroupType"></edit-templategroup-modal>
<key-value-selector is-show="isShowKeyValue" selector-api="keyValueSelectorApi" data-title="keyValueTitle" selector-options="keyValueSelectorOptions" selected-key-code="defaultKeyCode"></key-value-selector>
<edit-formula-modal operate-type="operateType" account-data-source="accountDataSource" select-formula="selectFormula" formula-list="formulaList" on-closed="selectParam(formula)"></edit-formula-modal>
<formula-param-selector is-show="isShowParam" account-data-source="accountDataSource" formula-list="formulaList"
formula-name="editFormula" formula-params="editParams" selector-api="paramSelectorApi"
selector-options="{ height: 430 }" container-selector="body"></formula-param-selector>
<key-value-selector is-show="isShowKeyValueForValidation" selector-api="keyValueSelectorApiForValidation" data-title="keyValueTitleForValidation" selector-options="keyValueSelectorOptionsForValidation" selected-key-code="defaultKeyCodeForValidation"></key-value-selector>
<edit-formula-modal operate-type="operateTypeForValidation" account-data-source="accountDataSource" select-formula="selectFormulaForValidation" formula-list="formulaList" on-closed="selectParamForValidation(formula)"></edit-formula-modal>
<edit-templategroup-modal object-model="templateGroupModel" on-closed="selectTemplateGroup(model)" is-update="isUpdateTemplateGroup"
operate-type="operateTemplateGroupType"></edit-templategroup-modal>
<key-value-selector is-show="isShowKeyValue" selector-api="keyValueSelectorApi" data-title="keyValueTitle" selector-options="keyValueSelectorOptions"
selected-key-code="defaultKeyCode"></key-value-selector>
<edit-formula-modal operate-type="operateType" account-data-source="accountDataSource" select-formula="selectFormula" formula-list="formulaList"
on-closed="selectParam(formula)"></edit-formula-modal>
<formula-param-selector is-show="isShowParam" account-data-source="accountDataSource" formula-list="formulaList" formula-name="editFormula"
formula-params="editParams" selector-api="paramSelectorApi" selector-options="{ height: 430 }" container-selector="body"></formula-param-selector>
<key-value-selector is-show="isShowKeyValueForValidation" selector-api="keyValueSelectorApiForValidation" data-title="keyValueTitleForValidation"
selector-options="keyValueSelectorOptionsForValidation" selected-key-code="defaultKeyCodeForValidation"></key-value-selector>
<edit-formula-modal operate-type="operateTypeForValidation" account-data-source="accountDataSource" select-formula="selectFormulaForValidation"
formula-list="formulaList" on-closed="selectParamForValidation(formula)"></edit-formula-modal>
<formula-param-selector is-show="isShowParamForValidation" account-data-source="accountDataSource" formula-list="formulaList"
formula-name="editFormulaForValidation" formula-params="editParamsForValidation"
selector-api="paramSelectorApiForValidation" selector-options="{ height: 430 }" container-selector="body"></formula-param-selector>
formula-name="editFormulaForValidation" formula-params="editParamsForValidation" selector-api="paramSelectorApiForValidation"
selector-options="{ height: 430 }" container-selector="body"></formula-param-selector>
</div>
\ No newline at end of file
......@@ -14,54 +14,54 @@ function ($rootScope, $log, $uibModal, $translate) {
var initialize = function (sheet) {
sheet.isPaintSuspended(true);
sheet.suspendPaint();
hasVoucherImg = new Image();
hasVoucherImg.src = '/app-resources/images/vat/hasVoucher.png';
hasVoucherImg.onload = function () {
sheet.repaint();
}
};
hasInvoiceImg = new Image();
hasInvoiceImg.src = '/app-resources/images/vat/hasInvoice.png';
hasInvoiceImg.onload = function () {
sheet.repaint();
}
};
hasKeyInImg = new Image();
hasKeyInImg.src = '/app-resources/images/vat/hasKeyIn.png';
hasKeyInImg.onload = function () {
sheet.repaint();
}
};
hasModelImg = new Image();
hasModelImg.src = '/app-resources/images/vat/hasModel.png';
hasModelImg.onload = function () {
sheet.repaint();
}
};
hasExceptionImg = new Image();
hasExceptionImg.src = '/app-resources/images/vat/hasException.png';
hasExceptionImg.onload = function () {
sheet.repaint();
}
};
hasValidationImg = new Image();
hasValidationImg.src = '/app-resources/images/vat/hasValidation.png';
hasValidationImg.onload = function () {
sheet.repaint();
}
};
};
var paintSheet = function (sheet) {
sheet.isPaintSuspended(false);
sheet.resumePaint();
};
var setCellTipString = function (cell, tip) {
//cell.cellType(new IconCellType(null, null, 0, null, tip));
cell.cellType(new IconsCellType([], [], tip));
}
};
var setCellTipByCellData = function (cell, cellData) {
var tips = null;
......@@ -100,7 +100,7 @@ function ($rootScope, $log, $uibModal, $translate) {
}
cell.cellType(new IconsCellType(icons, infos, tips));
}
};
var setCellTip = function (cell, config) {
var tips = null;
......@@ -201,7 +201,7 @@ function ($rootScope, $log, $uibModal, $translate) {
this.count = 0;
this.Formula = formula;
}
}
};
//var IconCellType = function (icon1, icon2, count, infos, formula) {
......@@ -217,7 +217,7 @@ function ($rootScope, $log, $uibModal, $translate) {
IconsCellType.prototype = new GC.Spread.Sheets.CellTypes.Base();
IconsCellType.prototype.paint = function (ctx, value, x, y, w, h, style, context) {
GC.Spread.Sheets.CellTypes.Base.prototype.paint.call(this, ctx, value, x, y, w, h, style, context);
GC.Spread.Sheets.CellTypes.Base.paint.call(this, ctx, value, x, y, w, h, style, context);
for (var i = 1; i <= this.count; i++) {
//距离当前单元格左侧距离,距离顶部距离 , ICON宽度,ICON高度
ctx.drawImage(this.Icons[i-1], x + w - (h - 3) * i + (h - 6 - 18) * i, y + 3 + (h / 2 - 3 - 9), 18, 18);
......@@ -232,7 +232,7 @@ function ($rootScope, $log, $uibModal, $translate) {
// ctx.drawImage(this.icon2, x + w - (h - 3) * i + (h - 6 - 18) * i, y + 3 + (h / 2 - 3 - 9), 18, 18);
//}
}
}
};
IconsCellType.prototype.getHitInfo = function (x, y, cellStyle, cellRect, context) {
var index = x - (cellRect.x + cellRect.width - (cellRect.height - 3) * this.count) > 0 ?
Math.floor(this.count - (x - (cellRect.x + cellRect.width - (cellRect.height - 3) * this.count)) / (cellRect.height - 3)) :
......@@ -248,7 +248,7 @@ function ($rootScope, $log, $uibModal, $translate) {
sheetArea: context.sheetArea,
reservedLocationIndex: index
};
}
};
IconsCellType.prototype.processMouseMove = function (hitinfo) {
//console.log(hitinfo);
......
......@@ -93,7 +93,7 @@ webservices.factory('spreadJsService', ['$log', '$q', '$http', 'apiConfig', 'doc
this.minArgs = minArgs;
};
customFunction.prototype = new GC.Spread.Sheets.Calc.Functions.Function();
customFunction.prototype = new GcSpread.Sheets.Calc.Functions.Function();
customFunction.prototype.evaluate = function (args) {
var formulaName = this.name + "(";
......@@ -128,7 +128,7 @@ webservices.factory('spreadJsService', ['$log', '$q', '$http', 'apiConfig', 'doc
var deferred = $q.defer();
var promise = deferred.promise;
var spread = new GC.Spread.Sheets.Spread(document.getElementById(id));
var spread = new GcSpread.Sheets.Spread(document.getElementById(id));
var sheet = spread.getActiveSheet();
spread.showVerticalScrollbar(true);
......@@ -149,16 +149,16 @@ webservices.factory('spreadJsService', ['$log', '$q', '$http', 'apiConfig', 'doc
sheet.setIsProtected(false);
}
spread.bind(GC.Spread.Sheets.Events.CellClick, function (sender, args) {
if (args.sheetArea === GC.Spread.Sheets.SheetArea.colHeader) {
spread.bind(GcSpread.Sheets.Events.CellClick, function (sender, args) {
if (args.sheetArea === GcSpread.Sheets.SheetArea.colHeader) {
$log.debug("The column header was clicked.");
}
if (args.sheetArea === GC.Spread.Sheets.SheetArea.rowHeader) {
if (args.sheetArea === GcSpread.Sheets.SheetArea.rowHeader) {
$log.debug("The row header was clicked.");
}
if (args.sheetArea === GC.Spread.Sheets.SheetArea.corner) {
if (args.sheetArea === GcSpread.Sheets.SheetArea.corner) {
$log.debug("The corner header was clicked.");
}
......@@ -167,7 +167,7 @@ webservices.factory('spreadJsService', ['$log', '$q', '$http', 'apiConfig', 'doc
$log.debug(sheet.getTag(args.row, args.col));
});
spread.bind(GC.Spread.Sheets.Events.EditEnding, function (sender, args) {
spread.bind(GcSpread.Sheets.Events.EditEnding, function (sender, args) {
var sheet = spread.getActiveSheet();
......@@ -212,7 +212,7 @@ webservices.factory('spreadJsService', ['$log', '$q', '$http', 'apiConfig', 'doc
var customfunctions;
//1. 获取自定义函数名及对应的计算值
//1. 获取自定义函数名及对应的计算值
getFormulaValueByDocumentCode(code).then(function (formuladata) {
formulaValues = JSON.parse(formuladata);
$log.debug(formulaValues);
......@@ -234,7 +234,7 @@ webservices.factory('spreadJsService', ['$log', '$q', '$http', 'apiConfig', 'doc
initSpreadCustomFunction(sheet, func.name, 0, func.parameterCount);
}
//5. Get Document Cell
//5. Get Document Cell
getDocumentCellByDocumentId(documentObj.documentID).then(function (celldata) {
renderFormulaCell(sheet, celldata.data);
});
......@@ -281,14 +281,14 @@ webservices.factory('spreadJsService', ['$log', '$q', '$http', 'apiConfig', 'doc
};
var initSpreadCustomFunctionAsync = function (sheet, name) {
var asum = function () { }
//Define a class "ASUM" that extends AsyncFunction
asum.prototype = new GC.Spread.Sheets.Calc.Functions.AsyncFunction(name, 1, 255);
asum.prototype = new GcSpread.Sheets.Calc.Functions.AsyncFunction(name, 1, 255);
//Set default value to "Loading..."
asum.prototype.defaultValue = function () { return "Loading..."; };
//Override the evaluateAsync function
......
......@@ -13,78 +13,37 @@ webservices.factory('templateService', ['$log', '$http', '$q', 'apiConfig', 'htt
return "";
};
var getTemplateJson = function (templateID) {
//return $http.get('/template/getTemplateJson?templateID=' + templateID, apiConfig.create());
// var result = httpCacheService.get('/template/getTemplateJson?templateID=' + templateID);
// if (result.finishedCache) {
// return result;
// } else {
// var thisConfig = apiConfig.create();
// thisConfig.responseType = "blob";
// return $http.post('/template/getTemplateJson?templateID=' + templateID, {}, apiConfig.create());
// }
var deferred = $q.defer();
var promise = deferred.promise;
// var ajaxUrl = loginContext.apiHost + constant.webapi.prefix + '/template/getTemplateJson?templateID=' + templateID;
// var apiTokenObj = JSON.parse(getCookie('AtmsApiToken'));
// var apiToken = apiTokenObj.access_token;
// var tokenType = apiTokenObj.token_type;
// var ajaxSource = $.ajax({
// url: ajaxUrl,
// type: "POST",
// dataType:"blob",
// beforeSend: function (xhr) {
// xhr.setRequestHeader('Authorization', tokenType + ' ' + apiToken);
// //xhr.setRequestHeader('from', 'aabb@cn.pwc.com');
// //xhr.responseType = "blob";
// },
// success: function(data){
// deferred.resolve(data);
// },
// complete: function(data){
// deferred.resolve(data.responseText);
// }
// });
// ajaxSource.done(function (data) {
// deferred.resolve(data);
// });
return promise;
};
var initSpreadExcel = function (id, ssjsondata) {
var deferred = $q.defer();
var promise = deferred.promise;
var spread = new GC.Spread.Sheets.Workbook(document.getElementById(id));
spread.showVerticalScrollbar(true);
spread.showHorizontalScrollbar(true);
spread.scrollbarMaxAlign(true);
spread.scrollbarShowMax(true);
spread.tabNavigationVisible(true);
spread.newTabVisible(false);
spread.tabEditable(false);
spread.tabStripVisible(false);
spread.newTabVisible(false);
// spread.allowUndo(false);
// spread.allowUserResize(false);
// spread.canUserDragDrop(false);
// spread.canUserDragFill(false);
// spread.canUserEditFormula(false);
//
// spread.isPaintSuspended(true);
// spread.fromJSON(JSON.parse(ssjsondata));
// spread.isPaintSuspended(false);
spread.options.showVerticalScrollbar = true;
spread.options.showHorizontalScrollbar = true;
spread.options.scrollbarMaxAlign = true;
spread.options.scrollbarShowMax = true;
spread.options.tabNavigationVisible = true;
spread.options.newTabVisible = false;
spread.options.tabEditable = false;
spread.options.tabStripVisible = false;
spread.options.newTabVisible = false;
spread.options.allowUndo = false;
spread.options.allowUserResize = false;
spread.options.allowUserDragDrop = false;
spread.options.allowUserDragFill = false;
spread.options.allowUserEditFormula = false;
spread.suspendPaint();
spread.fromJSON(ssjsondata);
spread.resumePaint();
var sheet = spread.getActiveSheet();
if (sheet != null) {
// sheet.setRowHeaderVisible(true);
// sheet.setColumnHeaderVisible(true);
// sheet.setGridlineOptions({
// showVerticalGridline: false, showHorizontalGridline: false
// });
sheet.options.rowHeaderVisible = true;
sheet.options.colHeaderVisible = true;
sheet.options.gridline.showVerticalGridline = false;
sheet.options.gridline.showHorizontalGridline = false;
}
deferred.resolve(spread);
......@@ -96,7 +55,7 @@ webservices.factory('templateService', ['$log', '$http', '$q', 'apiConfig', 'htt
var promise = deferred.promise;
var spreadSheet;
var url = loginContext.apiHost + constant.webapi.prefix+'/template/getTemplateJson?templateID=' + templateID;
var url = loginContext.apiHost + constant.webapi.prefix + '/template/getTemplateJson?templateID=' + templateID;
var xhr = new XMLHttpRequest();
xhr.open('POST', url, true); // 也可以使用POST方式,根据接口
xhr.responseType = "blob"; // 返回类型blob
......@@ -104,7 +63,6 @@ webservices.factory('templateService', ['$log', '$http', '$q', 'apiConfig', 'htt
var apiToken = apiTokenObj.access_token;
var tokenType = apiTokenObj.token_type;
xhr.setRequestHeader('Authorization', tokenType + ' ' + apiToken);
// xhr.setRequestHeader("Authorization","bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsImV4cCI6MTUyNzMxNDA4NCwiaWF0IjoxNTI3MTQxMjg0LCJuYmYiOjE1MjcxNDA2ODQsImp0aSI6IjVGM0FGMTBDLTdFMEEtNDVDQy04RDVGLUREMTBFMDRCOUY4NCIsInVzZXJuYW1lIjoiYWRtaW4iLCJkYXRhYmFzZVVzZXJuYW1lIjoiQWRtaW4iLCJ1c2VyaWQiOiI2NjkzM0U3Qi1EQTc1LTRCMkUtQjdENi1BQjY1RENBMjBENTAifQ.M-dyU6W51LAPVQ66HIJZ-KAg6WjPSIt1GqpOc6etQ6XJfXp8KkUPA6A8qPZ8bhydWsKKMqpPlx-KRVhK2o5q0Q")
// 定义请求完成的处理函数,请求前也可以增加加载框/禁用下载按钮逻辑
xhr.onload = function () {
// 请求完成
......@@ -121,39 +79,10 @@ webservices.factory('templateService', ['$log', '$http', '$q', 'apiConfig', 'htt
// process error
alert(e.errorMessage);
}, {});
// var reader = new FileReader();
// reader.readAsDataURL(blob); // 转换为base64,可以直接放入a表情href
// reader.onload = function (e) {
// // 转换完成,创建一个a标签用于下载
// var a = document.createElement('a');
// a.download = 'data.xlsx';
// a.href = e.target.result;
// $("body").append(a); // 修复firefox中无法触发click
// a.click();
// $(a).remove();
// }
}
};
// 发送ajax请求
xhr.send();
// getTemplateJson(templateID).then(function (result) {
// //var data = new Blob(result, {type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8"});
// var excelIo = new GC.Spread.Excel.IO();
// excelIo.open(result, function (json) {
// //var workbookObj = json;
// //spread.fromJSON(workbookObj);
// spreadSheet = initSpreadExcel(id, json);
// deferred.resolve(spreadSheet);
// }, function (e) {
// // process error
// alert(e.errorMessage);
// }, {});
// spreadSheet = initSpreadExcel(id, result.data === undefined ? result : result.data);
//
// deferred.resolve(spreadSheet);
// });
return promise;
};
......@@ -162,7 +91,6 @@ webservices.factory('templateService', ['$log', '$http', '$q', 'apiConfig', 'htt
};
return {
getTemplateJson: getTemplateJson,
renderSpreadExcelSimple: renderSpreadExcelSimple,
initSpreadExcel: initSpreadExcel,
setRowColName: setRowColName
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -3,7 +3,7 @@ systemConfigurationModule
'templateService', 'templateFormulaService', 'stdAccountService', 'spreadJsTipService', 'enums', 'KeyValueConfigService', 'modelConfigurationService', 'industryService',
'formulaService', 'serviceTypeService', 'mentioUtil', 'region',
function ($scope, $log, $timeout, $translate, $rootScope, $interval, $compile, $uibModal, $q, SweetAlert, templateGroupService, templateService, templateFormulaService,
stdAccountService, spreadJsTipService, enums, KeyValueConfigService, modelConfigurationService, industryService, formulaService, serviceTypeService, mentioUtil, region) {
stdAccountService, spreadJsTipService, enums, KeyValueConfigService, modelConfigurationService, industryService, formulaService, serviceTypeService, mentioUtil, region) {
'use strict';
var keyValueExp = /@\S*/g;
......@@ -23,7 +23,6 @@ systemConfigurationModule
};
var serviceTypeMapping = {
VAT: $translate.instant('VAT'),
RPT: $translate.instant('RPT'),
......@@ -425,56 +424,56 @@ systemConfigurationModule
categoryOptions: [],
rateOptions: [],
amountTypeOptions: [
{ name: 'PleaseSelect', value: 0 },
{ name: 'TotalAmount', value: 1 },
{ name: 'TaxAmount', value: 2 },
{ name: 'CopyNumber', value: 3 }
{name: 'PleaseSelect', value: 0},
{name: 'TotalAmount', value: 1},
{name: 'TaxAmount', value: 2},
{name: 'CopyNumber', value: 3}
]
},
{
type: 'Income',
value: 1,
categoryOptions: _.chain(enums.invoiceType).pairs().map(function (it) {
return { key: $translate.instant(it[0]), value: it[1], ticked: false };
return {key: $translate.instant(it[0]), value: it[1], ticked: false};
}).value(),
rateOptions: [
{ key: '17%', value: '17%', ticked: false },
{ key: '13%', value: '13%', ticked: false },
{ key: '11%', value: '11%', ticked: false },
{ key: '6%', value: '6%', ticked: false },
{ key: '5%', value: '5%', ticked: false },
{ key: '4%', value: '4%', ticked: false },
{ key: '3%', value: '3%', ticked: false },
{ key: '1.5%', value: '1.5%', ticked: false }
{key: '17%', value: '17%', ticked: false},
{key: '13%', value: '13%', ticked: false},
{key: '11%', value: '11%', ticked: false},
{key: '6%', value: '6%', ticked: false},
{key: '5%', value: '5%', ticked: false},
{key: '4%', value: '4%', ticked: false},
{key: '3%', value: '3%', ticked: false},
{key: '1.5%', value: '1.5%', ticked: false}
],
amountTypeOptions: [
{ name: 'PleaseSelect', value: 0 },
{ name: 'TotalAmount', value: 1 },
{ name: 'TaxAmount', value: 2 },
{ name: 'CopyNumber', value: 3 }
{name: 'PleaseSelect', value: 0},
{name: 'TotalAmount', value: 1},
{name: 'TaxAmount', value: 2},
{name: 'CopyNumber', value: 3}
]
},
{
type: 'Output',
value: 2,
categoryOptions: _.chain(enums.outputInvoiceType).pairs().map(function (it) {
return { key: $translate.instant(it[0]), value: it[1], ticked: false };
return {key: $translate.instant(it[0]), value: it[1], ticked: false};
}).value(),
rateOptions: [
{ key: '17%', value: '17%', ticked: false },
{ key: '13%', value: '13%', ticked: false },
{ key: '11%', value: '11%', ticked: false },
{ key: '6%', value: '6%', ticked: false },
{ key: '5%', value: '5%', ticked: false },
{ key: '4%', value: '4%', ticked: false },
{ key: '3%', value: '3%', ticked: false },
{ key: '1.5%', value: '1.5%', ticked: false }
{key: '17%', value: '17%', ticked: false},
{key: '13%', value: '13%', ticked: false},
{key: '11%', value: '11%', ticked: false},
{key: '6%', value: '6%', ticked: false},
{key: '5%', value: '5%', ticked: false},
{key: '4%', value: '4%', ticked: false},
{key: '3%', value: '3%', ticked: false},
{key: '1.5%', value: '1.5%', ticked: false}
],
amountTypeOptions: [
{ name: 'PleaseSelect', value: 0 },
{ name: 'TotalAmount', value: 1 },
{ name: 'TaxAmount', value: 2 },
{ name: 'CopyNumber', value: 3 }
{name: 'PleaseSelect', value: 0},
{name: 'TotalAmount', value: 1},
{name: 'TaxAmount', value: 2},
{name: 'CopyNumber', value: 3}
]
},
{
......@@ -483,10 +482,10 @@ systemConfigurationModule
categoryOptions: [],
rateOptions: [],
amountTypeOptions: [
{ name: 'PleaseSelect', value: 0 },
{ name: 'TotalAmount', value: 1 },
{ name: 'TaxAmount', value: 2 },
{ name: 'CopyNumber', value: 3 }
{name: 'PleaseSelect', value: 0},
{name: 'TotalAmount', value: 1},
{name: 'TaxAmount', value: 2},
{name: 'CopyNumber', value: 3}
]
}
];
......@@ -496,7 +495,7 @@ systemConfigurationModule
// 选中某一发票类型级联更新税率与金额类型列表
var selectInvoiceOption = function (editModel, invoiceType, isInit) {
var selectedInvoice = _.where($scope.invoiceOptions, { value: invoiceType });
var selectedInvoice = _.where($scope.invoiceOptions, {value: invoiceType});
var op = selectedInvoice.length === 0 ? $scope.invoiceOptions[0] : selectedInvoice[0];
// 如果获取到的editModel.invoiceCategory为[ 99 ],代表发票类型全选;
......@@ -528,7 +527,7 @@ systemConfigurationModule
});
var choseAmoutType = isInit && editModel.invoiceAmountType && editModel.invoiceAmountType > 0 ?
_.where(op.amountTypeOptions, { value: editModel.invoiceAmountType })[0] : op.amountTypeOptions[0];
_.where(op.amountTypeOptions, {value: editModel.invoiceAmountType})[0] : op.amountTypeOptions[0];
editModel.chosenInvoiceOption = {
type: op.type,
......@@ -564,12 +563,12 @@ systemConfigurationModule
});
_spread = spread;
var activeSheet = _spread.getActiveSheet();
var activeSheet = _spread.getSheet(1);
//设置整个sheet不可编辑
activeSheet.setIsProtected(true);
activeSheet.protectionOption({
activeSheet.isProtected = true;
activeSheet.options.protectionOption = {
allowEditObjects: false
});
};
$scope.activeSheet = activeSheet;
......@@ -644,7 +643,7 @@ systemConfigurationModule
if (isHideContextMenu) {
hideSpreadContextMenu();
} else {
$contextMenu.css({ left: e.pageX, top: e.pageY });
$contextMenu.css({left: e.pageX, top: e.pageY});
$contextMenu.show();
$(document).on("click.contextmenu", function () {
......@@ -728,7 +727,7 @@ systemConfigurationModule
for (var i = 0; i < spans[k].rowCount; i++) {
for (var j = 0; j < spans[k].colCount; j++) {
if (i > 0 || j > 0) {
exceptedCells.push({ rowIndex: spans[k].row + i, columnIndex: spans[k].col + j });
exceptedCells.push({rowIndex: spans[k].row + i, columnIndex: spans[k].col + j});
}
}
}
......@@ -747,8 +746,8 @@ systemConfigurationModule
var col = startCol + j;
if (_.every(exceptedCells, function (c) {
return c.rowIndex !== row || c.columnIndex !== col;
})) {
validPosition.push({ rowIndex: row, columnIndex: col });
})) {
validPosition.push({rowIndex: row, columnIndex: col});
}
}
}
......@@ -761,20 +760,20 @@ systemConfigurationModule
var confirmWarningWindow = function (title, text) {
var deferred = $q.defer();
SweetAlert.swal({
title: title,
text: text,
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
allowOutsideClick: false,
confirmButtonText: $translate.instant('Confirm'),
cancelButtonText: $translate.instant('Cancel'),
closeOnConfirm: true,
closeOnCancel: true
},
function (isConfirm) {
deferred.resolve(isConfirm);
});
title: title,
text: text,
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
allowOutsideClick: false,
confirmButtonText: $translate.instant('Confirm'),
cancelButtonText: $translate.instant('Cancel'),
closeOnConfirm: true,
closeOnCancel: true
},
function (isConfirm) {
deferred.resolve(isConfirm);
});
return deferred.promise;
};
......@@ -803,7 +802,7 @@ systemConfigurationModule
selectInvoiceOption($scope.editModel, $scope.editModel.invoiceType, true);
// invoiceOption: Used to save invoice tax rate and amount type options temporarily
$scope.invoiceOption = _.findWhere($scope.invoiceOptions, { type: $scope.editModel.chosenInvoiceOption.type });
$scope.invoiceOption = _.findWhere($scope.invoiceOptions, {type: $scope.editModel.chosenInvoiceOption.type});
$scope.mentionApi.triggerValidator($scope.editModel.formula, $scope.editReportFormulaForm.formula);
$scope.mentionApiForValidation.triggerValidator($scope.editModel.validation, $scope.editReportFormulaForm.validation);
......@@ -865,10 +864,10 @@ systemConfigurationModule
}
},
columns: [
{ caption: $translate.instant('SubjectCodeCol'), dataField: 'code' },
{ caption: $translate.instant('SubjectNameCol'), dataField: 'name' },
{ caption: $translate.instant('SubjectDirectionCol'), dataField: 'directionName' },
{ caption: $translate.instant('SubjectTypeCol'), dataField: 'AcctPropName' },
{caption: $translate.instant('SubjectCodeCol'), dataField: 'code'},
{caption: $translate.instant('SubjectNameCol'), dataField: 'name'},
{caption: $translate.instant('SubjectDirectionCol'), dataField: 'directionName'},
{caption: $translate.instant('SubjectTypeCol'), dataField: 'AcctPropName'},
{
alignment: 'center',
width: '40px',
......@@ -921,12 +920,12 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasVoucher"/>');
}
},
columns: [
{ caption: $translate.instant('ModelCode'), dataField: 'code', visible: false },
{ caption: $translate.instant('ModelName'), dataField: 'name' },
{ caption: $translate.instant('ModelDescription'), dataField: 'description' },
{ caption: $translate.instant('ModelFeature'), dataField: 'featureName' },
{ caption: $translate.instant('ModelType'), dataField: 'modelTypeName' },
{ caption: $translate.instant('ModelOrganization'), dataField: 'organizationName' },
{caption: $translate.instant('ModelCode'), dataField: 'code', visible: false},
{caption: $translate.instant('ModelName'), dataField: 'name'},
{caption: $translate.instant('ModelDescription'), dataField: 'description'},
{caption: $translate.instant('ModelFeature'), dataField: 'featureName'},
{caption: $translate.instant('ModelType'), dataField: 'modelTypeName'},
{caption: $translate.instant('ModelOrganization'), dataField: 'organizationName'},
{
alignment: 'center',
width: '40px',
......@@ -1081,7 +1080,7 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>');
var operatorMatches = ngModelValue.match(notDuplicateOperatorExp);
if (_.any(operatorMatches, function (m) {
return m.length > 1;
})) {
})) {
ngModel.$setValidity('operatorDuplicateValidator', false);
return false;
}
......@@ -1262,7 +1261,7 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>');
var operatorMatches = ngModelValue.match(notDuplicateOperatorExp);
if (_.any(operatorMatches, function (m) {
return m.length > 1;
})) {
})) {
ngModel.$setValidity('operatorDuplicateValidator', false);
return false;
}
......@@ -1337,33 +1336,33 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>');
/*********************** End Formula Editor ***********************************/
//模板另存为
//模板另存为
var saveTemplateGroup = function () {
var groupName = $scope.groupName;
if (groupName === '' || groupName === undefined) {
SweetAlert.warning($translate.instant('InputTemplateGroupNameWarning'));
return;
}
$scope.newTemplateGroup.Name = groupName;
$scope.newTemplateGroup.ServiceTypeID = $scope.curServiceTypeId;
$scope.newTemplateGroup.CopyFrom = $scope.curTemplateGroup.id;
$scope.newTemplateGroup.groupType = $scope.curTemplateGroup.groupType;
$scope.newTemplateGroup.payTaxType = $scope.curTemplateGroup.payTaxType;
$scope.newTemplateGroup.industryIDs = $scope.curTemplateGroup.industryIDs;
$scope.newTemplateGroup.ChangedFormulas = $scope.formulasArrayTemp;
templateGroupService.addTemplateGroup($scope.newTemplateGroup).success(function (or) {
if (or && or.result) {
SweetAlert.success($translate.instant('TemplateGroupSaveAsSuccess'));
loadTemplateGroup();
$('#templateName').val('');
$('.templates-save-form').css('display', 'none');
} else {
SweetAlert.warning($translate.instant(or.resultMsg));
var groupName = $scope.groupName;
if (groupName === '' || groupName === undefined) {
SweetAlert.warning($translate.instant('InputTemplateGroupNameWarning'));
return;
}
});
};
$scope.newTemplateGroup.Name = groupName;
$scope.newTemplateGroup.ServiceTypeID = $scope.curServiceTypeId;
$scope.newTemplateGroup.CopyFrom = $scope.curTemplateGroup.id;
$scope.newTemplateGroup.groupType = $scope.curTemplateGroup.groupType;
$scope.newTemplateGroup.payTaxType = $scope.curTemplateGroup.payTaxType;
$scope.newTemplateGroup.industryIDs = $scope.curTemplateGroup.industryIDs;
$scope.newTemplateGroup.ChangedFormulas = $scope.formulasArrayTemp;
templateGroupService.addTemplateGroup($scope.newTemplateGroup).success(function (or) {
if (or && or.result) {
SweetAlert.success($translate.instant('TemplateGroupSaveAsSuccess'));
loadTemplateGroup();
$('#templateName').val('');
$('.templates-save-form').css('display', 'none');
} else {
SweetAlert.warning($translate.instant(or.resultMsg));
}
});
};
var loadTemplateMenu = function () {
......@@ -1411,21 +1410,21 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>');
// 如果发票类型全选,则将editModel.invoiceCategory设置为[ 99 ];
// 否则将选中的发票类型存入editModel.invoiceCategory数组,如[1, 2, 3]
if ($scope.editModel.chosenInvoiceOption.categoryOptions.length > 0 &&
_.every($scope.editModel.chosenInvoiceOption.categoryOptions, { ticked: true })) {
_.every($scope.editModel.chosenInvoiceOption.categoryOptions, {ticked: true})) {
$scope.editModel.invoiceCategory = [Number(constant.selectAllValue)];
} else {
$scope.editModel.invoiceCategory = _.chain($scope.editModel.chosenInvoiceOption.categoryOptions)
.where({ ticked: true }).pluck('value').value();
.where({ticked: true}).pluck('value').value();
}
// 如果税率全选,则将editModel.taxRate设置为[ '99' ];
// 否则将选中的税率存入editModel.taxRate数组,如['17%', '11%', '6%']
if ($scope.editModel.chosenInvoiceOption.rateOptions.length > 0 &&
_.every($scope.editModel.chosenInvoiceOption.rateOptions, { ticked: true })) {
_.every($scope.editModel.chosenInvoiceOption.rateOptions, {ticked: true})) {
$scope.editModel.taxRate = [constant.selectAllValue];
} else {
$scope.editModel.taxRate = _.chain($scope.editModel.chosenInvoiceOption.rateOptions)
.where({ ticked: true }).pluck('value').value();
.where({ticked: true}).pluck('value').value();
}
$scope.editModel.invoiceType = $scope.editModel.chosenInvoiceOption.value;
......@@ -1549,17 +1548,17 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>');
var groupedParamList = _.groupBy(result[2].data.data, 'formulaID');
var paramList = result[1].data.data;
_.each(groupedParamList, function (val, key) {
var formula = _.findWhere(formulaList, { id: key });
var formula = _.findWhere(formulaList, {id: key});
if (formula) {
formula.params = _.chain(val)
.map(function (p) {
return { id: p.formulaParamID, index: p.paramIndex };
return {id: p.formulaParamID, index: p.paramIndex};
})
.sortBy(function (p) {
return p.index;
}).value();
_.each(formula.params, function (p, idx) {
var param = _.findWhere(paramList, { id: p.id });
var param = _.findWhere(paramList, {id: p.id});
_.extend(p, param);
});
}
......@@ -1578,14 +1577,14 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>');
var modelTypes = _.invert(enums.modelType);
_.each(data, function (m) {
if (m.type.toString() === modelTypes.SystemCommonModel) {
if (!_.some(rtn, { id: m.id })) {
if (!_.some(rtn, {id: m.id})) {
m.orgID = null;
m.organizationName = $translate.instant('All');
m.featureName = $translate.instant(enums.modelFeature[m.feature]);
rtn.push(m);
}
} else {
var existsModel = _.findWhere(rtn, { id: m.id });
var existsModel = _.findWhere(rtn, {id: m.id});
if (!existsModel) {
m.featureName = $translate.instant(enums.modelFeature[m.feature]);
rtn.push(m);
......@@ -1691,8 +1690,8 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>');
newValue.value <= 0 ||
newValue.invoiceAmountType.value <= 0 ||
newValue.value !== 3 &&
(_.every(newValue.categoryOptions, { ticked: false }) ||
_.every(newValue.rateOptions, { ticked: false })))) {
(_.every(newValue.categoryOptions, {ticked: false}) ||
_.every(newValue.rateOptions, {ticked: false})))) {
$scope.editReportFormulaForm.invoice.$setValidity('invoiceNotSelectValidator', false);
} else {
$scope.editReportFormulaForm.invoice.$setValidity('invoiceNotSelectValidator', true);
......@@ -1706,8 +1705,8 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>');
$scope.editModel.chosenInvoiceOption.value <= 0 ||
$scope.editModel.chosenInvoiceOption.invoiceAmountType.value <= 0 ||
$scope.editModel.chosenInvoiceOption.value !== 3 &&
(_.every($scope.editModel.chosenInvoiceOption.rateOptions, { ticked: false }) ||
_.every($scope.editModel.chosenInvoiceOption.categoryOptions, { ticked: false }))) {
(_.every($scope.editModel.chosenInvoiceOption.rateOptions, {ticked: false}) ||
_.every($scope.editModel.chosenInvoiceOption.categoryOptions, {ticked: false}))) {
$scope.editReportFormulaForm.invoice.$setValidity('invoiceNotSelectValidator', false);
}
});
......@@ -2064,7 +2063,8 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>');
$('#' + dxControl.templateDropDownId).dxDropDownBox({
value: selectName,
showClearButton: false,
onContentReady: function (args) { },
onContentReady: function (args) {
},
contentTemplate: function (e) {
// thisData.DropDownEvent = e;
var value = e.component.option("value");
......@@ -2165,10 +2165,10 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>');
});
var tabs = [
{ id: 0, text: $translate.instant('AutoCalculateTab') },
{ id: 1, text: $translate.instant('ManualInputTab') },
{ id: 2, text: $translate.instant('ModelTab') },
{ id: 3, text: $translate.instant('ValidationTab') }
{id: 0, text: $translate.instant('AutoCalculateTab')},
{id: 1, text: $translate.instant('ManualInputTab')},
{id: 2, text: $translate.instant('ModelTab')},
{id: 3, text: $translate.instant('ValidationTab')}
];
$scope.tabOptions = {
dataSource: tabs,
......
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