Commit 05a6d7dd by liuyang

2024-09-11 采购收票修复删除功能和优化

parent 37cf42bb
package com.baosight.hggp.common;
import com.baosight.iplat4j.core.ei.EiBlock;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author LiuYang
* @version 1.0 2024/9/11
* @description 合同类型
*/
public enum ContractTypeEnum {
CGSH(1,"采购收货"),
LZHT(2,"劳务合同"),
ZLHT(3,"租赁合同");
private Integer code;
private String value;
ContractTypeEnum(Integer code, String value) {
this.code = code;
this.value = value;
}
public static EiBlock generatorEiBlock() {
EiBlock block = new EiBlock("contract_type_block_id");
List<Map<String, Object>> rows = new ArrayList<Map<String, Object>>() {{
add(new HashMap<String, Object>() {{
put(HGConstants.TEXT_FIELD, CGSH.code + "-" + CGSH.value);
put(HGConstants.VALUE_FIELD, CGSH.code);
}});
add(new HashMap<String, Object>() {{
put(HGConstants.TEXT_FIELD, LZHT.code + "-" + LZHT.value);
put(HGConstants.VALUE_FIELD, LZHT.code);
}});
add(new HashMap<String, Object>() {{
put(HGConstants.TEXT_FIELD, ZLHT.code + "-" + ZLHT.value);
put(HGConstants.VALUE_FIELD, ZLHT.code);
}});
}};
block.setRows(rows);
return block;
}
public static ContractTypeEnum getEnumByCode(Integer code){
for (ContractTypeEnum en : ContractTypeEnum.values()){
if(code.compareTo(en.code)==0){
return en;
}
}
return null;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
......@@ -65,6 +65,8 @@ public class HGCG003B extends DaoEPBase {
public static final String FIELD_IS_INVOICING = "isInvoicing"; /* 是否开票 0否 1是*/
public static final String FIELD_PROJ_CODE = "projCode"; /* 项目编码*/
public static final String FIELD_PROJ_NAME = "projName"; /* 项目名称*/
public static final String FIELD_SUP_CODE = "supCode"; /* 供应商编码*/
public static final String FIELD_SUP_NAME = "supName"; /* 供应商名称*/
public static final String FIELD_CALCULATION_METHOD = "calculationMethod"; /* 计算方式 0-数量乘单价 1-重量乘单价*/
public static final String FIELD_CANCEL_AMOUNT = "cancelAmount"; /* 核销金额*/
public static final String FIELD_UN_CANCEL_AMOUNT = "unCancelAmount"; /* 未核销金额*/
......@@ -163,6 +165,8 @@ public class HGCG003B extends DaoEPBase {
private Integer isInvoicing = 0; /* 是否开票 0否 1是*/
private String projCode = " "; /* 项目编码*/
private String projName = " "; /* 项目名称*/
private String supCode = " "; /* 供应商编码*/
private String supName = " "; /* 供应商名称*/
private Integer calculationMethod = 0; /* 计算方式 0-数量乘单价 1-重量乘单价*/
private BigDecimal cancelAmount = new BigDecimal("0"); /* 核销金额*/
private BigDecimal unCancelAmount = new BigDecimal("0"); /* 未核销金额*/
......@@ -384,6 +388,14 @@ public class HGCG003B extends DaoEPBase {
eiColumn = new EiColumn(FIELD_PROJ_NAME);
eiColumn.setDescName("项目名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_SUP_CODE);
eiColumn.setDescName("供应商编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_SUP_NAME);
eiColumn.setDescName("供应商名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_CALCULATION_METHOD);
eiColumn.setDescName("计算方式 0-数量乘单价 1-重量乘单价");
......@@ -1132,6 +1144,22 @@ public class HGCG003B extends DaoEPBase {
this.unCancelAmount = unCancelAmount;
}
public String getSupCode() {
return supCode;
}
public void setSupCode(String supCode) {
this.supCode = supCode;
}
public String getSupName() {
return supName;
}
public void setSupName(String supName) {
this.supName = supName;
}
/**
* get the value from Map.
*
......@@ -1183,6 +1211,8 @@ public class HGCG003B extends DaoEPBase {
setIsInvoicing(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_IS_INVOICING)), isInvoicing));
setProjCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROJ_CODE)), projCode));
setProjName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROJ_NAME)), projName));
setSupCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_SUP_CODE)), supCode));
setSupName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_SUP_NAME)), supName));
setCalculationMethod(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_CALCULATION_METHOD)), calculationMethod));
setCancelAmount(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_CANCEL_AMOUNT)), cancelAmount));
setUnCancelAmount(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_UN_CANCEL_AMOUNT)), unCancelAmount));
......@@ -1238,6 +1268,8 @@ public class HGCG003B extends DaoEPBase {
map.put(FIELD_IS_INVOICING, StringUtils.toString(isInvoicing, eiMetadata.getMeta(FIELD_IS_INVOICING)));
map.put(FIELD_PROJ_CODE, StringUtils.toString(projCode, eiMetadata.getMeta(FIELD_PROJ_CODE)));
map.put(FIELD_PROJ_NAME, StringUtils.toString(projName, eiMetadata.getMeta(FIELD_PROJ_NAME)));
map.put(FIELD_SUP_CODE, StringUtils.toString(supCode, eiMetadata.getMeta(FIELD_SUP_CODE)));
map.put(FIELD_SUP_NAME, StringUtils.toString(supName, eiMetadata.getMeta(FIELD_SUP_NAME)));
map.put(FIELD_CALCULATION_METHOD, StringUtils.toString(calculationMethod, eiMetadata.getMeta(FIELD_CALCULATION_METHOD)));
map.put(FIELD_CANCEL_AMOUNT, StringUtils.toString(cancelAmount, eiMetadata.getMeta(FIELD_CANCEL_AMOUNT)));
map.put(FIELD_UN_CANCEL_AMOUNT, StringUtils.toString(unCancelAmount, eiMetadata.getMeta(FIELD_UN_CANCEL_AMOUNT)));
......
......@@ -329,6 +329,8 @@
UPDATE ${hggpSchema}.HGCG003A
SET
IS_INVOICING = #isInvoicing#,
CANCEL_AMOUNT = #cancelAmount#,
UN_CANCEL_AMOUNT = #unCancelAmount#,
<include refid="updateRevise"/>
WHERE RECEIVE_NO = #receiveNo#
</update>
......
......@@ -6,6 +6,7 @@ import com.baosight.hggp.core.enums.DeleteFlagEnum;
import com.baosight.hggp.hg.cg.domain.*;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.constant.HGSqlConstant;
import com.baosight.hggp.hg.cw.domain.HGCW013;
import com.baosight.hggp.hg.kc.tools.HGKCTools;
import com.baosight.hggp.hg.zl.domain.HGZL001;
import com.baosight.hggp.util.AssertUtils;
......@@ -696,17 +697,25 @@ public class HGCGTools {
/**
* 修改是否开票
*
* @param receiveNo
* @param isInvoicing
*/
public static void updateIsInvoicing(String receiveNo, Integer isInvoicing) {
AssertUtils.isEmpty(receiveNo, "收货单号不能为空!");
AssertUtils.isNull(isInvoicing, "是否开票不能为空!");
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("receiveNo", receiveNo);
paramMap.put("isInvoicing", isInvoicing);
DaoUtils.update(HGSqlConstant.HgCg003A.UPDATE_IS_INVOICING, paramMap);
* @param hgcw013
*/
public static void updateIsInvoicing(HGCW013 hgcw013) {
AssertUtils.isNull(hgcw013, "采购收货详情不能为空!");
List<HGCG003B> hgcg003Bs =DaoBase.getInstance().query(HGCG003B.QUERY, new HashMap<String, Object>(){{
put(HGCG003B.FIELD_RECEIVE_NO, hgcw013.getSettlementNumber());
}});
List<HGCG003B> hgcg003BList = hgcg003Bs.stream().filter(item->
item.getInventCode().equals(hgcw013.getInventCode())
&& item.getSpec().equals(hgcw013.getSpec())
).collect(Collectors.toList());
if (hgcg003BList.size() > 0){
HGCG003B hgcg003B = hgcg003BList.get(0);
hgcg003B.setIsInvoicing(HGConstant.CgIsInvoicing.S_0);
hgcg003B.setCancelAmount(hgcg003B.getCancelAmount().subtract(hgcw013.getTotalContractPriceIncluding()));
hgcg003B.setUnCancelAmount(hgcg003B.getUnCancelAmount().add(hgcw013.getTotalContractPriceIncluding()));
DaoUtils.update(HGCG003B.UPDATE, hgcg003B);
}
}
/**
......
......@@ -46,6 +46,9 @@ public class HGCW013 extends DaoEPBase {
public static final String FIELD_UPDATED_TIME = "updatedTime"; /* 记录修改时间*/
public static final String FIELD_DEP_CODE = "depCode"; /* 部门编码*/
public static final String FIELD_COMPANY_CODES = "companyCodes";/*用户角色权限*/
public static final String FIELD_INVENT_CODE = "inventCode"; /* 存货编码*/
public static final String FIELD_INVENT_NAME = "inventName"; /* 存货名称*/
public static final String FIELD_SPEC = "spec"; /* 规格*/
public static final String COL_ID = "ID";
public static final String COL_MAIN_ID = "MAIN_ID"; /* 主表ID*/
......@@ -95,6 +98,9 @@ public class HGCW013 extends DaoEPBase {
private String updatedName = " "; /* 记录修改名称*/
private String updatedTime = " "; /* 记录修改时间*/
private String depCode = " "; /* 部门编码*/
private String inventCode = " "; /* 存货编码*/
private String inventName = " "; /* 存货名称*/
private String spec = " "; /* 规格*/
/**
* initialize the metadata.
......@@ -190,7 +196,17 @@ public class HGCW013 extends DaoEPBase {
eiColumn.setDescName("部门编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_INVENT_CODE);
eiColumn.setDescName("存货编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_INVENT_NAME);
eiColumn.setDescName("存货名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_SPEC);
eiColumn.setDescName("规格");
eiMetadata.addMeta(eiColumn);
}
/**
......@@ -522,6 +538,30 @@ public class HGCW013 extends DaoEPBase {
this.depCode = depCode;
}
public String getInventCode() {
return inventCode;
}
public void setInventCode(String inventCode) {
this.inventCode = inventCode;
}
public String getInventName() {
return inventName;
}
public void setInventName(String inventName) {
this.inventName = inventName;
}
public String getSpec() {
return spec;
}
public void setSpec(String spec) {
this.spec = spec;
}
/**
* get the value from Map.
*
......@@ -551,6 +591,9 @@ public class HGCW013 extends DaoEPBase {
setUpdatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_NAME)), updatedName));
setUpdatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_TIME)), updatedTime));
setDepCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DEP_CODE)), depCode));
setInventCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_CODE)), inventCode));
setInventName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_NAME)), inventName));
setSpec(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_SPEC)), spec));
}
/**
......@@ -581,6 +624,9 @@ public class HGCW013 extends DaoEPBase {
map.put(FIELD_UPDATED_NAME, StringUtils.toString(updatedName, eiMetadata.getMeta(FIELD_UPDATED_NAME)));
map.put(FIELD_UPDATED_TIME, StringUtils.toString(updatedTime, eiMetadata.getMeta(FIELD_UPDATED_TIME)));
map.put(FIELD_DEP_CODE, StringUtils.toString(depCode, eiMetadata.getMeta(FIELD_DEP_CODE)));
map.put(FIELD_INVENT_CODE, StringUtils.toString(inventCode, eiMetadata.getMeta(FIELD_INVENT_CODE)));
map.put(FIELD_INVENT_NAME, StringUtils.toString(inventName, eiMetadata.getMeta(FIELD_INVENT_NAME)));
map.put(FIELD_SPEC, StringUtils.toString(spec, eiMetadata.getMeta(FIELD_SPEC)));
return map;
}
......
......@@ -2,11 +2,13 @@ package com.baosight.hggp.hg.cw.service;
import com.baosight.eplat.utils.StringUtils;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.ContractTypeEnum;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.common.ReviewStatusEnum;
import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.cg.constant.HgCgConst;
import com.baosight.hggp.hg.cg.domain.HGCG003;
import com.baosight.hggp.hg.cg.domain.HGCG003B;
import com.baosight.hggp.hg.cg.tools.HGCGTools;
......@@ -135,6 +137,8 @@ public class ServiceHGCW012 extends ServiceBase {
}}
);
AssertUtils.isEmpty(hgcg003BList, "未找到匹配的采购收货");
hgcw012.setRemainingAmount(hgcw012.getTotalContractPriceIncluding());
hgcw012.setContractType(ContractTypeEnum.CGSH.getCode());
DaoUtils.insert(HGCW012.INSERT, hgcw012);
BigDecimal taxPoints = new BigDecimal(hgcw012.getTaxPoints()); // 假设这是以整数形式给出的税率,比如17表示17%
BigDecimal taxRateAsDecimal = taxPoints.divide(new BigDecimal("100")).add(new BigDecimal("1")); // 将税率 转换为小数形式
......@@ -142,10 +146,10 @@ public class ServiceHGCW012 extends ServiceBase {
BigDecimal unCancelAmount =hgcg003BList.stream().map(HGCG003B::getUnCancelAmount).reduce(BigDecimal.ZERO,BigDecimal::add);
AssertUtils.isGt(totalContractPriceIncluding, unCancelAmount, "发票金额大于供应商未开票金额!");
boolean flag = true;
StringBuffer settlementNumber = new StringBuffer();
List<String> settlementNumber = new ArrayList<>();
//生成明细表
for (HGCG003B hgcg003B : hgcg003BList) {
settlementNumber.append(hgcg003B.getReceiveNo()).append(",");
settlementNumber.add(hgcg003B.getReceiveNo());
HGCW013 hgcw013 = new HGCW013();
BeanUtils.copyProperties(hgcg003B, hgcw013,"id","accountCode","depCode","createdBy","createdName","createdTime","updatedBy","updatedName","updatedTime");
......@@ -182,7 +186,7 @@ public class ServiceHGCW012 extends ServiceBase {
}
//跟新采购收票状态
if (ObjectUtils.isEmpty(hgcg003B.getCalculationMethod())){
hgcg003B.setCalculationMethod(0);
hgcg003B.setCalculationMethod(HgCgConst.CalculationMethod.S0);
}
DaoUtils.update(HGCG003B.UPDATE, hgcg003B);
......@@ -195,7 +199,7 @@ public class ServiceHGCW012 extends ServiceBase {
break;
}
}
hgcw012.setSettlementNumber(settlementNumber.toString().substring(0, settlementNumber.length() - 1));
hgcw012.setSettlementNumber(settlementNumber.stream().distinct().collect(Collectors.joining(",")));
DaoUtils.update(HGCW012.UPDATE, hgcw012);
}
......@@ -228,11 +232,13 @@ public class ServiceHGCW012 extends ServiceBase {
}
String[] settlementNumbers = hgcw012.getSettlementNumber().split(",");
List<HGCW013> results = HGCWTools.HgCw013.getMainId(hgcw012.getId());
Map<String, HGCW013> hgcw013Map = results.stream().collect(Collectors.toMap(HGCW013::getSettlementNumber, item->item));
for (String settlementNumber : settlementNumbers) {
Map<String, BigDecimal> parmap = results.stream().filter(item-> Objects.equals(item.getSettlementNumber(), settlementNumber)).collect(Collectors.toMap(HGCW013::getSettlementNumber, HGCW013::getTotalContractPriceIncluding,(v1, v2) -> v2));
if (hgcw012.getContractType() == 1) {
// 更新采购收票状态
HGCGTools.HgCg003.updateIsInvoicing(settlementNumber, HGConstant.CgIsInvoicing.S_0);
HGCGTools.HgCg003.updateIsInvoicing(hgcw013Map.get(settlementNumber));
DaoUtils.update(HGCW013.DELETE_MAIN, hgcw012);
}else if (hgcw012.getContractType() == 2){
......@@ -275,7 +281,7 @@ public class ServiceHGCW012 extends ServiceBase {
hgcw012.setReviewStatus(0);
hgcw012.setBillState(0);
hgcw012.setBillTybe(1);
hgcw012.setContractType(2);
hgcw012.setContractType(ContractTypeEnum.LZHT.getCode());
//hgcw012.setSigningDate(DateUtils.shortDate());
hgcw012.setReceiveDate(DateUtils.shortDate());
BigDecimal totalContractPriceIncluding = BigDecimal.ZERO;
......@@ -300,7 +306,7 @@ public class ServiceHGCW012 extends ServiceBase {
hgcw012.setRemainingAmount(new BigDecimal(decimalFormat.format(totalContractPriceIncluding)));
hgcw012.setProjCode(hgcw013List.get(0).getProjCode());
hgcw012.setProjName(hgcw013List.get(0).getProjName());
this.add(hgcw012);
DaoUtils.insert(HGCW012.INSERT, hgcw012);
//生成明细表
for (HGCW013 hgcw013 : hgcw013List) {
......@@ -376,7 +382,7 @@ public class ServiceHGCW012 extends ServiceBase {
hgcw012.setReviewStatus(0);
hgcw012.setBillState(0);
hgcw012.setBillTybe(1);
hgcw012.setContractType(1);
hgcw012.setContractType(ContractTypeEnum.CGSH.getCode());
//hgcw012.setSigningDate(DateUtils.shortDate());
hgcw012.setReceiveDate(DateUtils.shortDate());
hgcw012.setPartyA(hgcw013List.get(0).getPartyA());
......@@ -403,14 +409,19 @@ public class ServiceHGCW012 extends ServiceBase {
//hgcw012.setSettlementNumber(settlementNumber.toString().substring(0, settlementNumber.length() - 1));
//hgcw012.setRemainingAmount(new BigDecimal(decimalFormat.format(totalContractPriceIncluding)));
this.add(hgcw012);
DaoUtils.insert(HGCW012.INSERT, hgcw012);
//生成明细表
for (HGCW013 hgcw013 : hgcw013List) {
hgcw013.setMainId(hgcw012.getId());
hgcw013.setId(null);
//跟新采购收票状态
HGCGTools.HgCg003.updateIsInvoicing(hgcw013.getSettlementNumber(), HGConstant.CgIsInvoicing.S_1);
Map<String, Object> paramMap = new HashMap<>();
paramMap.put(HGCG003B.FIELD_RECEIVE_NO, hgcw013.getSettlementNumber());
paramMap.put(HGCG003B.FIELD_IS_INVOICING, HGConstant.CgIsInvoicing.S_1);
paramMap.put(HGCG003B.FIELD_CANCEL_AMOUNT, hgcw013.getTotalContractPriceIncluding());
paramMap.put(HGCG003B.FIELD_UN_CANCEL_AMOUNT, 0);
DaoUtils.update(HGSqlConstant.HgCg003A.UPDATE_IS_INVOICING, paramMap);
this.addHGCW013(hgcw013);
}
} else {
......@@ -475,7 +486,7 @@ public class ServiceHGCW012 extends ServiceBase {
hgcw012.setReviewStatus(0);
hgcw012.setBillState(0);
hgcw012.setBillTybe(1);
hgcw012.setContractType(3);
hgcw012.setContractType(ContractTypeEnum.ZLHT.getCode());
//hgcw012.setSigningDate(DateUtils.shortDate());
hgcw012.setReceiveDate(DateUtils.shortDate());
BigDecimal totalContractPriceIncluding = BigDecimal.ZERO;
......@@ -500,7 +511,7 @@ public class ServiceHGCW012 extends ServiceBase {
hgcw012.setRemainingAmount(new BigDecimal(decimalFormat.format(totalContractPriceIncluding)));
hgcw012.setProjCode(hgcw013List.get(0).getProjCode());
hgcw012.setProjName(hgcw013List.get(0).getProjName());
this.add(hgcw012);
DaoUtils.insert(HGCW012.INSERT, hgcw012);
//生成明细表
for (HGCW013 hgcw013 : hgcw013List) {
......
......@@ -189,7 +189,7 @@
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
RECEIVE_DATE desc ,SIGNING_DATE desc, ID desc
RECEIVE_DATE desc, ID desc
</isEmpty>
</dynamic>
......
......@@ -570,6 +570,15 @@
<isNotEmpty prepend=" AND " property="isUnCancelAmount">
A.UN_CANCEL_AMOUNT > #isUnCancelAmount#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projCode">
A.PROJ_CODE = #projCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projName">
A.PROJ_NAME LIKE CONCAT('%', #projName# ,'%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="supCode">
B.SUP_CODE = #supCode#
</isNotEmpty>
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
......
......@@ -47,7 +47,10 @@
UPDATED_BY as "updatedBy", <!-- 记录修改者 -->
UPDATED_NAME as "updatedName", <!-- 记录修改名称 -->
UPDATED_TIME as "updatedTime", <!-- 记录修改时间 -->
DEP_CODE as "depCode" <!-- 部门编码 -->
DEP_CODE as "depCode", <!-- 部门编码 -->
INVENT_CODE as "inventCode",
INVENT_NAME as "inventName",
SPEC as "spec"
</sql>
<sql id="condition">
<include refid="HGXSDataAuth.authCondition"/>
......@@ -117,6 +120,15 @@
<isNotEmpty prepend=" AND " property="companyCodes">
COMPANY_CODE IN <iterate close=")" open="(" conjunction="," property="companyCodes">#companyCodes[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventCode">
INVENT_CODE = #inventCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventName">
INVENT_NAME = #inventName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="spec">
SPEC = #spec#
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
......@@ -222,9 +234,12 @@
UPDATED_BY, <!-- 记录修改者 -->
UPDATED_NAME, <!-- 记录修改名称 -->
UPDATED_TIME, <!-- 记录修改时间 -->
DEP_CODE <!-- 部门编码 -->
DEP_CODE, <!-- 部门编码 -->
INVENT_CODE, <!-- 存货编码 -->
INVENT_NAME, <!-- 存货名称 -->
SPEC <!-- 规格 -->
)
VALUES (#id#, #mainId#, #accountCode#, #companyCode#, #companyName#, #projCode#, #projName#, #settlementNumber#, #billNumber#, #partyA#, #taxPoints#, #thisSettlementTax#, #thisSettlementAmount#, #totalContractPriceIncluding#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #depCode#)
VALUES (#id#, #mainId#, #accountCode#, #companyCode#, #companyName#, #projCode#, #projName#, #settlementNumber#, #billNumber#, #partyA#, #taxPoints#, #thisSettlementTax#, #thisSettlementAmount#, #totalContractPriceIncluding#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #depCode#, #inventCode#, #inventName#, #spec#)
</insert>
<delete id="delete">
......@@ -257,7 +272,10 @@
UPDATED_BY = #updatedBy#, <!-- 记录修改者 -->
UPDATED_NAME = #updatedName#, <!-- 记录修改名称 -->
UPDATED_TIME = #updatedTime#, <!-- 记录修改时间 -->
DEP_CODE = #depCode# <!-- 部门编码 -->
DEP_CODE = #depCode#, <!-- 部门编码 -->
INVENT_CODE = #inventCode#, <!-- 存货编码 -->
INVENT_NAME = #inventName#, <!-- 存货名称 -->
SPEC = #spec# <!-- 规格 -->
WHERE
ID = #id#
</update>
......
......@@ -932,26 +932,26 @@ public class HGCWTools {
List<HGCW013> HGCW013List = new ArrayList<>();
if (CollectionUtils.isNotEmpty(rows)) {
rows.forEach(row -> {
HGCW013 HGCW013 = new HGCW013();
HGCW013.fromMap(row);
HGCW013 hgcw013 = new HGCW013();
hgcw013.fromMap(row);
String settlementNumber = row.get("receiveNo").toString();
String partA = row.get("supName").toString();
String partA = row.get("supCode").toString();
String remainingAmount = row.get("thisSettlementAmount").toString();
BigDecimal taxPoints = new BigDecimal("13"); // 假设这是以整数形式给出的税率,比如17表示17%
BigDecimal thisAmount = new BigDecimal(row.get("thisSettlementAmount").toString());
BigDecimal taxRateAsDecimal = taxPoints.divide(new BigDecimal("100")).add(new BigDecimal("1")); // 将税率转换为小数形式
BigDecimal thisSettlementAmount = thisAmount.divide(taxRateAsDecimal, 2, RoundingMode.HALF_UP);
BigDecimal thisSettlementTax = thisAmount.subtract(thisSettlementAmount); // 计算税额
HGCW013.setPartyA(partA);
HGCW013.setTaxPoints(new Integer(String.valueOf(taxPoints)));
HGCW013.setTotalContractPriceIncluding(new BigDecimal(remainingAmount));
HGCW013.setSettlementNumber(settlementNumber);
HGCW013.setThisSettlementTax(thisSettlementTax.toString());
HGCW013.setThisSettlementAmount(thisSettlementAmount.toString());
hgcw013.setPartyA(partA);
hgcw013.setTaxPoints(new Integer(String.valueOf(taxPoints)));
hgcw013.setTotalContractPriceIncluding(new BigDecimal(remainingAmount));
hgcw013.setSettlementNumber(settlementNumber);
hgcw013.setThisSettlementTax(thisSettlementTax.toString());
hgcw013.setThisSettlementAmount(thisSettlementAmount.toString());
if (mainId != null) {
HGCW013.setMainId(mainId);
hgcw013.setMainId(mainId);
}
HGCW013List.add(HGCW013);
HGCW013List.add(hgcw013);
});
}
return HGCW013List;
......
......@@ -188,8 +188,8 @@ function contractDetailFunc(id) {
JSColorbox.open({
href: "HGCW010B?methodName=initLoad&inqu_status-0-mainId=" + id + "&efParentFormEname=HGCW010",
title: "<div style='text-align: center;'>开票清单</div>",
width: "90%",
height: "90%",
width: "75%",
height: "75%",
callbackName: windowCallback
});
}
......
......@@ -47,6 +47,16 @@ $(function() {
defaultValue: function () {
return currShortDate();
}
},{
field: "thisSettlementAmount",
template: function (item) {
return kendo.format("{0:C3}",parseFloat(item.thisSettlementAmount));
}
},{
field: "thisSettlementTax",
template: function (item) {
return kendo.format("{0:C3}",parseFloat(item.thisSettlementTax));
}
}],
loadComplete: function (grid) {
$("#SELECT_BILL").on("click",addFunc);
......
......@@ -70,16 +70,16 @@
columnTemplate="#=textField#" itemTemplate="#=textField#" enable="true" >
<EF:EFCodeOption codeName="hggp.cw.taxPoints"/>
</EF:EFComboColumn>
<EF:EFColumn ename="totalContractPriceIncluding" cname="发票总额" width="120" enable="true" format="{0:N3}" editType="text"
displayType="0.000" sort="true" align="right" readonly="true"
<EF:EFColumn ename="totalContractPriceIncluding" cname="发票总额" width="120" enable="true" format="{0:C3}" editType="text"
displayType="0.000" sort="true" align="right" readonly="true" defaultValue="0"
data-regex="/^-?[0-9]{1,15}([.][0-9]{1,3})?$/" maxLength="15" required="true"
data-errorprompt="请输入数字,该值最大可设置15位整数和3位小数!"/>
<EF:EFColumn ename="thisSettlementAmount" cname="不含税金额" width="120" enable="false" format="{0:N3}" editType="text"
displayType="0.000" sort="true" align="right"
<EF:EFColumn ename="thisSettlementAmount" cname="不含税金额" width="120" enable="false" format="{0:C3}" editType="text"
displayType="0.000" sort="true" align="right" defaultValue="0"
data-regex="/^-?[0-9]{1,15}([.][0-9]{1,3})?$/" maxLength="15" required="false"
data-errorprompt="请输入数字,该值最大可设置15位整数和3位小数!"/>
<EF:EFColumn ename="thisSettlementTax" cname="税额" width="120" enable="false" format="{0:N3}" editType="text"
displayType="0.000" sort="true" align="right"
<EF:EFColumn ename="thisSettlementTax" cname="税额" width="120" enable="false" format="{0:C3}" editType="text"
displayType="0.000" sort="true" align="right" defaultValue="0"
data-regex="/^-?[0-9]{1,15}([.][0-9]{1,3})?$/" maxLength="15" required="false"
data-errorprompt="请输入数字,该值最大可设置15位整数和3位小数!"/>
<EF:EFComboColumn ename="reviewStatus" cname="审批状态" width="100" align="center" required="true" defaultValue="0"
......
......@@ -166,6 +166,7 @@ $(function () {
field: "projCode",
title: "项目编号",
headerTemplate: "<span style='color: '>项目编号 </span>",
width: 140,
enable: false,
locked: false
},
......@@ -173,6 +174,7 @@ $(function () {
field: "projName",
title: "项目名称",
headerTemplate: "<span style='color: '>项目名称 </span>",
width: 200,
enable: false,
locked: false
},
......@@ -250,11 +252,10 @@ $(function () {
locked: false,
template: function (item) {
if (isBlank(item.thisSettlementAmount)){
item.thisSettlementAmount = item.amount;
resultGrid.setCellValue(item, "thisSettlementAmount", item.amount)
item.thisSettlementAmount = item.taxIncludeAmount;
resultGrid.setCellValue(item, "thisSettlementAmount", item.taxIncludeAmount)
}
return item.thisSettlementAmount
return kendo.format("{0:C3}",parseFloat(item.thisSettlementAmount));
}
}],
loadComplete: function(grid) {
......
......@@ -85,6 +85,7 @@ function saveFunc() {
}
});
}
function deleteFunc() {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
......
......@@ -11,17 +11,17 @@
<EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="no" isFloat="true" autoBind="false" checkMode="row">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="companyName" cname="公司名称" width="120" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="projName" cname="项目名称" width="120" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="companyName" cname="公司名称" width="200" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="projName" cname="项目名称" width="200" enable="false" readonly="true" align="center"/>
<EF:EFComboColumn ename="partyA" cname="供应商名称" blockName="sup_record_block_id"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" readonly="false" width="210" required="true"
maxLength="16" readonly="false" width="200" required="true"
align="center" filter="contains" sort="true">
</EF:EFComboColumn>
<%--<EF:EFColumn ename="partyA" cname="供应商名称" width="120" enable="false" readonly="true" align="center"/>--%>
<EF:EFColumn ename="settlementNumber" cname="来源单号" width="120" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="totalContractPriceIncluding" cname="收款总额" width="120" format="{0:N3}" align="right" enable="false" readonly="true"/>
<EF:EFColumn ename="totalContractPriceIncluding" cname="收款总额" width="120" format="{0:C3}" align="right" enable="false" readonly="true"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
......
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