Commit 579516f1 by yukang

结算单管理

parent 1e7d9205
......@@ -149,56 +149,7 @@ public class ServiceHGCW002 extends ServiceBase {
DaoUtils.update("HGCW002.update", HGCW002);
}
/**
* 新增操作
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "账期维护",operType = "新增",operDesc = "新增")
@Override
public EiInfo insert(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 数据写入
for (int i = 0; i < resultRows.size(); i++) {
HGCW002 HGCW002 = new HGCW002();
HGCW002.fromMap(resultRows.get(i));
DaoUtils.insert("HGCW002.insert", HGCW002);
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据新增成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "新增失败");
}
return inInfo;
}
/**
* 修改操作
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "账期维护",operType = "修改",operDesc = "修改")
public EiInfo update(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (int i = 0; i < resultRows.size(); i++) {
HGCW002 HGCW002 = new HGCW002();
HGCW002.fromMap(resultRows.get(i));
DaoUtils.update("HGCW002.update", HGCW002);
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据修改成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "修改失败");
}
return inInfo;
}
/**
* 删除操作
*
......@@ -289,4 +240,11 @@ public class ServiceHGCW002 extends ServiceBase {
return inInfo;
}
public EiInfo queryContractByNumber(EiInfo inInfo){
HGCW002 hgcw002 = HGCWTools.HgCw002.getContractNumber(inInfo.getString("contractNumber"));
inInfo.set("hgcw002",hgcw002);
return inInfo;
}
}
......@@ -3,8 +3,10 @@ package com.baosight.hggp.hg.cw.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.cw.domain.HGCW003;
import com.baosight.hggp.hg.cw.tools.HGCWTools;
import com.baosight.hggp.hg.cw.vo.UserVO;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.DateUtils;
import com.baosight.hggp.util.LogUtils;
......@@ -13,6 +15,7 @@ import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.core.util.NumberUtils;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.math.BigDecimal;
import java.text.DecimalFormat;
......@@ -76,6 +79,9 @@ public class ServiceHGCW003 extends ServiceBase {
for (int i = 0; i < resultRows.size(); i++) {
HGCW003 HGCW003 = new HGCW003();
HGCW003.fromMap(resultRows.get(i));
UserVO userVO = HGCWTools.HgCw002.getUserCompany();
HGCW003.setCompanyCode(userVO.getUsercode());
HGCW003.setCompanyName(userVO.getUsername());
contractNumber = HGCW003.getContractNumber();
if (HGCW003.getId() == null || HGCW003.getId() == 0) {
this.add(HGCW003);
......
......@@ -4,6 +4,7 @@ import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.cw.domain.HGCW007;
import com.baosight.hggp.hg.cw.tools.HGCWTools;
import com.baosight.hggp.hg.cw.vo.UserVO;
import com.baosight.hggp.util.LogUtils;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
......@@ -72,6 +73,9 @@ public class ServiceHGCW007 extends ServiceBase {
for (int i = 0; i < resultRows.size(); i++) {
HGCW007 HGCW007 = new HGCW007();
HGCW007.fromMap(resultRows.get(i));
UserVO userVO = HGCWTools.HgCw002.getUserCompany();
HGCW007.setCompanyCode(userVO.getUsercode());
HGCW007.setCompanyName(userVO.getUsername());
contractNumber = HGCW007.getContractNumber();
if (HGCW007.getId() == null || HGCW007.getId() == 0) {
this.add(HGCW007);
......
......@@ -91,30 +91,14 @@ public class ServiceHGCW008 extends ServiceBase {
this.add(HGCW008);
// 写入其他数据
HGCWTools.HgCw009.save(detail1Rows,settlementNumber,userVO);
// 更新合同结算状态
HGCWTools.HgCw002.updateBalanceStatus(HGCW008.getContractNumber(),HGCW008.getSettlementType() + 1);
} else {
BigDecimal totalContractPriceExcluding = new BigDecimal(0);
BigDecimal totalContractPriceIncluding = new BigDecimal(0);
BigDecimal valueAddedTax = new BigDecimal(0);
BigDecimal totalQuantity = new BigDecimal(0);
//计算合同清单金额
for (int i = 0; i < detail1Rows.size(); i++) {
HGCW007 hgcw007 = new HGCW007();
hgcw007.fromMap(detail1Rows.get(i));
totalContractPriceExcluding = totalContractPriceExcluding.add(hgcw007.getTotalPrice());
totalQuantity = totalQuantity.add(hgcw007.getDeviceNumber());
}
BigDecimal taxPoints = new BigDecimal(HGCW008.getTaxPoints() / 100);
totalContractPriceIncluding = totalContractPriceExcluding.multiply(taxPoints.add(new BigDecimal(1)));
valueAddedTax = totalContractPriceIncluding.subtract(totalContractPriceExcluding);
DecimalFormat decimalFormat = new DecimalFormat("#.000");
HGCW008.setContractDate(DateUtils.formatShort(HGCW008.getContractDate()));
this.modify(HGCW008);
// 更新合同结算状态
HGCWTools.HgCw002.updateBalanceStatus(HGCW008.getContractNumber(),HGCW008.getSettlementType() + 1);
}
// 更新合同结算状态
HGCWTools.HgCw002.updateBalanceStatus(HGCW008.getContractNumber(),HGCW008.getSettlementType() + 1);
//更新金额
HGCWTools.HgCw009.calculateAmount(HGCW008.getSettlementNumber());
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
......
package com.baosight.hggp.hg.cw.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.hg.cw.domain.HGCW006;
import com.baosight.hggp.hg.cw.domain.HGCW007;
import com.baosight.hggp.hg.cw.domain.HGCW999;
import com.baosight.hggp.hg.cw.domain.*;
import com.baosight.hggp.hg.cw.tools.HGCWTools;
import com.baosight.hggp.util.LogUtils;
import com.baosight.iplat4j.core.ei.EiConstant;
......@@ -28,15 +26,12 @@ public class ServiceHGCW008C extends ServiceBase {
@OperationLogAnnotation(operModul = "合同详情",operType = "查询",operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
// CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.PROJECT_CODE_BOX_BLOCK_ID), null, false);
String id = inInfo.getString("id");
HGCW006 HGCW006 = HGCWTools.HgCw006.getId(id);
inInfo.addBlock(EiConstant.resultBlock).addRow(HGCW006);
HGCW008 HGCW008 = HGCWTools.HgCw008.getId(id);
inInfo.addBlock(EiConstant.resultBlock).addRow(HGCW008);
//获取清单
List<HGCW007> hgcw007List = HGCWTools.HgCw007.queryByContractNumber(HGCW006.getContractNumber());
inInfo.addBlock("detail1").addRows(hgcw007List);
List<HGCW999> hgcw999List = HGCWTools.HgCw999.queryByBiz(HGCW006.getId(),"ZL");
inInfo.addBlock("detail2").addRows(hgcw999List);
List<HGCW009> hgcw009List = HGCWTools.HgCw009.queryBySettlementNumber(HGCW008.getSettlementNumber());
inInfo.addBlock("detail1").addRows(hgcw009List);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
......
......@@ -47,9 +47,7 @@ public class ServiceHGCW008E extends ServiceBase {
public EiInfo query(EiInfo inInfo) {
try {
List<String> ids = new ArrayList<>();
List<String> dids = new ArrayList<>();
String inventoryIds = inInfo.getString("inqu_status-0-inventoryIds");
String deductionIds = inInfo.getString("inqu_status-0-deductionIds");
if (StringUtils.isNotEmpty(inventoryIds)) {
String[] inventoryIdsArr = inventoryIds.split(",");
......@@ -59,6 +57,24 @@ public class ServiceHGCW008E extends ServiceBase {
inInfo.set("inqu_status-0-ids", ids);
}
inInfo = super.query(inInfo, HGCW003.QUERY, new HGCW003(),new HGCW003().eiMetadata,"","","result1",false);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 查询操作
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "合同清单",operType = "查询",operDesc = "查询")
public EiInfo query2(EiInfo inInfo) {
try {
List<String> dids = new ArrayList<>();
String deductionIds = inInfo.getString("inqu_status-0-deductionIds");
if (StringUtils.isNotEmpty(deductionIds)) {
String[] deductionIdsArr = deductionIds.split(",");
for (String id : deductionIdsArr) {
......
......@@ -2,8 +2,9 @@ package com.baosight.hggp.hg.cw.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.cw.domain.HGCW007;
import com.baosight.hggp.hg.cw.domain.HGCW009;
import com.baosight.hggp.hg.cw.tools.HGCWTools;
import com.baosight.hggp.hg.cw.vo.UserVO;
import com.baosight.hggp.util.LogUtils;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
......@@ -29,7 +30,7 @@ public class ServiceHGCW009 extends ServiceBase {
@OperationLogAnnotation(operModul = "合同清单",operType = "查询",operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGCW007().eiMetadata);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGCW009().eiMetadata);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
......@@ -46,7 +47,7 @@ public class ServiceHGCW009 extends ServiceBase {
@Override
public EiInfo query(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, HGCW007.QUERY, new HGCW007());
inInfo = super.query(inInfo, HGCW009.QUERY, new HGCW009());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
......@@ -64,20 +65,23 @@ public class ServiceHGCW009 extends ServiceBase {
EiInfo eiInfo = new EiInfo();
try {
List<Map> resultRows = inInfo.getBlock("detail1").getRows();
String contractNumber = "";
String settlementNumber = "";
// 写入数据
for (int i = 0; i < resultRows.size(); i++) {
HGCW007 HGCW007 = new HGCW007();
HGCW007.fromMap(resultRows.get(i));
contractNumber = HGCW007.getContractNumber();
if (HGCW007.getId() == null || HGCW007.getId() == 0) {
this.add(HGCW007);
HGCW009 HGCW009 = new HGCW009();
HGCW009.fromMap(resultRows.get(i));
UserVO userVO = HGCWTools.HgCw002.getUserCompany();
HGCW009.setCompanyCode(userVO.getUsercode());
HGCW009.setCompanyName(userVO.getUsername());
settlementNumber = HGCW009.getSettlementNumber();
if (HGCW009.getId() == null || HGCW009.getId() == 0) {
this.add(HGCW009);
} else {
this.modify(HGCW007);
this.modify(HGCW009);
}
}
List<HGCW007> HGCW007List = HGCWTools.HgCw007.queryByContractNumber(contractNumber);
eiInfo.addBlock("detail1").addRows(HGCW007List);
List<HGCW009> HGCW009List = HGCWTools.HgCw009.queryBySettlementNumber(settlementNumber);
eiInfo.addBlock("detail1").addRows(HGCW009List);
eiInfo.setStatus(EiConstant.STATUS_DEFAULT);
eiInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
......@@ -89,25 +93,25 @@ public class ServiceHGCW009 extends ServiceBase {
/**
* 新增操作
*
* @param HGCW007
* @param HGCW009
* @return
*/
public void add(HGCW007 HGCW007) {
DaoUtils.insert("HGCW007.insert", HGCW007);
public void add(HGCW009 HGCW009) {
DaoUtils.insert("HGCW009.insert", HGCW009);
}
/**
* 修改操作
*
* @param HGCW007
* @param HGCW009
* @return
*/
public void modify(HGCW007 HGCW007) {
DaoUtils.update("HGCW007.update", HGCW007);
public void modify(HGCW009 HGCW009) {
DaoUtils.update("HGCW009.update", HGCW009);
}
public void deleteEntity(HGCW007 HGCW007) {
DaoUtils.update("HGCW007.delete", HGCW007);
public void deleteEntity(HGCW009 HGCW009) {
DaoUtils.update("HGCW009.delete", HGCW009);
}
/**
......@@ -121,16 +125,16 @@ public class ServiceHGCW009 extends ServiceBase {
EiInfo eiInfo = new EiInfo();
try {
List<Map> resultRows = inInfo.getBlock("detail1").getRows();
String contractNumber = "";
String settlementNumber = "";
// 写入数据
for (int i = 0; i < resultRows.size(); i++) {
HGCW007 HGCW007 = new HGCW007();
HGCW007.fromMap(resultRows.get(i));
contractNumber = HGCW007.getContractNumber();
this.deleteEntity(HGCW007);
HGCW009 HGCW009 = new HGCW009();
HGCW009.fromMap(resultRows.get(i));
settlementNumber = HGCW009.getSettlementNumber();
this.deleteEntity(HGCW009);
}
List<HGCW007> HGCW007List = HGCWTools.HgCw007.queryByContractNumber(contractNumber);
eiInfo.addBlock("detail1").addRows(HGCW007List);
List<HGCW009> HGCW009List = HGCWTools.HgCw009.queryBySettlementNumber(settlementNumber);
eiInfo.addBlock("detail1").addRows(HGCW009List);
eiInfo.setStatus(EiConstant.STATUS_DEFAULT);
eiInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!");
} catch (Exception e) {
......
......@@ -303,9 +303,6 @@
<update id="update">
UPDATE ${hggpSchema}.HGCW008
SET
ACCOUNT_CODE = #accountCode#, <!-- 企业编码 -->
COMPANY_CODE = #companyCode#, <!-- 公司编码 -->
COMPANY_NAME = #companyName#, <!-- 公司名称 -->
PROJ_CODE = #projCode#, <!-- 项目编码 -->
PROJ_NAME = #projName#, <!-- 项目名称 -->
CONTRACT_NUMBER = #contractNumber#, <!-- 合同号 -->
......@@ -322,14 +319,9 @@
CUMULATIVE_SETTLEMENT_AMOUNT = #cumulativeSettlementAmount#, <!-- 累计结算金额 -->
CUMULATIVE_SETTLEMENT_TAX = #cumulativeSettlementTax#, <!-- 累计结算税金 -->
CUMULATIVE_PRICE_TAX = #cumulativePriceTax#, <!-- 累计结算价税合计金额 -->
REVIEW_STATUS = #reviewStatus#, <!-- 审核状态 -->
CREATED_BY = #createdBy#, <!-- 记录创建者 -->
CREATED_NAME = #createdName#, <!-- 记录创建名称 -->
CREATED_TIME = #createdTime#, <!-- 记录创建时间 -->
UPDATED_BY = #updatedBy#, <!-- 记录修改者 -->
UPDATED_NAME = #updatedName#, <!-- 记录修改名称 -->
UPDATED_TIME = #updatedTime#, <!-- 记录修改时间 -->
DEP_CODE = #depCode# <!-- 部门编码 -->
UPDATED_TIME = #updatedTime# <!-- 记录修改时间 -->
WHERE
ID = #id#
</update>
......@@ -342,4 +334,15 @@
FROM ${hggpSchema}.HGCW008 WHERE 1=1
<include refid="condition" />
</select>
<update id="submit">
UPDATE ${hggpSchema}.HGCW008
SET
REVIEW_STATUS = #reviewStatus#, <!-- 审核状态 -->
UPDATED_BY = #updatedBy#, <!-- 记录修改者 -->
UPDATED_NAME = #updatedName#, <!-- 记录修改名称 -->
UPDATED_TIME = #updatedTime# <!-- 记录修改时间 -->
WHERE
ID = #id#
</update>
</sqlMap>
......@@ -5,17 +5,21 @@ import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.cw.domain.*;
import com.baosight.hggp.hg.cw.vo.UserVO;
import com.baosight.hggp.hg.sc.domain.HGSC001A;
import com.baosight.hggp.hg.xs.domain.Org;
import com.baosight.hggp.hg.xs.tools.HGXSTools;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.iplat4j.core.ProjectInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import org.apache.commons.collections.CollectionUtils;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
public class HGCWTools {
......@@ -54,6 +58,14 @@ public class HGCWTools {
{put("balanceStatus",balanceStatus);}
});
}
public static HGCW002 getContractNumber(String contractNumber) {
AssertUtils.isNull(contractNumber, "合同号不能为空!");
List<HGCW002> results = DaoBase.getInstance().query(HGCW002.QUERY,new HashMap<String,Object>(){
{put("contractNumber",contractNumber);}
});
return results.get(0);
}
}
public static class HgCw003{
......@@ -153,10 +165,114 @@ public class HGCWTools {
public static List<HGCW009> queryBySettlementNumber(String settlementNumber) {
AssertUtils.isNull(settlementNumber, "结算单号不能为空!");
List<HGCW009> results = DaoBase.getInstance().query(HGCW009.QUERY,new HashMap<String,Object>(){
{put("contractNumber",settlementNumber);}
{put("settlementNumber",settlementNumber);}
});
return results;
}
/**
* 本次结算金额: 明细的本次结算求和
* 累计结算金额: 当前合同的所有结算单本次结算金额求和
* 本次结算税金: 明细的本次结算求和(不含扣款 )*税率
* 累计结算税金:当前合同的所有结算单的“本次结算税金”求和
* 本次价税合计=本次结算金额+本次结算税金
* 累计价税合计=累计结算金额+累计结算税金
* 劳务合同的本次结算税金: 明细的本次结算求和(不含扣款 )*税率
* 销售合同的本次结算税金: 明细的本次结算求和*税率
*/
public static void calculateAmount(String settlementNumber){
AssertUtils.isNull(settlementNumber, "结算单号不能为空!");
DecimalFormat decimalFormat = new DecimalFormat("#.000");
List<HGCW008> HGCW008List = DaoBase.getInstance().query(HGCW008.QUERY,new HashMap<String,Object>(){
{put("settlementNumber",settlementNumber);}
});
if (CollectionUtils.isEmpty(HGCW008List)) {
throw new PlatException("未找到对应的结算单!");
}
HGCW008 hgcw008 = HGCW008List.get(0);
BigDecimal thisTaxPoints = new BigDecimal(decimalFormat.format(new BigDecimal(hgcw008.getTaxPoints()).divide(new BigDecimal(100))));
// 找到对应的合同
HGCW002 hgcw002 = HGCWTools.HgCw002.getContractNumber(hgcw008.getContractNumber());
Integer contractType = hgcw002.getContractType();
List<HGCW008> hgcw008List = DaoBase.getInstance().query(HGCW008.QUERY,new HashMap<String,Object>(){
{put("contractNumber",hgcw008.getContractNumber());}
});
//本次计算
List<HGCW009> thisHGCW009List = DaoBase.getInstance().query(HGCW009.QUERY,new HashMap<String,Object>(){
{put("settlementNumber",settlementNumber);}
});
BigDecimal thisSettlementAmount = new BigDecimal(0);
BigDecimal thisSettlementTax = new BigDecimal(0);
AtomicReference<BigDecimal> cumulativeSettlementAmount = new AtomicReference<>(new BigDecimal(0));
AtomicReference<BigDecimal> cumulativeSettlementTax = new AtomicReference<>(new BigDecimal(0));
if (CollectionUtils.isNotEmpty(thisHGCW009List)) {
BigDecimal totalPrice = new BigDecimal(0);
BigDecimal deductionPrice= new BigDecimal(0);
for (int i = 0; i < thisHGCW009List.size(); i++) {
HGCW009 hgcw009 = thisHGCW009List.get(i);
if (hgcw009.getSettlementBasis().equals("合同内")) {
totalPrice = totalPrice.add(hgcw009.getTotalPrice());
} else {
deductionPrice = deductionPrice.add(hgcw009.getTotalPrice());
}
}
thisSettlementAmount = totalPrice.add(deductionPrice);
// * 劳务合同的本次结算税金: 明细的本次结算求和(不含扣款 )*税率
// * 销售合同的本次结算税金: 明细的本次结算求和*税率
if (contractType == 1) {
thisSettlementTax = new BigDecimal(decimalFormat.format(thisSettlementAmount.multiply(thisTaxPoints)));
} else {
thisSettlementTax = new BigDecimal(decimalFormat.format(totalPrice.multiply(thisTaxPoints)));
}
}
//其余的计算单
List<HGCW008> otherHGCW008List = hgcw008List.stream()
.filter(item -> !item.getSettlementNumber().equals(hgcw008.getSettlementNumber()))
.collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(otherHGCW008List)) {
otherHGCW008List.forEach(item -> {
// 找到对应的清单
BigDecimal taxPoints = new BigDecimal(decimalFormat.format(new BigDecimal(item.getTaxPoints()).divide(new BigDecimal(100))));
List<HGCW009> HGCW009List = DaoBase.getInstance().query(HGCW009.QUERY,new HashMap<String,Object>(){
{put("settlementNumber",item.getSettlementNumber());}
});
if (CollectionUtils.isNotEmpty(HGCW009List)) {
BigDecimal totalPrice = new BigDecimal(0);
BigDecimal deductionPrice= new BigDecimal(0);
for (int i = 0; i < HGCW009List.size(); i++) {
HGCW009 hgcw009 = HGCW009List.get(i);
if (hgcw009.getSettlementBasis().equals("合同内")) {
totalPrice = totalPrice.add(hgcw009.getTotalPrice());
} else {
deductionPrice = deductionPrice.add(hgcw009.getTotalPrice());
}
}
cumulativeSettlementAmount.set(totalPrice.add(deductionPrice));
if (contractType == 1) {
cumulativeSettlementTax.set(new BigDecimal(decimalFormat.format(cumulativeSettlementAmount.get().multiply(taxPoints))));
} else {
cumulativeSettlementTax.set(new BigDecimal(decimalFormat.format(totalPrice.multiply(taxPoints))));
}
}
});
}
// * 本次价税合计=本次结算金额+本次结算税金
// * 累计价税合计=累计结算金额+累计结算税金
BigDecimal thisPriceTax = new BigDecimal(decimalFormat.format(thisSettlementAmount.add(thisSettlementTax)));
BigDecimal cumulativePriceTax = new BigDecimal(decimalFormat.format(cumulativeSettlementAmount.get().add(cumulativeSettlementTax.get())));
hgcw008.setThisSettlementAmount(thisSettlementAmount);
hgcw008.setThisSettlementTax(thisSettlementTax);
hgcw008.setCumulativeSettlementAmount(thisSettlementAmount.add(cumulativeSettlementAmount.get()));
hgcw008.setCumulativeSettlementTax(thisSettlementTax.add(cumulativeSettlementTax.get()));
hgcw008.setThisPriceTax(thisPriceTax);
hgcw008.setCumulativePriceTax(thisPriceTax.add(cumulativePriceTax));
DaoUtils.update(HGCW008.UPDATE, hgcw008);
}
}
public static class HgCw999 {
......
......@@ -81,6 +81,10 @@ function updateFunc() {
message("请选择一条数据");
return;
}
if (rows[0].reviewStatus == "3") {
message("已经提交的数据不能进行修改!");
return;
}
JSColorbox.open({
href: "HGCW002B?methodName=initLoad&id=" + rows[0].id + "&efParentFormEname=HGCW002",
title: "<div style='text-align: center;'>修改合同</div>",
......
......@@ -81,6 +81,10 @@ function updateFunc() {
message("请选择一条数据");
return;
}
if (rows[0].reviewStatus == "3") {
message("已经提交的数据不能进行修改!");
return;
}
JSColorbox.open({
href: "HGCW006B?methodName=initLoad&id=" + rows[0].id + "&efParentFormEname=HGCW006",
title: "<div style='text-align: center;'>修改合同</div>",
......
......@@ -8,6 +8,7 @@
</head>
<EF:EFPage title="修改合同">
<EF:EFRegion id="inqu1" title="基本信息">
<EF:EFInput ename="result-0-id" cname="id" type="hidden"/>
<div class="row">
<EF:EFSelect cname="项目编号" ename="projCodeBox" colWidth="4" required="true" filter="contains">
<EF:EFOption label="-- 请选择 --" value="" />
......
......@@ -79,6 +79,10 @@ function updateFunc() {
message("请选择一条数据");
return;
}
if (rows[0].reviewStatus == "3") {
message("已经提交的数据不能进行修改!");
return;
}
JSColorbox.open({
href: "HGCW008B?methodName=initLoad&id=" + rows[0].id + "&efParentFormEname=HGCW008",
title: "<div style='text-align: center;'>修改结算单</div>",
......
......@@ -205,17 +205,42 @@ function choiceFunc() {
}
function choiceCallbackFunc(result) {
$.each(result, function(index, item) {
detail1Grid.dataSource.insert();
detail1Grid.setCellValue(0, "rowNo", 0);
detail1Grid.setCellValue(0, "settlementBasis", "合同内");
detail1Grid.setCellValue(0, "taskName", item.inventory);
detail1Grid.setCellValue(0, "unit", item.unit);
detail1Grid.setCellValue(0, "unitPrice", item.unitPriceExcludingTax);
detail1Grid.setCellValue(0, "inventoryId", item.id);
detail1Grid.refresh();
})
function choiceCallbackFunc(result1, result2) {
var contractType = $("#contractType").val();
if (contractType == "1") {
$.each(result1, function(index, item) {
detail1Grid.dataSource.insert();
detail1Grid.setCellValue(0, "rowNo", 0);
detail1Grid.setCellValue(0, "settlementBasis", "合同内");
detail1Grid.setCellValue(0, "taskName", item.inventory);
detail1Grid.setCellValue(0, "unit", item.unit);
detail1Grid.setCellValue(0, "unitPrice", item.unitPriceExcludingTax);
detail1Grid.setCellValue(0, "inventoryId", item.id);
detail1Grid.refresh();
})
} else {
$.each(result1, function(index, item) {
detail1Grid.dataSource.insert();
detail1Grid.setCellValue(0, "rowNo", 0);
detail1Grid.setCellValue(0, "settlementBasis", "合同内");
detail1Grid.setCellValue(0, "taskName", item.inventory);
detail1Grid.setCellValue(0, "unit", item.unit);
detail1Grid.setCellValue(0, "unitPrice", item.unitPriceExcludingTax);
detail1Grid.setCellValue(0, "inventoryId", item.id);
detail1Grid.refresh();
})
$.each(result2, function(index, item) {
detail1Grid.dataSource.insert();
detail1Grid.setCellValue(0, "rowNo", 0);
detail1Grid.setCellValue(0, "settlementBasis", "罚款");
detail1Grid.setCellValue(0, "taskName", item.projName);
detail1Grid.setCellValue(0, "unitPrice", item.totalContractPriceIncluding * -1);
detail1Grid.setCellValue(0, "remarks", item.contractContent);
detail1Grid.setCellValue(0, "inventoryId", item.id);
detail1Grid.refresh();
})
}
JSColorbox.close();
}
function cancelFunc() {
......
......@@ -8,6 +8,7 @@
</head>
<EF:EFPage title="修改结算单">
<EF:EFRegion id="inqu1" title="基本信息">
<EF:EFInput ename="result-0-id" cname="id" type="hidden"/>
<div class="row">
<EF:EFPopupInput ename="popupInputProjCode" cname="项目编号" colWidth="4"
serviceName="HGCW002" methodName="queryContractByType"
......@@ -65,8 +66,8 @@
<EF:EFRegion id="detail1" title="合同清单">
<EF:EFGrid blockId="detail1" autoDraw="override" checkMode="row" isFloat="true" copyToAdd="false">
<EF:EFColumn ename="rowNo" cname="行号" hidden="true"/>
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="settlementNumber" cname="结算单" hidden="true"/>
<EF:EFColumn ename="settlementBasis" cname="结算依据" align="center" />
<EF:EFColumn ename="taskName" cname="任务名称" align="center" />
<EF:EFColumn ename="engineeringContent" cname="工程内容" align="center" />
......
$(function() {
IPLATUI.EFGrid.detail1 = {
pageable: {
pageSize: 20,
pageSizes: [10,20,30,50,100,200],
},
columns: [
]
}
});
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<head>
</head>
<EF:EFPage title="修改结算单">
<EF:EFRegion id="inqu1" title="基本信息">
<EF:EFInput ename="result-0-id" cname="id" type="hidden"/>
<div class="row">
<EF:EFInput ename="result-0-projCode" cname="项目编号" colWidth="4" readonly="true"/>
<EF:EFInput ename="result-0-projName" cname="项目简称" colWidth="4" readonly="true"/>
<EF:EFInput ename="result-0-contractNumber" cname="合同号" colWidth="4" readonly="true" />
<EF:EFInput ename="contractType" cname="合同类型" type="hidden"/>
</div>
<div class="row">
<EF:EFInput ename="result-0-contractName" cname="合同名称" colWidth="4" readonly="true"/>
<EF:EFInput ename="result-0-settlementNumber" cname="结算编号" colWidth="4" readonly="true"/>
<EF:EFSelect cname="结算类别" ename="result-0-settlementType" colWidth="4" filter="contains" readonly="true" enable="false">
<EF:EFOption label="-- 请选择 --" value=""/>
<EF:EFCodeOption codeName="hggp.cw.settlementType"/>
</EF:EFSelect>
</div>
<div class="row">
<EF:EFSelect cname="税点" ename="result-0-taxPoints" colWidth="4" filter="contains" readonly="true" enable="false">
<EF:EFOption label="-- 请选择 --" value=""/>
<EF:EFCodeOption codeName="hggp.cw.taxPoints"/>
</EF:EFSelect>
<EF:EFSelect cname="价税分离" ename="result-0-priceTaxSeparation" colWidth="4" filter="contains" readonly="true" enable="false">
<EF:EFOption label="-- 请选择 --" value=""/>
<EF:EFCodeOption codeName="hggp.cw.priceTaxSeparation"/>
</EF:EFSelect>
<EF:EFDatePicker cname="结算日期" ename="result-0-contractDate" colWidth="4"
format="yyyy-MM-dd" parseFormats="['yyyyMMdd']" readonly="true" enable="false"/>
</div>
<div class="row">
<EF:EFInput ename="result-0-thisSettlementAmount" cname="本次结算金额(元)" colWidth="4" readonly="true"/>
<EF:EFInput ename="result-0-thisSettlementTax" cname="本次结算税金(元)" colWidth="4" readonly="true"/>
<EF:EFInput ename="result-0-thisPriceTax" cname="本次结算价税合计金额(元)" colWidth="4" readonly="true"/>
</div>
<div class="row">
<EF:EFInput ename="result-0-totalContractPrice" cname="合同金额(元)" colWidth="4" readonly="true"/>
<EF:EFInput ename="result-0-cumulativeSettlementAmount" cname="累计结算金额(元)" colWidth="4" readonly="true"/>
<EF:EFInput ename="result-0-cumulativeSettlementTax" cname="累计结算税金(元)" colWidth="4" readonly="true"/>
</div>
<div class="row">
<EF:EFInput ename="result-0-cumulativePriceTax" cname="累计结算价税合计金额(元)" colWidth="4" readonly="true"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="detail1" title="合同清单">
<EF:EFGrid blockId="detail1" autoDraw="override" checkMode="row" isFloat="true" copyToAdd="false">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="settlementNumber" cname="结算单" hidden="true"/>
<EF:EFColumn ename="settlementBasis" cname="结算依据" align="center" readonly="true" enable="false"/>
<EF:EFColumn ename="taskName" cname="任务名称" align="center" readonly="true" enable="false"/>
<EF:EFColumn ename="engineeringContent" cname="工程内容" align="center" readonly="true" enable="false"/>
<EF:EFColumn ename="thisEngineeringQuantity" cname="本次结算工程量" format="{0:N3}" align="center" readonly="true" enable="false"/>
<EF:EFColumn ename="cumulativeEngineeringQuantity" cname="至本次累计结算工程量" format="{0:N3}" align="center" readonly="true" enable="false"/>
<EF:EFColumn ename="unit" cname="单位" align="center" readonly="true" enable="false"/>
<EF:EFColumn ename="unitPrice" cname="单价" format="{0:N3}" align="center" readonly="true" enable="false"/>
<EF:EFColumn ename="totalPrice" cname="合价" format="{0:N3}" align="center" readonly="true" enable="false"/>
<EF:EFColumn ename="remarks" cname="备注" align="center" readonly="true" enable="false"/>
<EF:EFColumn ename="inventoryId" cname="清单id" hidden="true"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
<script>
var ctx = "${ctx}";
</script>
<script src="${ctx}/HG/CW/HGCW008B.js"></script>
\ No newline at end of file
$(function () {
IPLATUI.EFGrid = {
"result": {
"result1": {
toolbarConfig: {
hidden: true, // true时,不显示功能按钮,但保留setting导出按钮
},
query: {
},
columns: []
},
"result2": {
toolbarConfig: {
hidden: true, // true时,不显示功能按钮,但保留setting导出按钮
},
......@@ -22,13 +31,16 @@ $(function () {
* 确认
*/
$('#confirm').on('click', function () {
let allRows = new Array();
allRows = resultGrid.getCheckedRows();
if (allRows.length > 0) {
parent.JSColorbox.setValueCallback(allRows);
let result1Rows = new Array();
let result2Rows = new Array();
result1Rows = result1Grid.getCheckedRows();
result2Rows = result2Grid.getCheckedRows();
if (result1Rows.length > 0 || result2Rows.length > 0) {
parent.JSColorbox.setValueCallback(result1Rows,result2Rows);
} else {
message("请选择至少一条合同清单!");
message("请选择至少一条数据!");
return;
}
})
......@@ -40,7 +52,9 @@ $(function () {
* 查询
*/
function query() {
resultGrid.dataSource.page(1);
result1Grid.dataSource.page(1);
result2Grid.dataSource.page(1);
}
$(window).load(function () {
......
......@@ -10,7 +10,7 @@
<EF:EFInput cname="IDS" ename="inventoryIds" blockId="inqu_status" row="0" type="hidden" />
<EF:EFInput cname="DIDS" ename="deductionIds" blockId="inqu_status" row="0" type="hidden" />
<EF:EFRegion id="result1" title="合同清单">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true">
<EF:EFGrid blockId="result1" autoDraw="override" isFloat="true">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="inventory" cname="清单" align="center" enable="false"/>
<EF:EFColumn ename="unit" cname="单位" align="center" enable="false"/>
......@@ -24,7 +24,7 @@
</EF:EFGrid>
</EF:EFRegion>
<EF:EFRegion id="result2" title="扣款单">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true">
<EF:EFGrid blockId="result2" autoDraw="override" isFloat="true" queryMethod="query2">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="projCode" cname="项目编号" align="center" enable="false"/>
<EF:EFColumn ename="projName" cname="项目名称" align="center" enable="false"/>
......
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