|
|
@@ -674,8 +674,12 @@ public class ivtOrderController {
|
|
|
*/
|
|
|
List<RowMap> taxCateList = DBSql.getMaps("SELECT OID,NAME,ORGID,GENERAL_TABLE_ID,EXT1,CLOSED,IS_ACTIVE FROM BO_EU_DND_GENERAL WHERE GENERAL_TABLE_ID=44 AND ORGID=? ", new Object[]{uc.getCompanyModel().getId()});
|
|
|
Map<String, BigDecimal> taxRateMap = new HashMap<>();
|
|
|
+ String zeroTaxTaxCateId = "";
|
|
|
for (RowMap taxCate : taxCateList) {
|
|
|
taxRateMap.put(taxCate.getString("OID"), toBigDecimal(taxCate.getDouble("EXT1")));
|
|
|
+ if (toBigDecimal(taxCate.getDouble("EXT1")).compareTo(BigDecimal.ZERO) == 0) {
|
|
|
+ zeroTaxTaxCateId = taxCate.getString("OID");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
String[] costIdArr = costIds.split(",");
|
|
|
@@ -781,14 +785,25 @@ public class ivtOrderController {
|
|
|
BO purchaseOrderProduct = new BO();
|
|
|
purchaseOrderProduct.setBindId(processInstance.getId());
|
|
|
String unitCostStr = cost.getString("UNIT_COST");
|
|
|
- String taxCategoryId = cost.getString("TAX_CATEGORY_ID");
|
|
|
+
|
|
|
int purchaseQuantity = cost.getInt("PURCHASE_QUANTITY");
|
|
|
|
|
|
- if (StringUtils.isBlank(unitCostStr) || StringUtils.isBlank(taxCategoryId) || purchaseQuantity <= 0) {
|
|
|
- ivtLogger.info("无效计算参数:UNIT_COST=" + unitCostStr + ",TAX_CATEGORY_ID=" + taxCategoryId + ",PURCHASE_QUANTITY=" + purchaseQuantity);
|
|
|
+ if (StringUtils.isBlank(unitCostStr) || purchaseQuantity <= 0) {
|
|
|
+ ivtLogger.info("无效计算参数:UNIT_COST=" + unitCostStr + ",+PURCHASE_QUANTITY=" + purchaseQuantity);
|
|
|
throw new RuntimeException("计算不含税金额失败:参数无效");
|
|
|
}
|
|
|
|
|
|
+ String taxCategoryId = null;
|
|
|
+ //增值税发票,选择是时,才需要展示税率
|
|
|
+ if (StringUtils.isNotBlank(cost.getString("SERVICE_ID"))) {
|
|
|
+ RowMap serviceMap = DBSql.getMap("select * from BO_EU_DNCTT_CONTRACT_SERVICE where ID=?", new Object[]{cost.getString("SERVICE_ID")});
|
|
|
+ if (serviceMap.getString("VAT_TAX").equals("1")) {
|
|
|
+ taxCategoryId = cost.getString("TAX_CATEGORY_ID");
|
|
|
+ } else {
|
|
|
+ taxCategoryId = zeroTaxTaxCateId;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
BigDecimal taxRate = taxRateMap.get(taxCategoryId);
|
|
|
if (taxRate == null) {
|
|
|
System.err.println("未知TAX_CATEGORY_ID:" + taxCategoryId);
|
|
|
@@ -804,7 +819,7 @@ public class ivtOrderController {
|
|
|
purchaseOrderProduct.set("PRODUCT_ID", cost.getString("PRODUCT_ID"));
|
|
|
purchaseOrderProduct.set("QUANTITY", cost.getString("PURCHASE_QUANTITY"));
|
|
|
purchaseOrderProduct.set("UNIT_COST", cost.getString("UNIT_COST"));
|
|
|
- purchaseOrderProduct.set("TAX_CATEGORY_ID", cost.getString("TAX_CATEGORY_ID"));
|
|
|
+ purchaseOrderProduct.set("TAX_CATEGORY_ID", zeroTaxTaxCateId);
|
|
|
|
|
|
String warehouseId = DBSql.getString("SELECT ID FROM bo_eu_dnivt_warehouse WHERE CATE_ID=2 AND ORGID=? ", new Object[]{uc.getCompanyModel().getId()});
|
|
|
if (warehouseId == null) {
|
|
|
@@ -812,7 +827,6 @@ public class ivtOrderController {
|
|
|
throw new RuntimeException("未查询到符合条件的仓库");
|
|
|
}
|
|
|
purchaseOrderProduct.set("WAREHOUSE_ID", warehouseId);
|
|
|
-
|
|
|
purchaseOrderProduct.set("NOTE", cost.getString("DESCRIPTION"));
|
|
|
purchaseOrderProduct.set("COST_TOTAL", cost.getString("EXTENDED_COST"));
|
|
|
purchaseOrderProduct.set("CONTRACT_ID", cost.getString("CONTRACT_ID"));
|