Commit 164bf50b by liuyang

2024-09-10 采购发票录入发票总金额,系统自动核销采购收货明细,按照相同供应商、从最早日期往后自动核销

parent 883aca87
...@@ -164,7 +164,7 @@ public class HGCG003 extends DaoEPBase { ...@@ -164,7 +164,7 @@ public class HGCG003 extends DaoEPBase {
private BigDecimal taxAmount = new BigDecimal("0"); /* 税额*/ private BigDecimal taxAmount = new BigDecimal("0"); /* 税额*/
private BigDecimal taxRate = new BigDecimal("0"); /* 税率*/ private BigDecimal taxRate = new BigDecimal("0"); /* 税率*/
private Integer inventTypeDetail; /* 存货类型大类*/ private Integer inventTypeDetail; /* 存货类型大类*/
private Integer isInvoicing; /* 是否开票*/ private Integer isInvoicing = 0; /* 是否开票*/
private Integer source; /* 数据来源 根据采购数据来源小代码 目前0默认采购合同,1手动录入*/ private Integer source; /* 数据来源 根据采购数据来源小代码 目前0默认采购合同,1手动录入*/
private String projCode = " "; /* 项目编码*/ private String projCode = " "; /* 项目编码*/
private String projName = " "; /* 项目名称*/ private String projName = " "; /* 项目名称*/
......
...@@ -66,6 +66,8 @@ public class HGCG003B extends DaoEPBase { ...@@ -66,6 +66,8 @@ public class HGCG003B extends DaoEPBase {
public static final String FIELD_PROJ_CODE = "projCode"; /* 项目编码*/ public static final String FIELD_PROJ_CODE = "projCode"; /* 项目编码*/
public static final String FIELD_PROJ_NAME = "projName"; /* 项目名称*/ public static final String FIELD_PROJ_NAME = "projName"; /* 项目名称*/
public static final String FIELD_CALCULATION_METHOD = "calculationMethod"; /* 计算方式 0-数量乘单价 1-重量乘单价*/ 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"; /* 未核销金额*/
public static final String COL_ID = "ID"; public static final String COL_ID = "ID";
public static final String COL_ACCOUNT_CODE = "ACCOUNT_CODE"; /* 企业编码*/ public static final String COL_ACCOUNT_CODE = "ACCOUNT_CODE"; /* 企业编码*/
...@@ -158,10 +160,12 @@ public class HGCG003B extends DaoEPBase { ...@@ -158,10 +160,12 @@ public class HGCG003B extends DaoEPBase {
private BigDecimal taxRate = new BigDecimal("0"); /* 税率*/ private BigDecimal taxRate = new BigDecimal("0"); /* 税率*/
private Integer inventTypeDetail; /* 存货类型大类*/ private Integer inventTypeDetail; /* 存货类型大类*/
private Long primaryId = new Long(0); /* 主表id*/ private Long primaryId = new Long(0); /* 主表id*/
private Integer isInvoicing; /* 是否开票 0否 1是*/ private Integer isInvoicing = 0; /* 是否开票 0否 1是*/
private String projCode = " "; /* 项目编码*/ private String projCode = " "; /* 项目编码*/
private String projName = " "; /* 项目名称*/ private String projName = " "; /* 项目名称*/
private Integer calculationMethod; /* 计算方式 0-数量乘单价 1-重量乘单价*/ private Integer calculationMethod; /* 计算方式 0-数量乘单价 1-重量乘单价*/
private BigDecimal cancelAmount = new BigDecimal("0"); /* 核销金额*/
private BigDecimal unCancelAmount = new BigDecimal("0"); /* 未核销金额*/
/** /**
* initialize the metadata. * initialize the metadata.
...@@ -384,8 +388,20 @@ public class HGCG003B extends DaoEPBase { ...@@ -384,8 +388,20 @@ public class HGCG003B extends DaoEPBase {
eiColumn = new EiColumn(FIELD_CALCULATION_METHOD); eiColumn = new EiColumn(FIELD_CALCULATION_METHOD);
eiColumn.setDescName("计算方式 0-数量乘单价 1-重量乘单价"); eiColumn.setDescName("计算方式 0-数量乘单价 1-重量乘单价");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_CANCEL_AMOUNT);
eiColumn.setType("N");
eiColumn.setScaleLength(3);
eiColumn.setFieldLength(12);
eiColumn.setDescName("核销金额");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_UN_CANCEL_AMOUNT);
eiColumn.setType("N");
eiColumn.setScaleLength(3);
eiColumn.setFieldLength(12);
eiColumn.setDescName("未核销金额");
eiMetadata.addMeta(eiColumn);
} }
/** /**
...@@ -1099,6 +1115,23 @@ public class HGCG003B extends DaoEPBase { ...@@ -1099,6 +1115,23 @@ public class HGCG003B extends DaoEPBase {
public void setCalculationMethod(Integer calculationMethod) { public void setCalculationMethod(Integer calculationMethod) {
this.calculationMethod = calculationMethod; this.calculationMethod = calculationMethod;
} }
public BigDecimal getCancelAmount() {
return cancelAmount;
}
public void setCancelAmount(BigDecimal cancelAmount) {
this.cancelAmount = cancelAmount;
}
public BigDecimal getUnCancelAmount() {
return unCancelAmount;
}
public void setUnCancelAmount(BigDecimal unCancelAmount) {
this.unCancelAmount = unCancelAmount;
}
/** /**
* get the value from Map. * get the value from Map.
* *
...@@ -1151,6 +1184,8 @@ public class HGCG003B extends DaoEPBase { ...@@ -1151,6 +1184,8 @@ public class HGCG003B extends DaoEPBase {
setProjCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROJ_CODE)), projCode)); setProjCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROJ_CODE)), projCode));
setProjName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROJ_NAME)), projName)); setProjName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROJ_NAME)), projName));
setCalculationMethod(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_CALCULATION_METHOD)), calculationMethod)); 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));
} }
/** /**
...@@ -1204,6 +1239,8 @@ public class HGCG003B extends DaoEPBase { ...@@ -1204,6 +1239,8 @@ public class HGCG003B extends DaoEPBase {
map.put(FIELD_PROJ_CODE, StringUtils.toString(projCode, eiMetadata.getMeta(FIELD_PROJ_CODE))); 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_PROJ_NAME, StringUtils.toString(projName, eiMetadata.getMeta(FIELD_PROJ_NAME)));
map.put(FIELD_CALCULATION_METHOD, StringUtils.toString(calculationMethod, eiMetadata.getMeta(FIELD_CALCULATION_METHOD))); 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)));
return map; return map;
} }
......
...@@ -240,6 +240,7 @@ public class ServiceHGCG003A extends ServiceBase { ...@@ -240,6 +240,7 @@ public class ServiceHGCG003A extends ServiceBase {
cg003B.setReceiveQty(fCg002B.getBcReceiveQty()); cg003B.setReceiveQty(fCg002B.getBcReceiveQty());
cg003B.setReceiveWeight(fCg002B.getReceiveWeight()); cg003B.setReceiveWeight(fCg002B.getReceiveWeight());
cg003B.setContractDetailId(fCg002B.getId()); cg003B.setContractDetailId(fCg002B.getId());
cg003B.setUnCancelAmount(fCg002B.getTaxIncludeAmount());
DaoUtils.insert(HGCG003B.INSERT, cg003B); DaoUtils.insert(HGCG003B.INSERT, cg003B);
// 更新合同状态 // 更新合同状态
HGCGTools.HgCg002B.updateReceive(dbCg002b, cg003B.getReceiveQty()); HGCGTools.HgCg002B.updateReceive(dbCg002b, cg003B.getReceiveQty());
......
...@@ -204,6 +204,7 @@ public class ServiceHGCG003B extends ServiceBase { ...@@ -204,6 +204,7 @@ public class ServiceHGCG003B extends ServiceBase {
hgcg003B.setCompanyName(cg003.getCompanyName()); hgcg003B.setCompanyName(cg003.getCompanyName());
hgcg003B.setDepCode(cg003.getDepCode()); hgcg003B.setDepCode(cg003.getDepCode());
hgcg003B.setAccountCode(cg003.getAccountCode()); hgcg003B.setAccountCode(cg003.getAccountCode());
hgcg003B.setUnCancelAmount(hgcg003B.getTaxIncludeAmount());
DaoUtils.insert(HGCG003B.INSERT, hgcg003B); DaoUtils.insert(HGCG003B.INSERT, hgcg003B);
} }
...@@ -213,6 +214,7 @@ public class ServiceHGCG003B extends ServiceBase { ...@@ -213,6 +214,7 @@ public class ServiceHGCG003B extends ServiceBase {
* @param hgcg003B * @param hgcg003B
*/ */
private void updateData(HGCG003B hgcg003B) { private void updateData(HGCG003B hgcg003B) {
hgcg003B.setUnCancelAmount(hgcg003B.getTaxIncludeAmount());
DaoUtils.update(HGCG003B.UPDATE, hgcg003B); DaoUtils.update(HGCG003B.UPDATE, hgcg003B);
} }
......
...@@ -46,7 +46,9 @@ ...@@ -46,7 +46,9 @@
IS_INVOICING as "isInvoicing", <!-- 是否开票 0否 1是 --> IS_INVOICING as "isInvoicing", <!-- 是否开票 0否 1是 -->
PROJ_CODE as "projCode", <!-- 项目编码 --> PROJ_CODE as "projCode", <!-- 项目编码 -->
PROJ_NAME as "projName", <!-- 项目名称 --> PROJ_NAME as "projName", <!-- 项目名称 -->
CALCULATION_METHOD as "calculationMethod" <!-- 计算方式 0-数量乘单价 1-重量乘单价 --> CALCULATION_METHOD as "calculationMethod", <!-- 计算方式 0-数量乘单价 1-重量乘单价 -->
CANCEL_AMOUNT as "cancelAmount",
UN_CANCEL_AMOUNT as "unCancelAmount"
</sql> </sql>
<sql id="condition"> <sql id="condition">
...@@ -169,6 +171,12 @@ ...@@ -169,6 +171,12 @@
<isNotEmpty prepend=" AND " property="calculationMethod"> <isNotEmpty prepend=" AND " property="calculationMethod">
CALCULATION_METHOD = #calculationMethod# CALCULATION_METHOD = #calculationMethod#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="cancelAmount">
CANCEL_AMOUNT = #cancelAmount#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="unCancelAmount">
UN_CANCEL_AMOUNT = #unCancelAmount#
</isNotEmpty>
</sql> </sql>
<sql id="idCondition"> <sql id="idCondition">
...@@ -256,7 +264,9 @@ ...@@ -256,7 +264,9 @@
IS_INVOICING, <!-- 是否开票 0否 1是 --> IS_INVOICING, <!-- 是否开票 0否 1是 -->
PROJ_CODE, <!-- 项目编码 --> PROJ_CODE, <!-- 项目编码 -->
PROJ_NAME, <!-- 项目名称 --> PROJ_NAME, <!-- 项目名称 -->
CALCULATION_METHOD <!-- 计算方式 0-数量乘单价 1-重量乘单价 --> CALCULATION_METHOD, <!-- 计算方式 0-数量乘单价 1-重量乘单价 -->
CANCEL_AMOUNT,
UN_CANCEL_AMOUNT
) VALUES ( ) VALUES (
#accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #deleteFlag#, #accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #deleteFlag#,
#companyCode#, #companyName#, #receiveDate#, #receiveNo#, #planNo#, #contractNo#, #companyCode#, #companyName#, #receiveDate#, #receiveNo#, #planNo#, #contractNo#,
...@@ -264,7 +274,7 @@ ...@@ -264,7 +274,7 @@
#material#, #unit#, #length#, #width#, #thick#, #receiveQty#, #deliverQty#, #material#, #unit#, #length#, #width#, #thick#, #receiveQty#, #deliverQty#,
#depositQty#, #receiveUnitWeight#, #receiveWeight#, #status#, #price#, #amount#, #depositQty#, #receiveUnitWeight#, #receiveWeight#, #status#, #price#, #amount#,
#taxIncludeAmount#, #taxAmount#, #taxRate#, #inventTypeDetail#, #primaryId#, #taxIncludeAmount#, #taxAmount#, #taxRate#, #inventTypeDetail#, #primaryId#,
#isInvoicing#, #projCode#, #projName#, #calculationMethod# #isInvoicing#, #projCode#, #projName#, #calculationMethod#, #cancelAmount#, #unCancelAmount#
) )
</insert> </insert>
...@@ -308,7 +318,9 @@ ...@@ -308,7 +318,9 @@
PROJ_CODE = #projCode#, <!-- 项目编码 --> PROJ_CODE = #projCode#, <!-- 项目编码 -->
PROJ_NAME = #projName#, <!-- 项目名称 --> PROJ_NAME = #projName#, <!-- 项目名称 -->
CALCULATION_METHOD = #calculationMethod#, CALCULATION_METHOD = #calculationMethod#,
IS_INVOICING = #isInvoicing# IS_INVOICING = #isInvoicing#,
CANCEL_AMOUNT = #cancelAmount#,
UN_CANCEL_AMOUNT = #unCancelAmount#
WHERE ID = #id# WHERE ID = #id#
</update> </update>
...@@ -404,7 +416,9 @@ ...@@ -404,7 +416,9 @@
b.SUP_CODE as "supCode", <!-- 供应商编码 --> b.SUP_CODE as "supCode", <!-- 供应商编码 -->
b.SUP_NAME as "supName", <!-- 供应商名称 --> b.SUP_NAME as "supName", <!-- 供应商名称 -->
b.PUR_USER_ID as "purUserId", <!-- 采购员 --> b.PUR_USER_ID as "purUserId", <!-- 采购员 -->
b.PUR_USER_NAME as "purUserName" <!-- 采购员名称 --> b.PUR_USER_NAME as "purUserName", <!-- 采购员名称 -->
a.CANCEL_AMOUNT as "cancelAmount",
a.UN_CANCEL_AMOUNT as "unCancelAmount"
FROM ${hggpSchema}.HGCG003A a FROM ${hggpSchema}.HGCG003A a
LEFT JOIN ${hggpSchema}.HGCG003 b ON a.PRIMARY_ID = b.id LEFT JOIN ${hggpSchema}.HGCG003 b ON a.PRIMARY_ID = b.id
WHERE 1=1 WHERE 1=1
...@@ -470,6 +484,12 @@ ...@@ -470,6 +484,12 @@
<isNotEmpty prepend=" AND " property="source"> <isNotEmpty prepend=" AND " property="source">
b.SOURCE = #source# b.SOURCE = #source#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="cancelAmount">
a.CANCEL_AMOUNT = #cancelAmount#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="unCancelAmount">
a.UN_CANCEL_AMOUNT = #unCancelAmount#
</isNotEmpty>
<include refid="idCondition"/> <include refid="idCondition"/>
<dynamic prepend="ORDER BY"> <dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy"> <isNotEmpty property="orderBy">
......
package com.baosight.hggp.hg.cw.domain; package com.baosight.hggp.hg.cw.domain;
import com.baosight.hggp.util.DateUtils;
import com.baosight.iplat4j.core.util.NumberUtils; import com.baosight.iplat4j.core.util.NumberUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import com.baosight.iplat4j.core.ei.EiColumn; import com.baosight.iplat4j.core.ei.EiColumn;
...@@ -820,8 +821,8 @@ public class HGCW012 extends DaoEPBase { ...@@ -820,8 +821,8 @@ public class HGCW012 extends DaoEPBase {
setSettlementNumber(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_SETTLEMENT_NUMBER)), settlementNumber)); setSettlementNumber(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_SETTLEMENT_NUMBER)), settlementNumber));
setBillTybe(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_BILL_TYBE)), billTybe)); setBillTybe(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_BILL_TYBE)), billTybe));
setBillNumber(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_BILL_NUMBER)), billNumber)); setBillNumber(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_BILL_NUMBER)), billNumber));
setBillState(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_BILL_STATE)), billState)); setBillState(NumberUtils.toInteger(StringUtils.toString(DateUtils.formatShort(map.get(FIELD_BILL_STATE))), billState));
setSigningDate(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_SIGNING_DATE)), signingDate)); setSigningDate(StringUtils.defaultIfEmpty(StringUtils.toString(DateUtils.formatShort(map.get(FIELD_SIGNING_DATE))), signingDate));
setPartyA(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PARTY_A)), partyA)); setPartyA(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PARTY_A)), partyA));
setReviewStatus(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_REVIEW_STATUS)), reviewStatus)); setReviewStatus(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_REVIEW_STATUS)), reviewStatus));
setTaxPoints(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_TAX_POINTS)), taxPoints)); setTaxPoints(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_TAX_POINTS)), taxPoints));
......
...@@ -7,8 +7,11 @@ import com.baosight.hggp.common.ReviewStatusEnum; ...@@ -7,8 +7,11 @@ import com.baosight.hggp.common.ReviewStatusEnum;
import com.baosight.hggp.core.dao.DaoBase; import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils; import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.security.UserSessionUtils; import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.cg.domain.HGCG003;
import com.baosight.hggp.hg.cg.domain.HGCG003B;
import com.baosight.hggp.hg.cg.tools.HGCGTools; import com.baosight.hggp.hg.cg.tools.HGCGTools;
import com.baosight.hggp.hg.constant.HGConstant; import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.constant.HGSqlConstant;
import com.baosight.hggp.hg.cw.domain.HGCW006; import com.baosight.hggp.hg.cw.domain.HGCW006;
import com.baosight.hggp.hg.cw.domain.HGCW008; import com.baosight.hggp.hg.cw.domain.HGCW008;
import com.baosight.hggp.hg.cw.domain.HGCW012; import com.baosight.hggp.hg.cw.domain.HGCW012;
...@@ -88,23 +91,18 @@ public class ServiceHGCW012 extends ServiceBase { ...@@ -88,23 +91,18 @@ public class ServiceHGCW012 extends ServiceBase {
for (Map resultRow : resultRows) { for (Map resultRow : resultRows) {
HGCW012 hgcw012 = new HGCW012(); HGCW012 hgcw012 = new HGCW012();
hgcw012.fromMap(resultRow); hgcw012.fromMap(resultRow);
//UserVO userVO = HGCWTools.HgCw002.getUserCompany(); hgcw012.setContractType(0);
//hgcw012.setCompanyCode(userVO.getUsercode()); //String signingDate = DateUtils.formatShort(hgcw012.getSigningDate());
//hgcw012.setCompanyName(userVO.getUsername());
// 获取项目名称
//HGSC001 HGSC001 = HGSCTools.Hgsc001.queryByCode(HGCW012.getProjCode());
//HGCW012.setProjName(HGSC001.getProjName());
String signingDate = DateUtils.formatShort(hgcw012.getSigningDate());
String billState = hgcw012.getBillNumber(); String billState = hgcw012.getBillNumber();
if (StringUtils.isNotNull(billState)) { if (StringUtils.isNotNull(billState)) {
hgcw012.setSigningDate(signingDate); //hgcw012.setSigningDate(signingDate);
hgcw012.setBillState(1); hgcw012.setBillState(1);
} }
if (hgcw012.getReviewStatus().equals(ReviewStatusEnum.REVIEWED.getCode())){ if (hgcw012.getReviewStatus().equals(ReviewStatusEnum.REVIEWED.getCode())){
throw new PlatException("该数据已审核,不能保存!"); throw new PlatException("该数据已审核,不能保存!");
} }
if (hgcw012.getId() == null || hgcw012.getId() == 0) { if (hgcw012.getId() == null || hgcw012.getId() == 0) {
hgcw012.setReviewStatus(ReviewStatusEnum.UNREVIEWED.getCode()); //hgcw012.setReviewStatus(ReviewStatusEnum.UNREVIEWED.getCode());
this.add(hgcw012); this.add(hgcw012);
} else { } else {
this.modify(hgcw012); this.modify(hgcw012);
...@@ -126,7 +124,73 @@ public class ServiceHGCW012 extends ServiceBase { ...@@ -126,7 +124,73 @@ public class ServiceHGCW012 extends ServiceBase {
* @return * @return
*/ */
public void add(HGCW012 hgcw012) { public void add(HGCW012 hgcw012) {
List<HGCG003B> hgcg003BList = DaoBase.getInstance().query(HGSqlConstant.HgCw012A.QUERY_HGCG003A,
new HashMap<String, Object>(){{
put(HGCG003B.FIELD_COMPANY_CODE, hgcw012.getCompanyCode());
put(HGCG003B.FIELD_PROJ_CODE, hgcw012.getProjCode());
put(HGCG003.FIELD_SUP_CODE, hgcw012.getPartyA());
put(HGCG003.FIELD_STATUS, HGConstant.CgReceiveStatus.S_5);
put(HGCG003.FIELD_IS_INVOICING, HGConstant.CgIsInvoicing.S_0);
put("isUnCancelAmount", HGConstant.CgIsInvoicing.S_0);
}}
);
AssertUtils.isEmpty(hgcg003BList, "未找到匹配的采购收货");
DaoUtils.insert(HGCW012.INSERT, hgcw012); DaoUtils.insert(HGCW012.INSERT, hgcw012);
BigDecimal taxPoints = new BigDecimal(hgcw012.getTaxPoints()); // 假设这是以整数形式给出的税率,比如17表示17%
BigDecimal taxRateAsDecimal = taxPoints.divide(new BigDecimal("100")).add(new BigDecimal("1")); // 将税率 转换为小数形式
BigDecimal totalContractPriceIncluding = hgcw012.getTotalContractPriceIncluding(); // 发票金额
boolean flag = true;
StringBuffer settlementNumber = new StringBuffer();
//生成明细表
for (HGCG003B hgcg003B : hgcg003BList) {
settlementNumber.append(hgcg003B.getReceiveNo()).append(",");
HGCW013 hgcw013 = new HGCW013();
BeanUtils.copyProperties(hgcg003B, hgcw013,"id","accountCode","depCode","createdBy","createdName","createdTime","updatedBy","updatedName","updatedTime");
hgcw013.setMainId(hgcw012.getId());
hgcw013.setSettlementNumber(hgcg003B.getReceiveNo()); //收货单号
hgcw013.setBillNumber(hgcw012.getBillNumber()); //发票号
hgcw013.setPartyA(hgcw012.getPartyA()); //供应商
BigDecimal amount = hgcg003B.getUnCancelAmount();
BigDecimal thisSettlementAmount = BigDecimal.ZERO; //不含税金额
BigDecimal thisSettlementTax = BigDecimal.ZERO; // 计算 税额
// 发票金额大于货物金额
if (totalContractPriceIncluding.compareTo(amount) >= 0){
totalContractPriceIncluding = totalContractPriceIncluding.subtract(amount);
thisSettlementAmount = amount.divide(taxRateAsDecimal, 3, RoundingMode.HALF_UP); //不含税金额
thisSettlementTax = amount.subtract(thisSettlementAmount); // 计算 税额
hgcw013.setTotalContractPriceIncluding(amount);
BigDecimal c = hgcg003B.getCancelAmount().add(amount);
hgcg003B.setCancelAmount(c);
hgcg003B.setUnCancelAmount(BigDecimal.ZERO);
hgcg003B.setIsInvoicing(HGConstant.CgIsInvoicing.S_1);
if (totalContractPriceIncluding.compareTo(amount) == 0){
flag = false;
}
}else {
thisSettlementAmount = totalContractPriceIncluding.divide(taxRateAsDecimal, 3, RoundingMode.HALF_UP); //不含税金额
thisSettlementTax = totalContractPriceIncluding.subtract(thisSettlementAmount); // 计算 税额
hgcw013.setTotalContractPriceIncluding(totalContractPriceIncluding);
BigDecimal c = hgcg003B.getCancelAmount().add(totalContractPriceIncluding);
hgcg003B.setCancelAmount(c);
hgcg003B.setUnCancelAmount(amount.subtract(totalContractPriceIncluding));
hgcg003B.setIsInvoicing(HGConstant.CgIsInvoicing.S_0);
flag = false;
}
hgcw013.setTaxPoints(hgcw012.getTaxPoints());
hgcw013.setThisSettlementTax(String.valueOf(thisSettlementTax)); //税额
hgcw013.setThisSettlementAmount(String.valueOf(thisSettlementAmount)); //不含税金额
DaoUtils.insert(HGCW013.INSERT, hgcw013);
//跟新采购收票状态
DaoUtils.update(HGCG003B.UPDATE, hgcg003B);
if (!flag){
break;
}
}
hgcw012.setSettlementNumber(settlementNumber.toString().substring(0, settlementNumber.length() - 1));
DaoUtils.update(HGCW012.UPDATE, hgcw012);
} }
/** /**
...@@ -495,7 +559,7 @@ public class ServiceHGCW012 extends ServiceBase { ...@@ -495,7 +559,7 @@ public class ServiceHGCW012 extends ServiceBase {
BigDecimal taxPoints = new BigDecimal(hgcw012.getTaxPoints()); // 假设这是以整数形式给出的税率,比如17表示17% BigDecimal taxPoints = new BigDecimal(hgcw012.getTaxPoints()); // 假设这是以整数形式给出的税率,比如17表示17%
BigDecimal thisAmount = hgcw013.getTotalContractPriceIncluding(); //开票总额 BigDecimal thisAmount = hgcw013.getTotalContractPriceIncluding(); //开票总额
BigDecimal taxRateAsDecimal = taxPoints.divide(new BigDecimal("100")).add(new BigDecimal("1")); // 将税率转换为小数形式 BigDecimal taxRateAsDecimal = taxPoints.divide(new BigDecimal("100")).add(new BigDecimal("1")); // 将税率转换为小数形式
BigDecimal thisSettlementAmount = thisAmount.divide(taxRateAsDecimal, 2, RoundingMode.HALF_UP); BigDecimal thisSettlementAmount = thisAmount.divide(taxRateAsDecimal, 3, RoundingMode.HALF_UP);
BigDecimal thisSettlementTax = thisAmount.subtract(thisSettlementAmount); // 计算税额 BigDecimal thisSettlementTax = thisAmount.subtract(thisSettlementAmount); // 计算税额
hgcw013.setThisSettlementTax(thisSettlementTax.toString()); hgcw013.setThisSettlementTax(thisSettlementTax.toString());
hgcw013.setThisSettlementAmount(thisSettlementAmount.toString()); hgcw013.setThisSettlementAmount(thisSettlementAmount.toString());
......
...@@ -447,10 +447,16 @@ ...@@ -447,10 +447,16 @@
A.STATUS as "status", <!-- 状态:0-已收货,1-已入库,2-部分入库,3-退货 --> A.STATUS as "status", <!-- 状态:0-已收货,1-已入库,2-部分入库,3-退货 -->
A.PRICE as "price", <!-- 单价 --> A.PRICE as "price", <!-- 单价 -->
A.AMOUNT as "amount", <!-- 金额(不含税金额) --> A.AMOUNT as "amount", <!-- 金额(不含税金额) -->
A.TAX_INCLUDE_AMOUNT as "taxIncludeAmount", <!-- 含税金额 -->
A.TAX_AMOUNT as "taxAmount", <!-- 税额 -->
A.TAX_RATE as "taxRate", <!-- 税率 -->
A.INVENT_TYPE_DETAIL as "inventTypeDetail", <!-- 存货类型大类 --> A.INVENT_TYPE_DETAIL as "inventTypeDetail", <!-- 存货类型大类 -->
A.PRIMARY_ID as "primaryId", <!-- 主表id --> A.PRIMARY_ID as "primaryId", <!-- 主表id -->
A.CONTRACT_DETAIL_ID as "contractDetailId", <!-- 合同明细id --> A.CONTRACT_DETAIL_ID as "contractDetailId", <!-- 合同明细id -->
A.IS_INVOICING as "isInvoicing" A.IS_INVOICING as "isInvoicing",
A.CALCULATION_METHOD as "calculationMethod", <!-- 计算方式 0-数量乘单价 1-重量乘单价 -->
A.CANCEL_AMOUNT as "cancelAmount",
A.UN_CANCEL_AMOUNT as "unCancelAmount"
FROM ${hggpSchema}.HGCG003A A LEFT JOIN ${hggpSchema}.HGCG003 B ON A.PRIMARY_ID = B.ID FROM ${hggpSchema}.HGCG003A A LEFT JOIN ${hggpSchema}.HGCG003 B ON A.PRIMARY_ID = B.ID
WHERE A.DELETE_FLAG = 0 and b.delete_flag = 0 WHERE A.DELETE_FLAG = 0 and b.delete_flag = 0
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
...@@ -555,12 +561,21 @@ ...@@ -555,12 +561,21 @@
<isNotEmpty prepend=" AND " property="isInvoicing"> <isNotEmpty prepend=" AND " property="isInvoicing">
A.IS_INVOICING = #isInvoicing# A.IS_INVOICING = #isInvoicing#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="cancelAmount">
A.CANCEL_AMOUNT = #cancelAmount#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="unCancelAmount">
A.UN_CANCEL_AMOUNT = #unCancelAmount#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="isUnCancelAmount">
A.UN_CANCEL_AMOUNT > #isUnCancelAmount#
</isNotEmpty>
<dynamic prepend="ORDER BY"> <dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy"> <isNotEmpty property="orderBy">
$orderBy$ $orderBy$
</isNotEmpty> </isNotEmpty>
<isEmpty property="orderBy"> <isEmpty property="orderBy">
A.ID asc A.RECEIVE_DATE asc, A.ID asc
</isEmpty> </isEmpty>
</dynamic> </dynamic>
</select> </select>
......
...@@ -43,9 +43,21 @@ ...@@ -43,9 +43,21 @@
align="center" filter="contains" sort="true"> align="center" filter="contains" sort="true">
<EF:EFOptions blockId="roleCompany" textField="companyName" valueField="companyCode"/> <EF:EFOptions blockId="roleCompany" textField="companyName" valueField="companyCode"/>
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="partyA" cname="供应商名称" width="220" enable="false" readonly="true" align="center"/> <EF:EFComboColumn ename="projCode" cname="项目名称" blockName="proj_record_block_id"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" readonly="false" width="210" required="true"
align="center" filter="contains" sort="true">
</EF:EFComboColumn>
<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"
align="center" filter="contains" sort="true">
</EF:EFComboColumn>
<%--<EF:EFColumn ename="partyA" cname="供应商名称" width="220" enable="false" readonly="true" align="center"/>--%>
<EF:EFColumn ename="settlementNumber" cname="来源单号" width="200" enable="false" readonly="true" align="center"/> <EF:EFColumn ename="settlementNumber" cname="来源单号" width="200" enable="false" readonly="true" align="center"/>
<EF:EFComboColumn ename="billTybe" cname="票据类型" width="120" align="center" required="true" <EF:EFComboColumn ename="billTybe" cname="票据类型" width="120" align="center" required="true" defaultValue="1"
columnTemplate="#=textField#" itemTemplate="#=textField#" enable="true" > columnTemplate="#=textField#" itemTemplate="#=textField#" enable="true" >
<EF:EFCodeOption codeName="hggp.cw.billTybe"/> <EF:EFCodeOption codeName="hggp.cw.billTybe"/>
</EF:EFComboColumn> </EF:EFComboColumn>
...@@ -54,23 +66,23 @@ ...@@ -54,23 +66,23 @@
<EF:EFColumn ename="signingDate" cname="开票日期" width="120" enable="true" align="center" editType="date" <EF:EFColumn ename="signingDate" cname="开票日期" width="120" enable="true" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true" /> dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true" />
<EF:EFColumn ename="billNumber" cname="发票号" width="120" enable="true" readonly="false" align="center"/> <EF:EFColumn ename="billNumber" cname="发票号" width="120" enable="true" readonly="false" align="center"/>
<EF:EFComboColumn ename="taxPoints" cname="税率" width="120" align="center" required="true" <EF:EFComboColumn ename="taxPoints" cname="税率" width="80" align="center" required="true" defaultValue="13"
columnTemplate="#=textField#" itemTemplate="#=textField#" enable="true" > columnTemplate="#=textField#" itemTemplate="#=textField#" enable="true" >
<EF:EFCodeOption codeName="hggp.cw.taxPoints"/> <EF:EFCodeOption codeName="hggp.cw.taxPoints"/>
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="thisSettlementAmount" cname="不含税金额" width="120" enable="false" format="{0:N3}" editType="text" <EF:EFColumn ename="totalContractPriceIncluding" cname="发票总额" width="120" enable="true" format="{0:C3}" editType="text"
displayType="0.000" sort="true" align="right" displayType="0.000" sort="true" align="right"
data-regex="/^-?[0-9]{1,15}([.][0-9]{1,3})?$/" maxLength="15" required="false" data-regex="/^-?[0-9]{1,15}([.][0-9]{1,3})?$/" maxLength="15" required="true"
data-errorprompt="请输入数字,该值最大可设置15位整数和3位小数!"/> data-errorprompt="请输入数字,该值最大可设置15位整数和3位小数!"/>
<EF:EFColumn ename="thisSettlementTax" cname="税额" width="120" enable="false" format="{0:N3}" editType="text" <EF:EFColumn ename="thisSettlementAmount" cname="不含税金额" width="120" enable="false" format="{0:C3}" editType="text"
displayType="0.000" sort="true" align="right" displayType="0.000" sort="true" align="right"
data-regex="/^-?[0-9]{1,15}([.][0-9]{1,3})?$/" maxLength="15" required="false" data-regex="/^-?[0-9]{1,15}([.][0-9]{1,3})?$/" maxLength="15" required="false"
data-errorprompt="请输入数字,该值最大可设置15位整数和3位小数!"/> data-errorprompt="请输入数字,该值最大可设置15位整数和3位小数!"/>
<EF:EFColumn ename="totalContractPriceIncluding" cname="发票总额" width="120" enable="false" format="{0:N3}" editType="text" <EF:EFColumn ename="thisSettlementTax" cname="税额" width="120" enable="false" format="{0:C3}" editType="text"
displayType="0.000" sort="true" align="right" displayType="0.000" sort="true" align="right"
data-regex="/^-?[0-9]{1,15}([.][0-9]{1,3})?$/" maxLength="15" required="false" data-regex="/^-?[0-9]{1,15}([.][0-9]{1,3})?$/" maxLength="15" required="false"
data-errorprompt="请输入数字,该值最大可设置15位整数和3位小数!"/> data-errorprompt="请输入数字,该值最大可设置15位整数和3位小数!"/>
<EF:EFComboColumn ename="reviewStatus" cname="审批状态" width="100" align="center" required="true" <EF:EFComboColumn ename="reviewStatus" cname="审批状态" width="100" align="center" required="true" defaultValue="0"
columnTemplate="#=textField#" itemTemplate="#=textField#" enable="false" > columnTemplate="#=textField#" itemTemplate="#=textField#" enable="false" >
<EF:EFCodeOption codeName="hggp.cw.reviewStatus"/> <EF:EFCodeOption codeName="hggp.cw.reviewStatus"/>
</EF:EFComboColumn> </EF:EFComboColumn>
......
...@@ -236,7 +236,7 @@ $(function () { ...@@ -236,7 +236,7 @@ $(function () {
field: "amount", field: "amount",
title: "收货金额", title: "收货金额",
headerTemplate: "<span style='color: '>收货金额 </span>", headerTemplate: "<span style='color: '>收货金额 </span>",
format:"{0:N3}", format:"{0:C3}",
align:"right", align:"right",
enable: false, enable: false,
locked: false locked: false
...@@ -245,7 +245,7 @@ $(function () { ...@@ -245,7 +245,7 @@ $(function () {
field: "thisSettlementAmount", field: "thisSettlementAmount",
title: "收票总额", title: "收票总额",
headerTemplate: "<span style='color: '>收票总额 </span>", headerTemplate: "<span style='color: '>收票总额 </span>",
format:"{0:N3}", format:"{0:C3}",
align:"right", align:"right",
locked: false, locked: false,
template: function (item) { template: function (item) {
...@@ -334,35 +334,35 @@ $(function () { ...@@ -334,35 +334,35 @@ $(function () {
field: "thisPriceTax", field: "thisPriceTax",
title: "收票价税合计金额", title: "收票价税合计金额",
headerTemplate: "<span style='color: '>收票价税合计金额 </span>", headerTemplate: "<span style='color: '>收票价税合计金额 </span>",
format:"{0:N2}", format:"{0:C2}",
locked: false locked: false
}, },
{ {
field: "thisSettlementTax", field: "thisSettlementTax",
title: "收票税金", title: "收票税金",
headerTemplate: "<span style='color: '>收票税金 </span>", headerTemplate: "<span style='color: '>收票税金 </span>",
format:"{0:N2}", format:"{0:C2}",
locked: false locked: false
}, },
{ {
field: "thisSettlementAmount", field: "thisSettlementAmount",
title: "收票金额", title: "收票金额",
headerTemplate: "<span style='color: '>收票金额 </span>", headerTemplate: "<span style='color: '>收票金额 </span>",
format:"{0:N2}", format:"{0:C2}",
locked: false locked: false
}, },
{ {
field: "thisAmount", field: "thisAmount",
title: "本次收票金额", title: "本次收票金额",
headerTemplate: "<span style='color: '>本次收票金额 </span>", headerTemplate: "<span style='color: '>本次收票金额 </span>",
format:"{0:N2}", format:"{0:C2}",
locked: false locked: false
}, },
{ {
field: "remainingAmount", field: "remainingAmount",
title: "剩余收票金额", title: "剩余收票金额",
headerTemplate: "<span style='color: '>剩余收票金额 </span>", headerTemplate: "<span style='color: '>剩余收票金额 </span>",
format:"{0:N2}", format:"{0:C2}",
locked: false locked: false
}], }],
loadComplete: function(grid) { loadComplete: function(grid) {
...@@ -444,27 +444,27 @@ $(function () { ...@@ -444,27 +444,27 @@ $(function () {
field: "totalContractPriceIncluding", field: "totalContractPriceIncluding",
title: "收票价税合计金额", title: "收票价税合计金额",
headerTemplate: "<span style='color: '>收票价税合计金额 </span>", headerTemplate: "<span style='color: '>收票价税合计金额 </span>",
format:"{0:N2}", format:"{0:C2}",
locked: false locked: false
}, },
{ {
field: "valueAddedTax", field: "valueAddedTax",
title: "收票税金", title: "收票税金",
headerTemplate: "<span style='color: '>收票税金 </span>", headerTemplate: "<span style='color: '>收票税金 </span>",
format:"{0:N2}", format:"{0:C2}",
locked: false locked: false
}, },
{ {
field: "totalContractPriceExcluding", field: "totalContractPriceExcluding",
title: "收票金额", title: "收票金额",
headerTemplate: "<span style='color: '>收票金额 </span>", headerTemplate: "<span style='color: '>收票金额 </span>",
format:"{0:N2}", format:"{0:C2}",
locked: false locked: false
},{ },{
field: "thisAmount", field: "thisAmount",
title: "本次收票金额", title: "本次收票金额",
headerTemplate: "<span style='color: '>本次收票金额 </span>", headerTemplate: "<span style='color: '>本次收票金额 </span>",
format:"{0:N2}", format:"{0:C2}",
locked: false locked: false
}], }],
loadComplete: function(grid) { loadComplete: function(grid) {
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<EF:EFColumn ename="projName" 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="partyA" cname="客户名称" width="120" enable="false" readonly="true" align="center"/> <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="settlementNumber" cname="来源单号" width="120" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="totalContractPriceIncluding" cname="付款总额" width="120" format="{0:N3}" align="center"/> <EF:EFColumn ename="totalContractPriceIncluding" cname="付款总额" width="120" format="{0:C3}" align="center"/>
</EF:EFGrid> </EF:EFGrid>
</EF:EFRegion> </EF:EFRegion>
</EF:EFPage> </EF:EFPage>
......
...@@ -13,9 +13,9 @@ ...@@ -13,9 +13,9 @@
<EF:EFColumn ename="id" cname="主键" hidden="true"/> <EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="companyName" cname="公司名称" width="120" enable="false" readonly="true" align="center"/> <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="projName" cname="项目名称" width="120" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="partyA" cname="客户名称" width="120" enable="false" readonly="true" align="center"/> <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="settlementNumber" cname="来源单号" width="120" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="totalContractPriceIncluding" cname="收款总额" width="120" format="{0:N3}" align="center" enable="false" readonly="true"/> <EF:EFColumn ename="totalContractPriceIncluding" cname="收款总额" width="120" format="{0:C3}" align="right" enable="false" readonly="true"/>
</EF:EFGrid> </EF:EFGrid>
</EF:EFRegion> </EF:EFRegion>
</EF:EFPage> </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