1.传BIP税率字段逻辑优化
This commit is contained in:
parent
0b87fa9d49
commit
32bab7cf7e
|
@ -272,13 +272,29 @@ public class ContractMaterialImportPlugin extends AbstractFormPlugin {
|
|||
indexVsMsgMap.put(rowNum, "第" + (i + 1) + "行:物料单位不能为空或空字符串");
|
||||
}
|
||||
|
||||
// String name = (String) map.get("qeug_materialnames"); // 物料单位
|
||||
// String model = (String) map.get("qeug_importmodel")==null ? "":(String) map.get("qeug_importmodel"); // 物料规格
|
||||
//
|
||||
// // 校验物料编码是否已经存在于当前页面的表格中
|
||||
// if (existComb.contains(name.trim()+model.trim())) {
|
||||
// indexVsMsgMap.put(rowNum, "第" + (i + 1) + "行:物料+规格已存在,请勿重复导入");
|
||||
// }
|
||||
JSONObject taxRateObj = (JSONObject) map.get("qeug_taxrate");
|
||||
if (taxRateObj != null) {
|
||||
String name = taxRateObj.getString("name"); // 税率名称
|
||||
if (name != null && !name.trim().isEmpty()) {
|
||||
// 验证name必须是带%的文本格式
|
||||
if (!name.contains("%")) {
|
||||
indexVsMsgMap.put(rowNum, "第" + (i + 1) + "行:税率格式错误!系统无法识别,请输入带%的文本格式(例如:13%)!");
|
||||
} else {
|
||||
// 可选:进一步验证%位置和数字格式
|
||||
String numPart = name.replace("%", "").trim();
|
||||
try {
|
||||
// 尝试转换为数字,验证是否是有效的百分比数值
|
||||
Double.parseDouble(numPart);
|
||||
// 可以添加更多验证,比如%是否在末尾
|
||||
if (!name.trim().endsWith("%")) {
|
||||
indexVsMsgMap.put(rowNum, "第" + (i + 1) + "行:税率格式错误!百分比符号(%)应放在数值末尾(例如:13%)!");
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
indexVsMsgMap.put(rowNum, "第" + (i + 1) + "行:税率格式错误!百分比数值部分无效,请输入有效数值加%(例如:13%)!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return indexVsMsgMap;
|
||||
|
|
|
@ -649,9 +649,13 @@ public class YongyouBIPOperation extends AbstractOperationServicePlugIn implemen
|
|||
items.put("taxrate","0");//税率
|
||||
items.put("local_tax_de","0");//税额
|
||||
items.put("taxcodeid","CN07");//税码
|
||||
items.put("notax_de",payRequestInfo.getBigDecimal("notaxamt").toString());//贷方无税金额,除税金额
|
||||
items.put("local_notax_de",payRequestInfo.getBigDecimal("notaxamt").toString());//组织本币无税金额
|
||||
} else {
|
||||
// 税额
|
||||
BigDecimal taxAmount = BigDecimal.ZERO;
|
||||
//无税金额(专普混合:专票无税+普票价税合计)
|
||||
BigDecimal notTaxAmount = BigDecimal.ZERO;
|
||||
// 税率相关变量
|
||||
BigDecimal commonTaxRate = null;
|
||||
Long commonTaxRateId = null;
|
||||
|
@ -664,11 +668,16 @@ public class YongyouBIPOperation extends AbstractOperationServicePlugIn implemen
|
|||
Object pkValue = invoiceBillF7.getPkValue();
|
||||
DynamicObject invoiceBill = BusinessDataServiceHelper.loadSingle(pkValue, "recon_invoicebill");
|
||||
if (invoiceBill != null) {
|
||||
//表头不含税
|
||||
BigDecimal notTax=invoiceBill.getBigDecimal("notaxamt");
|
||||
//表头价税合计
|
||||
BigDecimal amount=invoiceBill.getBigDecimal("amount");
|
||||
// 判断【发票登记-发票类型-名称】
|
||||
DynamicObject invoice = invoiceBill.getDynamicObject("invoice");
|
||||
if (invoice != null) {
|
||||
String invoiceName = invoice.getString("name");
|
||||
if (invoiceName != null && invoiceName.contains("专用")) {
|
||||
notTaxAmount=notTaxAmount.add(notTax);
|
||||
// 发票登记-发票明细
|
||||
DynamicObjectCollection invoiceDetails = invoiceBill.getDynamicObjectCollection("invoiceentry");
|
||||
if (invoiceDetails != null && invoiceDetails.size() != 0) {
|
||||
|
@ -695,6 +704,9 @@ public class YongyouBIPOperation extends AbstractOperationServicePlugIn implemen
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}else {
|
||||
notTaxAmount=notTaxAmount.add(amount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -703,10 +715,14 @@ public class YongyouBIPOperation extends AbstractOperationServicePlugIn implemen
|
|||
|
||||
// 设置税额
|
||||
items.put("local_tax_de", taxAmount.compareTo(BigDecimal.ZERO)==0 ? "0":taxAmount.toString());
|
||||
//不含税
|
||||
items.put("notax_de",notTaxAmount.toString());//贷方无税金额,除税金额
|
||||
items.put("local_notax_de",notTaxAmount.toString());//组织本币无税金额
|
||||
|
||||
// 设置税率值:所有税率相同则使用共同税率,不同则设为null
|
||||
// 设置税率值:所有税率相同则使用共同税率,存在多税率传0
|
||||
if (hasDifferentTaxRates) {
|
||||
items.put("taxrate", "0");
|
||||
items.put("taxcodeid", "CN07");
|
||||
} else if (commonTaxRate != null) {
|
||||
// 设置税率
|
||||
items.put("taxrate", commonTaxRate.compareTo(BigDecimal.ZERO)==0 ? "0":commonTaxRate.toString());
|
||||
|
@ -722,10 +738,10 @@ public class YongyouBIPOperation extends AbstractOperationServicePlugIn implemen
|
|||
}
|
||||
} else {
|
||||
items.put("taxrate", "0");
|
||||
items.put("taxcodeid", "CN07");
|
||||
}
|
||||
|
||||
items.put("notax_de",payRequestInfo.getBigDecimal("notaxamt").toString());//贷方无税金额,除税金额
|
||||
items.put("local_notax_de",payRequestInfo.getBigDecimal("notaxamt").toString());//组织本币无税金额
|
||||
|
||||
if("unaudit".equals(eventName)){
|
||||
//如果此时是反审核,则需要将金额置为负数
|
||||
items.put("local_tax_de","-"+items.getString("local_tax_de"));
|
||||
|
@ -748,14 +764,19 @@ public class YongyouBIPOperation extends AbstractOperationServicePlugIn implemen
|
|||
items.put("taxrate","0");//税率
|
||||
items.put("local_tax_de","0");//税额
|
||||
items.put("taxcodeid","CN07");//税码
|
||||
items.put("notax_de",bcsqje.toString());//贷方无税金额,除税金额
|
||||
items.put("local_notax_de",bcsqje.toString());//组织本币无税金额
|
||||
if("unaudit".equals(eventName)){
|
||||
//如果此时是反审核,则需要将金额置为负数
|
||||
items.put("notax_de","-"+bcsqje.toString());
|
||||
items.put("local_notax_de","-"+bcsqje.toString());//组织本币无税金额
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
// 税额
|
||||
BigDecimal taxAmount = BigDecimal.ZERO;
|
||||
//无税金额(专普混合:专票无税+普票价税合计)
|
||||
BigDecimal notTaxAmount = BigDecimal.ZERO;
|
||||
// 税率相关变量
|
||||
BigDecimal commonTaxRate = null;
|
||||
Long commonTaxRateId = null;
|
||||
|
@ -768,11 +789,17 @@ public class YongyouBIPOperation extends AbstractOperationServicePlugIn implemen
|
|||
Object pkValue = invoiceBillF7.getPkValue();
|
||||
DynamicObject invoiceBill = BusinessDataServiceHelper.loadSingle(pkValue, "recon_invoicebill");
|
||||
if (invoiceBill != null) {
|
||||
//表头不含税
|
||||
BigDecimal notTax=invoiceBill.getBigDecimal("notaxamt");
|
||||
//表头价税合计
|
||||
BigDecimal amount=invoiceBill.getBigDecimal("amount");
|
||||
|
||||
// 判断【发票登记-发票类型-名称】
|
||||
DynamicObject invoice = invoiceBill.getDynamicObject("invoice");
|
||||
if (invoice != null) {
|
||||
String invoiceName = invoice.getString("name");
|
||||
if (invoiceName != null && invoiceName.contains("专用")) {
|
||||
notTaxAmount=notTaxAmount.add(notTax);
|
||||
// 发票登记-发票明细
|
||||
DynamicObjectCollection invoiceDetails = invoiceBill.getDynamicObjectCollection("invoiceentry");
|
||||
if (invoiceDetails != null && invoiceDetails.size() != 0) {
|
||||
|
@ -780,7 +807,6 @@ public class YongyouBIPOperation extends AbstractOperationServicePlugIn implemen
|
|||
BigDecimal entryTax = invoiceDetail.getBigDecimal("entry_tax");
|
||||
// 税额累加
|
||||
taxAmount = taxAmount.add(entryTax);
|
||||
|
||||
// 处理税率
|
||||
DynamicObject entryTaxRate = invoiceDetail.getDynamicObject("entry_taxrate");
|
||||
if (entryTaxRate != null) {
|
||||
|
@ -799,6 +825,8 @@ public class YongyouBIPOperation extends AbstractOperationServicePlugIn implemen
|
|||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
notTaxAmount=notTaxAmount.add(amount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -807,10 +835,14 @@ public class YongyouBIPOperation extends AbstractOperationServicePlugIn implemen
|
|||
|
||||
// 设置税额
|
||||
items.put("local_tax_de", taxAmount.compareTo(BigDecimal.ZERO)==0 ? "0":taxAmount.toString());
|
||||
//不含税
|
||||
items.put("notax_de",notTaxAmount.toString());//贷方无税金额,除税金额
|
||||
items.put("local_notax_de",notTaxAmount.toString());//组织本币无税金额
|
||||
|
||||
// 设置税率值:所有税率相同则使用共同税率,不同则设为null
|
||||
if (hasDifferentTaxRates) {
|
||||
items.put("taxrate", "0");
|
||||
items.put("taxcodeid", "CN07");
|
||||
} else if (commonTaxRate != null) {
|
||||
// 设置税率
|
||||
items.put("taxrate", commonTaxRate.compareTo(BigDecimal.ZERO)==0 ? "0":commonTaxRate.toString());
|
||||
|
@ -826,10 +858,9 @@ public class YongyouBIPOperation extends AbstractOperationServicePlugIn implemen
|
|||
}
|
||||
} else {
|
||||
items.put("taxrate", "0");
|
||||
items.put("taxcodeid", "CN07");
|
||||
}
|
||||
|
||||
items.put("notax_de",payRequestInfo.getBigDecimal("notaxamt").toString());//贷方无税金额,除税金额
|
||||
items.put("local_notax_de",payRequestInfo.getBigDecimal("notaxamt").toString());//组织本币无税金额
|
||||
if("unaudit".equals(eventName)){
|
||||
//如果此时是反审核,则需要将金额置为负数
|
||||
items.put("local_tax_de","-"+items.getString("local_tax_de"));
|
||||
|
|
|
@ -288,6 +288,30 @@ public class OrderFormMaterialImportPlugin extends AbstractFormPlugin implements
|
|||
if (existComb.contains(name.trim()+model.trim())) {
|
||||
indexVsMsgMap.put(rowNum, "第" + (i + 1) + "行:物料+规格已存在,请勿重复导入");
|
||||
}
|
||||
|
||||
JSONObject taxRateObj = (JSONObject) map.get("taxrate");
|
||||
if (taxRateObj != null) {
|
||||
String taxRatName = taxRateObj.getString("name"); // 税率名称
|
||||
if (taxRatName != null && !taxRatName.trim().isEmpty()) {
|
||||
// 验证name必须是带%的文本格式
|
||||
if (!taxRatName.contains("%")) {
|
||||
indexVsMsgMap.put(rowNum, "第" + (i + 1) + "行:税率格式错误!系统无法识别,请输入带%的文本格式(例如:13%)!");
|
||||
} else {
|
||||
// 可选:进一步验证%位置和数字格式
|
||||
String numPart = taxRatName.replace("%", "").trim();
|
||||
try {
|
||||
// 尝试转换为数字,验证是否是有效的百分比数值
|
||||
Double.parseDouble(numPart);
|
||||
// 可以添加更多验证,比如%是否在末尾
|
||||
if (!taxRatName.trim().endsWith("%")) {
|
||||
indexVsMsgMap.put(rowNum, "第" + (i + 1) + "行:税率格式错误!百分比符号(%)应放在数值末尾(例如:13%)!");
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
indexVsMsgMap.put(rowNum, "第" + (i + 1) + "行:税率格式错误!百分比数值部分无效,请输入有效数值加%(例如:13%)!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return indexVsMsgMap;
|
||||
|
|
Loading…
Reference in New Issue