Commit ab3093e8 by YG6494

Merge branch 'dev' of http://git.pseer.com:8800/platform/hg-smart into dev-zjh

parents d4bc51f0 b4280439
...@@ -149,55 +149,6 @@ public class ServiceHGCW002 extends ServiceBase { ...@@ -149,55 +149,6 @@ public class ServiceHGCW002 extends ServiceBase {
DaoUtils.update("HGCW002.update", HGCW002); 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 { ...@@ -289,4 +240,11 @@ public class ServiceHGCW002 extends ServiceBase {
return inInfo; 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; ...@@ -3,8 +3,10 @@ package com.baosight.hggp.hg.cw.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation; import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum; import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.dao.DaoUtils; 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.domain.HGCW003;
import com.baosight.hggp.hg.cw.tools.HGCWTools; 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.CommonMethod;
import com.baosight.hggp.util.DateUtils; import com.baosight.hggp.util.DateUtils;
import com.baosight.hggp.util.LogUtils; import com.baosight.hggp.util.LogUtils;
...@@ -13,6 +15,7 @@ import com.baosight.iplat4j.core.ei.EiInfo; ...@@ -13,6 +15,7 @@ import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.core.util.NumberUtils; import com.baosight.iplat4j.core.util.NumberUtils;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.DecimalFormat; import java.text.DecimalFormat;
...@@ -76,6 +79,9 @@ public class ServiceHGCW003 extends ServiceBase { ...@@ -76,6 +79,9 @@ public class ServiceHGCW003 extends ServiceBase {
for (int i = 0; i < resultRows.size(); i++) { for (int i = 0; i < resultRows.size(); i++) {
HGCW003 HGCW003 = new HGCW003(); HGCW003 HGCW003 = new HGCW003();
HGCW003.fromMap(resultRows.get(i)); HGCW003.fromMap(resultRows.get(i));
UserVO userVO = HGCWTools.HgCw002.getUserCompany();
HGCW003.setCompanyCode(userVO.getUsercode());
HGCW003.setCompanyName(userVO.getUsername());
contractNumber = HGCW003.getContractNumber(); contractNumber = HGCW003.getContractNumber();
if (HGCW003.getId() == null || HGCW003.getId() == 0) { if (HGCW003.getId() == null || HGCW003.getId() == 0) {
this.add(HGCW003); this.add(HGCW003);
......
...@@ -4,6 +4,7 @@ import com.baosight.hggp.aspect.annotation.OperationLogAnnotation; ...@@ -4,6 +4,7 @@ import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.core.dao.DaoUtils; import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.cw.domain.HGCW007; import com.baosight.hggp.hg.cw.domain.HGCW007;
import com.baosight.hggp.hg.cw.tools.HGCWTools; 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.hggp.util.LogUtils;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
...@@ -72,6 +73,9 @@ public class ServiceHGCW007 extends ServiceBase { ...@@ -72,6 +73,9 @@ public class ServiceHGCW007 extends ServiceBase {
for (int i = 0; i < resultRows.size(); i++) { for (int i = 0; i < resultRows.size(); i++) {
HGCW007 HGCW007 = new HGCW007(); HGCW007 HGCW007 = new HGCW007();
HGCW007.fromMap(resultRows.get(i)); HGCW007.fromMap(resultRows.get(i));
UserVO userVO = HGCWTools.HgCw002.getUserCompany();
HGCW007.setCompanyCode(userVO.getUsercode());
HGCW007.setCompanyName(userVO.getUsername());
contractNumber = HGCW007.getContractNumber(); contractNumber = HGCW007.getContractNumber();
if (HGCW007.getId() == null || HGCW007.getId() == 0) { if (HGCW007.getId() == null || HGCW007.getId() == 0) {
this.add(HGCW007); this.add(HGCW007);
......
...@@ -91,30 +91,14 @@ public class ServiceHGCW008 extends ServiceBase { ...@@ -91,30 +91,14 @@ public class ServiceHGCW008 extends ServiceBase {
this.add(HGCW008); this.add(HGCW008);
// 写入其他数据 // 写入其他数据
HGCWTools.HgCw009.save(detail1Rows,settlementNumber,userVO); HGCWTools.HgCw009.save(detail1Rows,settlementNumber,userVO);
// 更新合同结算状态
HGCWTools.HgCw002.updateBalanceStatus(HGCW008.getContractNumber(),HGCW008.getSettlementType() + 1);
} else { } else {
BigDecimal totalContractPriceExcluding = new BigDecimal(0); HGCW008.setContractDate(DateUtils.formatShort(HGCW008.getContractDate()));
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");
this.modify(HGCW008); 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 = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
......
package com.baosight.hggp.hg.cw.service; package com.baosight.hggp.hg.cw.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation; import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.hg.cw.domain.HGCW006; import com.baosight.hggp.hg.cw.domain.*;
import com.baosight.hggp.hg.cw.domain.HGCW007;
import com.baosight.hggp.hg.cw.domain.HGCW999;
import com.baosight.hggp.hg.cw.tools.HGCWTools; import com.baosight.hggp.hg.cw.tools.HGCWTools;
import com.baosight.hggp.util.LogUtils; import com.baosight.hggp.util.LogUtils;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
...@@ -28,15 +26,12 @@ public class ServiceHGCW008C extends ServiceBase { ...@@ -28,15 +26,12 @@ public class ServiceHGCW008C extends ServiceBase {
@OperationLogAnnotation(operModul = "合同详情",operType = "查询",operDesc = "初始化") @OperationLogAnnotation(operModul = "合同详情",operType = "查询",operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) { public EiInfo initLoad(EiInfo inInfo) {
try { try {
// CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.PROJECT_CODE_BOX_BLOCK_ID), null, false);
String id = inInfo.getString("id"); String id = inInfo.getString("id");
HGCW006 HGCW006 = HGCWTools.HgCw006.getId(id); HGCW008 HGCW008 = HGCWTools.HgCw008.getId(id);
inInfo.addBlock(EiConstant.resultBlock).addRow(HGCW006); inInfo.addBlock(EiConstant.resultBlock).addRow(HGCW008);
//获取清单 //获取清单
List<HGCW007> hgcw007List = HGCWTools.HgCw007.queryByContractNumber(HGCW006.getContractNumber()); List<HGCW009> hgcw009List = HGCWTools.HgCw009.queryBySettlementNumber(HGCW008.getSettlementNumber());
inInfo.addBlock("detail1").addRows(hgcw007List); inInfo.addBlock("detail1").addRows(hgcw009List);
List<HGCW999> hgcw999List = HGCWTools.HgCw999.queryByBiz(HGCW006.getId(),"ZL");
inInfo.addBlock("detail2").addRows(hgcw999List);
} catch (PlatException e) { } catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败"); LogUtils.setDetailMsg(inInfo, e, "初始化失败");
} }
......
...@@ -47,9 +47,7 @@ public class ServiceHGCW008E extends ServiceBase { ...@@ -47,9 +47,7 @@ public class ServiceHGCW008E extends ServiceBase {
public EiInfo query(EiInfo inInfo) { public EiInfo query(EiInfo inInfo) {
try { try {
List<String> ids = new ArrayList<>(); List<String> ids = new ArrayList<>();
List<String> dids = new ArrayList<>();
String inventoryIds = inInfo.getString("inqu_status-0-inventoryIds"); String inventoryIds = inInfo.getString("inqu_status-0-inventoryIds");
String deductionIds = inInfo.getString("inqu_status-0-deductionIds");
if (StringUtils.isNotEmpty(inventoryIds)) { if (StringUtils.isNotEmpty(inventoryIds)) {
String[] inventoryIdsArr = inventoryIds.split(","); String[] inventoryIdsArr = inventoryIds.split(",");
...@@ -59,6 +57,24 @@ public class ServiceHGCW008E extends ServiceBase { ...@@ -59,6 +57,24 @@ public class ServiceHGCW008E extends ServiceBase {
inInfo.set("inqu_status-0-ids", ids); inInfo.set("inqu_status-0-ids", ids);
} }
inInfo = super.query(inInfo, HGCW003.QUERY, new HGCW003(),new HGCW003().eiMetadata,"","","result1",false); 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)) { if (StringUtils.isNotEmpty(deductionIds)) {
String[] deductionIdsArr = deductionIds.split(","); String[] deductionIdsArr = deductionIds.split(",");
for (String id : deductionIdsArr) { for (String id : deductionIdsArr) {
......
...@@ -2,8 +2,9 @@ package com.baosight.hggp.hg.cw.service; ...@@ -2,8 +2,9 @@ package com.baosight.hggp.hg.cw.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation; import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.core.dao.DaoUtils; 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.tools.HGCWTools;
import com.baosight.hggp.hg.cw.vo.UserVO;
import com.baosight.hggp.util.LogUtils; import com.baosight.hggp.util.LogUtils;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
...@@ -29,7 +30,7 @@ public class ServiceHGCW009 extends ServiceBase { ...@@ -29,7 +30,7 @@ public class ServiceHGCW009 extends ServiceBase {
@OperationLogAnnotation(operModul = "合同清单",operType = "查询",operDesc = "初始化") @OperationLogAnnotation(operModul = "合同清单",operType = "查询",operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) { public EiInfo initLoad(EiInfo inInfo) {
try { try {
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGCW007().eiMetadata); inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGCW009().eiMetadata);
} catch (PlatException e) { } catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败"); LogUtils.setDetailMsg(inInfo, e, "初始化失败");
} }
...@@ -46,7 +47,7 @@ public class ServiceHGCW009 extends ServiceBase { ...@@ -46,7 +47,7 @@ public class ServiceHGCW009 extends ServiceBase {
@Override @Override
public EiInfo query(EiInfo inInfo) { public EiInfo query(EiInfo inInfo) {
try { try {
inInfo = super.query(inInfo, HGCW007.QUERY, new HGCW007()); inInfo = super.query(inInfo, HGCW009.QUERY, new HGCW009());
} catch (Exception e) { } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败"); LogUtils.setDetailMsg(inInfo, e, "查询失败");
} }
...@@ -64,20 +65,23 @@ public class ServiceHGCW009 extends ServiceBase { ...@@ -64,20 +65,23 @@ public class ServiceHGCW009 extends ServiceBase {
EiInfo eiInfo = new EiInfo(); EiInfo eiInfo = new EiInfo();
try { try {
List<Map> resultRows = inInfo.getBlock("detail1").getRows(); List<Map> resultRows = inInfo.getBlock("detail1").getRows();
String contractNumber = ""; String settlementNumber = "";
// 写入数据 // 写入数据
for (int i = 0; i < resultRows.size(); i++) { for (int i = 0; i < resultRows.size(); i++) {
HGCW007 HGCW007 = new HGCW007(); HGCW009 HGCW009 = new HGCW009();
HGCW007.fromMap(resultRows.get(i)); HGCW009.fromMap(resultRows.get(i));
contractNumber = HGCW007.getContractNumber(); UserVO userVO = HGCWTools.HgCw002.getUserCompany();
if (HGCW007.getId() == null || HGCW007.getId() == 0) { HGCW009.setCompanyCode(userVO.getUsercode());
this.add(HGCW007); HGCW009.setCompanyName(userVO.getUsername());
settlementNumber = HGCW009.getSettlementNumber();
if (HGCW009.getId() == null || HGCW009.getId() == 0) {
this.add(HGCW009);
} else { } else {
this.modify(HGCW007); this.modify(HGCW009);
} }
} }
List<HGCW007> HGCW007List = HGCWTools.HgCw007.queryByContractNumber(contractNumber); List<HGCW009> HGCW009List = HGCWTools.HgCw009.queryBySettlementNumber(settlementNumber);
eiInfo.addBlock("detail1").addRows(HGCW007List); eiInfo.addBlock("detail1").addRows(HGCW009List);
eiInfo.setStatus(EiConstant.STATUS_DEFAULT); eiInfo.setStatus(EiConstant.STATUS_DEFAULT);
eiInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!"); eiInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) { } catch (Exception e) {
...@@ -89,25 +93,25 @@ public class ServiceHGCW009 extends ServiceBase { ...@@ -89,25 +93,25 @@ public class ServiceHGCW009 extends ServiceBase {
/** /**
* 新增操作 * 新增操作
* *
* @param HGCW007 * @param HGCW009
* @return * @return
*/ */
public void add(HGCW007 HGCW007) { public void add(HGCW009 HGCW009) {
DaoUtils.insert("HGCW007.insert", HGCW007); DaoUtils.insert("HGCW009.insert", HGCW009);
} }
/** /**
* 修改操作 * 修改操作
* *
* @param HGCW007 * @param HGCW009
* @return * @return
*/ */
public void modify(HGCW007 HGCW007) { public void modify(HGCW009 HGCW009) {
DaoUtils.update("HGCW007.update", HGCW007); DaoUtils.update("HGCW009.update", HGCW009);
} }
public void deleteEntity(HGCW007 HGCW007) { public void deleteEntity(HGCW009 HGCW009) {
DaoUtils.update("HGCW007.delete", HGCW007); DaoUtils.update("HGCW009.delete", HGCW009);
} }
/** /**
...@@ -121,16 +125,16 @@ public class ServiceHGCW009 extends ServiceBase { ...@@ -121,16 +125,16 @@ public class ServiceHGCW009 extends ServiceBase {
EiInfo eiInfo = new EiInfo(); EiInfo eiInfo = new EiInfo();
try { try {
List<Map> resultRows = inInfo.getBlock("detail1").getRows(); List<Map> resultRows = inInfo.getBlock("detail1").getRows();
String contractNumber = ""; String settlementNumber = "";
// 写入数据 // 写入数据
for (int i = 0; i < resultRows.size(); i++) { for (int i = 0; i < resultRows.size(); i++) {
HGCW007 HGCW007 = new HGCW007(); HGCW009 HGCW009 = new HGCW009();
HGCW007.fromMap(resultRows.get(i)); HGCW009.fromMap(resultRows.get(i));
contractNumber = HGCW007.getContractNumber(); settlementNumber = HGCW009.getSettlementNumber();
this.deleteEntity(HGCW007); this.deleteEntity(HGCW009);
} }
List<HGCW007> HGCW007List = HGCWTools.HgCw007.queryByContractNumber(contractNumber); List<HGCW009> HGCW009List = HGCWTools.HgCw009.queryBySettlementNumber(settlementNumber);
eiInfo.addBlock("detail1").addRows(HGCW007List); eiInfo.addBlock("detail1").addRows(HGCW009List);
eiInfo.setStatus(EiConstant.STATUS_DEFAULT); eiInfo.setStatus(EiConstant.STATUS_DEFAULT);
eiInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!"); eiInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!");
} catch (Exception e) { } catch (Exception e) {
......
...@@ -303,9 +303,6 @@ ...@@ -303,9 +303,6 @@
<update id="update"> <update id="update">
UPDATE ${hggpSchema}.HGCW008 UPDATE ${hggpSchema}.HGCW008
SET SET
ACCOUNT_CODE = #accountCode#, <!-- 企业编码 -->
COMPANY_CODE = #companyCode#, <!-- 公司编码 -->
COMPANY_NAME = #companyName#, <!-- 公司名称 -->
PROJ_CODE = #projCode#, <!-- 项目编码 --> PROJ_CODE = #projCode#, <!-- 项目编码 -->
PROJ_NAME = #projName#, <!-- 项目名称 --> PROJ_NAME = #projName#, <!-- 项目名称 -->
CONTRACT_NUMBER = #contractNumber#, <!-- 合同号 --> CONTRACT_NUMBER = #contractNumber#, <!-- 合同号 -->
...@@ -322,14 +319,9 @@ ...@@ -322,14 +319,9 @@
CUMULATIVE_SETTLEMENT_AMOUNT = #cumulativeSettlementAmount#, <!-- 累计结算金额 --> CUMULATIVE_SETTLEMENT_AMOUNT = #cumulativeSettlementAmount#, <!-- 累计结算金额 -->
CUMULATIVE_SETTLEMENT_TAX = #cumulativeSettlementTax#, <!-- 累计结算税金 --> CUMULATIVE_SETTLEMENT_TAX = #cumulativeSettlementTax#, <!-- 累计结算税金 -->
CUMULATIVE_PRICE_TAX = #cumulativePriceTax#, <!-- 累计结算价税合计金额 --> CUMULATIVE_PRICE_TAX = #cumulativePriceTax#, <!-- 累计结算价税合计金额 -->
REVIEW_STATUS = #reviewStatus#, <!-- 审核状态 -->
CREATED_BY = #createdBy#, <!-- 记录创建者 -->
CREATED_NAME = #createdName#, <!-- 记录创建名称 -->
CREATED_TIME = #createdTime#, <!-- 记录创建时间 -->
UPDATED_BY = #updatedBy#, <!-- 记录修改者 --> UPDATED_BY = #updatedBy#, <!-- 记录修改者 -->
UPDATED_NAME = #updatedName#, <!-- 记录修改名称 --> UPDATED_NAME = #updatedName#, <!-- 记录修改名称 -->
UPDATED_TIME = #updatedTime#, <!-- 记录修改时间 --> UPDATED_TIME = #updatedTime# <!-- 记录修改时间 -->
DEP_CODE = #depCode# <!-- 部门编码 -->
WHERE WHERE
ID = #id# ID = #id#
</update> </update>
...@@ -342,4 +334,15 @@ ...@@ -342,4 +334,15 @@
FROM ${hggpSchema}.HGCW008 WHERE 1=1 FROM ${hggpSchema}.HGCW008 WHERE 1=1
<include refid="condition" /> <include refid="condition" />
</select> </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> </sqlMap>
...@@ -5,17 +5,21 @@ import com.baosight.hggp.core.dao.DaoBase; ...@@ -5,17 +5,21 @@ 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.hg.cw.domain.*; import com.baosight.hggp.hg.cw.domain.*;
import com.baosight.hggp.hg.cw.vo.UserVO; 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.domain.Org;
import com.baosight.hggp.hg.xs.tools.HGXSTools; import com.baosight.hggp.hg.xs.tools.HGXSTools;
import com.baosight.hggp.util.AssertUtils; import com.baosight.hggp.util.AssertUtils;
import com.baosight.iplat4j.core.ProjectInfo; import com.baosight.iplat4j.core.ProjectInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
public class HGCWTools { public class HGCWTools {
...@@ -54,6 +58,14 @@ public class HGCWTools { ...@@ -54,6 +58,14 @@ public class HGCWTools {
{put("balanceStatus",balanceStatus);} {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{ public static class HgCw003{
...@@ -153,10 +165,114 @@ public class HGCWTools { ...@@ -153,10 +165,114 @@ public class HGCWTools {
public static List<HGCW009> queryBySettlementNumber(String settlementNumber) { public static List<HGCW009> queryBySettlementNumber(String settlementNumber) {
AssertUtils.isNull(settlementNumber, "结算单号不能为空!"); AssertUtils.isNull(settlementNumber, "结算单号不能为空!");
List<HGCW009> results = DaoBase.getInstance().query(HGCW009.QUERY,new HashMap<String,Object>(){ List<HGCW009> results = DaoBase.getInstance().query(HGCW009.QUERY,new HashMap<String,Object>(){
{put("contractNumber",settlementNumber);} {put("settlementNumber",settlementNumber);}
}); });
return results; 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 { public static class HgCw999 {
......
...@@ -81,6 +81,10 @@ function updateFunc() { ...@@ -81,6 +81,10 @@ function updateFunc() {
message("请选择一条数据"); message("请选择一条数据");
return; return;
} }
if (rows[0].reviewStatus == "3") {
message("已经提交的数据不能进行修改!");
return;
}
JSColorbox.open({ JSColorbox.open({
href: "HGCW002B?methodName=initLoad&id=" + rows[0].id + "&efParentFormEname=HGCW002", href: "HGCW002B?methodName=initLoad&id=" + rows[0].id + "&efParentFormEname=HGCW002",
title: "<div style='text-align: center;'>修改合同</div>", title: "<div style='text-align: center;'>修改合同</div>",
......
...@@ -81,6 +81,10 @@ function updateFunc() { ...@@ -81,6 +81,10 @@ function updateFunc() {
message("请选择一条数据"); message("请选择一条数据");
return; return;
} }
if (rows[0].reviewStatus == "3") {
message("已经提交的数据不能进行修改!");
return;
}
JSColorbox.open({ JSColorbox.open({
href: "HGCW006B?methodName=initLoad&id=" + rows[0].id + "&efParentFormEname=HGCW006", href: "HGCW006B?methodName=initLoad&id=" + rows[0].id + "&efParentFormEname=HGCW006",
title: "<div style='text-align: center;'>修改合同</div>", title: "<div style='text-align: center;'>修改合同</div>",
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
</head> </head>
<EF:EFPage title="修改合同"> <EF:EFPage title="修改合同">
<EF:EFRegion id="inqu1" title="基本信息"> <EF:EFRegion id="inqu1" title="基本信息">
<EF:EFInput ename="result-0-id" cname="id" type="hidden"/>
<div class="row"> <div class="row">
<EF:EFSelect cname="项目编号" ename="projCodeBox" colWidth="4" required="true" filter="contains"> <EF:EFSelect cname="项目编号" ename="projCodeBox" colWidth="4" required="true" filter="contains">
<EF:EFOption label="-- 请选择 --" value="" /> <EF:EFOption label="-- 请选择 --" value="" />
......
...@@ -79,6 +79,10 @@ function updateFunc() { ...@@ -79,6 +79,10 @@ function updateFunc() {
message("请选择一条数据"); message("请选择一条数据");
return; return;
} }
if (rows[0].reviewStatus == "3") {
message("已经提交的数据不能进行修改!");
return;
}
JSColorbox.open({ JSColorbox.open({
href: "HGCW008B?methodName=initLoad&id=" + rows[0].id + "&efParentFormEname=HGCW008", href: "HGCW008B?methodName=initLoad&id=" + rows[0].id + "&efParentFormEname=HGCW008",
title: "<div style='text-align: center;'>修改结算单</div>", title: "<div style='text-align: center;'>修改结算单</div>",
......
...@@ -205,8 +205,10 @@ function choiceFunc() { ...@@ -205,8 +205,10 @@ function choiceFunc() {
} }
function choiceCallbackFunc(result) { function choiceCallbackFunc(result1, result2) {
$.each(result, function(index, item) { var contractType = $("#contractType").val();
if (contractType == "1") {
$.each(result1, function(index, item) {
detail1Grid.dataSource.insert(); detail1Grid.dataSource.insert();
detail1Grid.setCellValue(0, "rowNo", 0); detail1Grid.setCellValue(0, "rowNo", 0);
detail1Grid.setCellValue(0, "settlementBasis", "合同内"); detail1Grid.setCellValue(0, "settlementBasis", "合同内");
...@@ -216,6 +218,29 @@ function choiceCallbackFunc(result) { ...@@ -216,6 +218,29 @@ function choiceCallbackFunc(result) {
detail1Grid.setCellValue(0, "inventoryId", item.id); detail1Grid.setCellValue(0, "inventoryId", item.id);
detail1Grid.refresh(); 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(); JSColorbox.close();
} }
function cancelFunc() { function cancelFunc() {
......
var sumCumulativeSettlementAmount = 0;
var sumCumulativeSettlementTax = 0;
$(function() { $(function() {
...@@ -16,84 +18,77 @@ $(function() { ...@@ -16,84 +18,77 @@ $(function() {
columns: [ columns: [
], ],
loadComplete: function (grid) { loadComplete: function (grid) {
$("#BTN_CHOICE").on("click",choiceFunc);
grid.dataSource.bind("change", function(e) { grid.dataSource.bind("change", function(e) {
if (e.field == "dayNumber") { if (e.field == "thisEngineeringQuantity") {
var tr,index; var tr,index;
// 获取此model元素信息 // 获取此model元素信息
var item = e.items[0]; var item = e.items[0];
// 计算总金额 var inventoryId = item.inventoryId;
var taxPoints = $("#result-0-taxPoints").val() ? $("#result-0-taxPoints").val() / 100 : 0; var thisEngineeringQuantity = parseFloat(item.thisEngineeringQuantity) || 0; // 工程量
var deviceNumber = parseFloat(item.deviceNumber) || 0; var unitPrice = parseFloat(item.unitPrice) || 0; // 单价
var unitPrice = parseFloat(item.unitPrice) || 0; var totalPrice = thisEngineeringQuantity * unitPrice; // 总价
var dayNumber = parseFloat(item.dayNumber) || 0;
var totalPrice = deviceNumber * unitPrice * dayNumber;
detail1Grid.setCellValue(item, 'totalPrice', parseFloat(totalPrice)); detail1Grid.setCellValue(item, 'totalPrice', parseFloat(totalPrice));
console.log(grid.dataSource._data); var cumulativeEngineeringQuantity = queryCumulativeEngineeringQuantity(inventoryId);
console.log(detail1Grid.getDataItems()); detail1Grid.setCellValue(item, 'cumulativeEngineeringQuantity', thisEngineeringQuantity + cumulativeEngineeringQuantity);
var allRows = detail1Grid.getDataItems(); // 计算总金额
var totalPriceExcluding = 0; calculateAmount(detail1Grid.getDataItems());
var totalPriceIncluding = 0; }
var valueAddedTax = 0;
totalPrice = 0;
deviceNumber = 0
allRows.forEach(function (row, index) {
totalPrice += parseFloat(row.totalPrice);
deviceNumber += parseFloat(row.deviceNumber);
}); });
totalPriceExcluding = totalPrice; grid.dataSource.bind("change", function(e) {
totalPriceIncluding = totalPriceExcluding * (1 + parseFloat(taxPoints)); if (e.field == "unitPrice") {
valueAddedTax = parseFloat(totalPriceIncluding) - parseFloat(totalPriceExcluding); var tr,index;
$("#result-0-totalContractPriceExcluding").val(parseFloat(totalPriceExcluding).toFixed(3)) // 获取此model元素信息
$("#result-0-totalContractPriceIncluding").val(parseFloat(totalPriceIncluding).toFixed(3)) var item = e.items[0];
$("#result-0-valueAddedTax").val(parseFloat(valueAddedTax).toFixed(3)) var inventoryId = item.inventoryId;
$("#result-0-totalQuantity").val(parseFloat(deviceNumber).toFixed(3)) var thisEngineeringQuantity = parseFloat(item.thisEngineeringQuantity) || 0; // 工程量
var unitPrice = parseFloat(item.unitPrice) || 0; // 单价
var totalPrice = thisEngineeringQuantity * unitPrice; // 总价
detail1Grid.setCellValue(item, 'totalPrice', parseFloat(totalPrice));
// 计算总金额
calculateAmount(detail1Grid.getDataItems());
} }
}); });
setTimeout(function() { setTimeout(function() {
initDate(); initDate();
}, 1000); }, 1000);
}, },
beforeAdd :function (e) {
console.log("新增前");
var contractType = $("#contractType").val();
if (contractType == "1") {
} else {
message("劳务合同不可新增!");
e.preventDefault();
}
},
onAdd: function (e) { onAdd: function (e) {
var contractNumber = $("#result-0-contractNumber").val(); var settlementNumber = $("#result-0-settlementNumber").val();
$.each(e.items, function (index, item) {
item['settlementNumber'] = settlementNumber;
});
var contractType = $("#contractType").val();
if (contractType == "1") {
$.each(e.items, function (index, item) { $.each(e.items, function (index, item) {
item['contractNumber'] = contractNumber; item['settlementBasis'] = "罚款";
}); });
}
}, },
onSave: function (e) { onSave: function (e) {
// 阻止默认请求,使用自定义保存 // 阻止默认请求,使用自定义保存
e.preventDefault(); e.preventDefault();
let btnNode = $(this); saveResult1Func();
//禁用按钮 calculateAmount(detail1Grid.getDataItems());
btnNode.attr("disabled", true);
saveResult1Func(btnNode);
}, },
onDelete: function (e) { onDelete: function (e) {
// 阻止默认请求,使用自定义删除 // 阻止默认请求,使用自定义删除
e.preventDefault(); e.preventDefault();
deleteResult1Func(); deleteResult1Func();
calculateAmount(detail1Grid.getDataItems());
}, },
} }
$("#UPLOAD_FILE").on("click", function () {
uploadFileFunc();
});
$("#DELETE_FILE").on("click", function () {
// let btnNode = $(this);
//禁用按钮
// btnNode.attr("disabled", true);
deleteFileFunc();
});
IPLATUI.EFGrid.detail2 = {
pageable: {
pageSize: 20,
pageSizes: [10,20,30,50,100,200],
},
columns: [
]
}
/** /**
* 下拉框事件 * 下拉框事件
* @type {{"result-0-contractType": {select: IPLATUI.EFSelect.result-0-contractType.select}, projCodeBox: {select: IPLATUI.EFSelect.projCodeBox.select}}} * @type {{"result-0-contractType": {select: IPLATUI.EFSelect.result-0-contractType.select}, projCodeBox: {select: IPLATUI.EFSelect.projCodeBox.select}}}
...@@ -117,19 +112,9 @@ $(function() { ...@@ -117,19 +112,9 @@ $(function() {
} }
} }
IPLATUI.EFPopupInput = {
"popupInputPartyA": {
/** IPLATUI.EFPopupInput = {
* EFGrid 查询时触发的事件,通常在此处,设置查询条件 "popupInputProjCode": {
* 注意: 必须返回一个EiInfo,作为初始查询条件
* 配置了query时,默认每次打开窗口都会进行一次查询
*/
query: function (e) {
console.log("Step" + (++i) + ": ----query----");
var info = new EiInfo();
return info;
},
/** /**
* grid中的数据回填时触发的事件 * grid中的数据回填时触发的事件
* @param e 回填数据事件 * @param e 回填数据事件
...@@ -141,12 +126,26 @@ $(function() { ...@@ -141,12 +126,26 @@ $(function() {
console.log("Step" + (++i) + ": ----backFill----"); console.log("Step" + (++i) + ": ----backFill----");
// 回填数据 // 回填数据
var model = e.model; var model = e.model;
// var data = model.toJSON(); var contractNumber = model.contractNumber;
console.log(model); var info = new EiInfo();
var partyA = model.usercode + "-" + model.username; info.set("contractNumber", contractNumber);
$("#result-0-partyA").val(partyA); EiCommunicator.send("HGCW008", "queryCalculateAmount", info, {
IPLAT.EFPopupInput.text( $("#popupInputPartyA") , partyA) onSuccess: function (ei) {
e.preventDefault(); // 不使用默认的回填逻辑 if (ei.getStatus() >= 0) {
var data = ei.extAttr.result;
sumCumulativeSettlementAmount = data[0].sumCumulativeSettlementAmount;
sumCumulativeSettlementTax = data[0].sumCumulativeSettlementTax;
} else {
NotificationUtil(ei, "error");
return 0;
}
},
onFail: function (ei) {
// 发生异常
NotificationUtil("操作失败,原因[" + ei + "]", "error");
return 0;
}
});
} }
} }
}; };
...@@ -160,139 +159,230 @@ $(function() { ...@@ -160,139 +159,230 @@ $(function() {
} }
}) })
}); });
function initDate() {
var projCode = $("#result-0-projCode").val();
$("#projCodeBox").data("kendoDropDownList").value(projCode);
var partyA = $("#result-0-partyA").val();
IPLAT.EFPopupInput.text( $("#popupInputPartyA") , partyA)
function choiceFunc() {
var contractType = $("#contractType").val();
var contractNumber = $("#result-0-contractNumber").val();
if (contractNumber) {
//获取已经加载的合同清单数据
var inventoryIds = [];
var deductionIds = [];
let allRows = new Array();
allRows = detail1Grid.getDataItems();
if (allRows) {
allRows.forEach(function (row, index) {
if (row.settlementBasis == "合同内") {
inventoryIds.push(row.inventoryId);
} else {
if (row.inventoryId) {
deductionIds.push(row.inventoryId);
}
}
})
}
if (contractType == "1") {
JSColorbox.open({
href: "HGCW008D?methodName=initLoad&inqu_status-0-contractNumber=" + contractNumber +
"&inqu_status-0-inventoryIds=" + inventoryIds.join(","),
title: "<div style='text-align: center;'>合同清单</div>",
width: "80%",
height: "80%",
dispaly: "flex",
callbackName: choiceCallbackFunc
});
$("#JSColorboxWin").css({"height": "100%"})
} else {
JSColorbox.open({
href: "HGCW008E?methodName=initLoad&inqu_status-0-contractNumber=" + contractNumber +
"&inqu_status-0-inventoryIds=" + inventoryIds.join(",") +
"&inqu_status-0-deductionIds=" + deductionIds.join(","),
title: "<div style='text-align: center;'>合同清单</div>",
width: "80%",
height: "80%",
dispaly: "flex",
callbackName: choiceCallbackFunc
});
$("#JSColorboxWin").css({"height": "100%"})
}
} else {
message("请先选择合同!");
}
} }
function saveResult1Func(btn) { function choiceCallbackFunc(result1, result2) {
let rows = detail1Grid.getCheckedRows(); var contractType = $("#contractType").val();
if (rows.length < 1) { if (contractType == "1") {
message("请选择数据"); $.each(result1, function(index, item) {
return; 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();
})
} }
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
JSColorbox.close();
}
function cancelFunc() {
// 关闭弹窗
parent.JSColorbox.setValueCallback();
}
function btnSaveFunc() {
fieldValidation();
JSUtils.confirm("确定对数据做\"保存\"操作? ", {
ok: function () { ok: function () {
JSUtils.submitGrid("detail1", "HGCW008", "save", {isAlldata:true,onSuccessCallback:parent.windowCallback});
}
});
}
function queryCumulativeEngineeringQuantity(inventoryId) {
if (inventoryId) {
var info = new EiInfo(); var info = new EiInfo();
info.addBlock(JSUtils.checkedRows2Block("detail1")); info.set("inventoryId", inventoryId);
EiCommunicator.send("HGCW003", "save", info, { EiCommunicator.send("HGCW009", "queryEngineeringQuantity", info, {
onSuccess: function (ei) { onSuccess: function (ei) {
if (ei.getStatus() >= 0) { if (ei.getStatus() >= 0) {
try { return ei.result
NotificationUtil(response.msg);
} catch (e) {
// TODO: handle exception
}
if (IPLAT.isAvailable("detail1")) {
window['detail1Grid'].setEiInfo(ei);
}
if (ei.getStatus() == 0) {
NotificationUtil(ei, 'warning');
} else {
NotificationUtil(ei);
}
} else { } else {
NotificationUtil(ei, "error"); NotificationUtil(ei, "error");
return 0;
} }
}, },
onFail: function (ei) { onFail: function (ei) {
// 发生异常 // 发生异常
NotificationUtil("操作失败,原因[" + ei + "]", "error"); NotificationUtil("操作失败,原因[" + ei + "]", "error");
return 0;
} }
}); });
//释放禁用按钮
btn.attr("disabled", false);
} }
}); return 0;
} }
function uploadFileFunc() {
var id = $("#result-0-id").val();
JSColorbox.open({
href: "HGCW099?methodName=initLoad&inqu_status-0-bizType=ZL&inqu_status-0-matId=" + id,
title: "<div style='text-align: center;'>附件上传</div>",
width: "60%",
height: "50%",
callbackName: uploadFileCallback
});
}
/** /**
* 附件上传回调 * 本次结算金额: 明细的本次结算求和
* * 累计结算金额: 当前合同的所有结算单本次结算金额求和
* @param docId * 本次结算税金: 明细的本次结算求和(不含扣款 )*税率
* 累计结算税金:当前合同的所有结算单的“本次结算税金”求和
* 本次价税合计=本次结算金额+本次结算税金
* 累计价税合计=累计结算金额+累计结算税金
* 劳务合同的本次结算税金: 明细的本次结算求和(不含扣款 )*税率
* 销售合同的本次结算税金: 明细的本次结算求和*税率
* @param rows
*/ */
function uploadFileCallback(data) { function calculateAmount(rows) {
let inEiInfo = new EiInfo(); var contractType = $("#contractType").val();
inEiInfo.set("result-0-matId", data.matId); var totalPrice = 0;
inEiInfo.set("result-0-docId", data.docId); var deductionPrice= 0;
inEiInfo.set("result-0-bizType", data.bizType); rows.forEach(function (row, index) {
EiCommunicator.send('HGCW999', 'insert', inEiInfo, { if (row.settlementBasis == "合同内") {
onSuccess(ei) { totalPrice += parseFloat(row.totalPrice);
if (ei.status === 0) {
try {
NotificationUtil(ei.msg);
} catch (e) {
// TODO: handle exception
}
if (IPLAT.isAvailable("detail2")) {
window['detail2Grid'].setEiInfo(ei);
}
if (ei.getStatus() == 0) {
NotificationUtil(ei, 'warning');
} else { } else {
NotificationUtil(ei); deductionPrice += parseFloat(row.totalPrice);
} }
});
//税点
var taxPoints = $("#result-0-taxPoints").val() ? $("#result-0-taxPoints").val() / 100 : 0;
//本次结算金额
var thisSettlementAmount = totalPrice + deductionPrice;
//累计结算金额
var cumulativeSettlementAmount = sumCumulativeSettlementAmount + thisSettlementAmount;
//本次结算税金
var thisSettlementTax = 0;
if (contractType == "1") {
thisSettlementTax = thisSettlementAmount * taxPoints;
} else {
thisSettlementTax = totalPrice * taxPoints;
}
//累计结算税金
var cumulativeSettlementTax = sumCumulativeSettlementTax + thisSettlementTax;
//本次价税合计=本次结算金额+本次结算税金
var thisPriceTax = parseFloat(thisSettlementAmount) + parseFloat(thisSettlementTax);
//累计价税合计=累计结算金额+累计结算税金
var cumulativePriceTax = parseFloat(cumulativeSettlementAmount) + parseFloat(cumulativeSettlementTax);
$("#result-0-thisSettlementAmount").val(parseFloat(thisSettlementAmount).toFixed(3))
$("#result-0-cumulativeSettlementAmount").val(parseFloat(cumulativeSettlementAmount).toFixed(3))
$("#result-0-thisSettlementTax").val(parseFloat(thisSettlementTax).toFixed(3))
$("#result-0-cumulativeSettlementTax").val(parseFloat(cumulativeSettlementTax).toFixed(3))
$("#result-0-thisPriceTax").val(parseFloat(thisPriceTax).toFixed(3))
$("#result-0-cumulativePriceTax").val(parseFloat(cumulativePriceTax).toFixed(3))
}
function initDate() {
var projCode = $("#result-0-projCode").val();
var contractNumber = $("#result-0-contractNumber").val();
IPLAT.EFPopupInput.text( $("#popupInputProjCode") , projCode)
//根据合同回去合同类型
var info = new EiInfo();
info.set("contractNumber", contractNumber);
EiCommunicator.send("HGCW002", "queryContractByNumber", info, {
onSuccess: function (ei) {
if (ei.getStatus() >= 0) {
var data = ei.extAttr.hgcw002;
$("#contractType").val(data.contractType);
} else { } else {
NotificationUtil("执行失败!", "error"); NotificationUtil(ei, "error");
return 0;
} }
}, },
onFail(errorMessage, status, e) { onFail: function (ei) {
NotificationUtil("执行失败!", "error"); // 发生异常
NotificationUtil("操作失败,原因[" + ei + "]", "error");
return 0;
} }
}, {
async: false
}); });
} }
function cancelFunc() { function saveResult1Func(btn) {
// 关闭弹窗 let rows = detail1Grid.getCheckedRows();
parent.JSColorbox.setValueCallback();
}
function btnSaveFunc() {
fieldValidation();
JSUtils.confirm("确定对数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGrid("detail1,detail2", "HGCW002", "save", {isAlldata:true,onSuccessCallback:parent.windowCallback});
}
});
}
function deleteFileFunc() {
let rows = detail2Grid.getCheckedRows();
if (rows.length < 1) { if (rows.length < 1) {
message("请选择数据"); message("请选择数据");
return; return;
} }
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"删除\"操作? ", { JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () { ok: function () {
var info = new EiInfo(); var info = new EiInfo();
info.addBlock(JSUtils.checkedRows2Block("detail2")); info.addBlock(JSUtils.checkedRows2Block("detail1"));
EiCommunicator.send("HGCW999", "delete", info, { EiCommunicator.send("HGCW009", "save", info, {
onSuccess: function (ei) { onSuccess: function (ei) {
if (ei.getStatus() >= 0) { if (ei.getStatus() >= 0) {
try { try {
NotificationUtil(ei.msg); NotificationUtil(response.msg);
} catch (e) { } catch (e) {
// TODO: handle exception // TODO: handle exception
} }
if (IPLAT.isAvailable("detail2")) { if (IPLAT.isAvailable("detail1")) {
window['detail2Grid'].setEiInfo(ei); window['detail1Grid'].setEiInfo(ei);
} }
if (ei.getStatus() == 0) { if (ei.getStatus() == 0) {
NotificationUtil(ei, 'warning'); NotificationUtil(ei, 'warning');
...@@ -309,12 +399,10 @@ function deleteFileFunc() { ...@@ -309,12 +399,10 @@ function deleteFileFunc() {
NotificationUtil("操作失败,原因[" + ei + "]", "error"); NotificationUtil("操作失败,原因[" + ei + "]", "error");
} }
}); });
//释放禁用按钮
// btn.attr("disabled", false);
} }
}); });
} }
function deleteResult1Func() { function deleteResult1Func() {
let rows = detail1Grid.getCheckedRows(); let rows = detail1Grid.getCheckedRows();
if (rows.length < 1) { if (rows.length < 1) {
...@@ -325,7 +413,7 @@ function deleteResult1Func() { ...@@ -325,7 +413,7 @@ function deleteResult1Func() {
ok: function () { ok: function () {
var info = new EiInfo(); var info = new EiInfo();
info.addBlock(JSUtils.checkedRows2Block("detail1")); info.addBlock(JSUtils.checkedRows2Block("detail1"));
EiCommunicator.send("HGCW003", "delete", info, { EiCommunicator.send("HGCW009", "delete", info, {
onSuccess: function (ei) { onSuccess: function (ei) {
if (ei.getStatus() >= 0) { if (ei.getStatus() >= 0) {
try { try {
...@@ -355,31 +443,9 @@ function deleteResult1Func() { ...@@ -355,31 +443,9 @@ function deleteResult1Func() {
} }
}); });
} }
function fieldValidation() {
function calculateAmount() {
var allRows = detail1Grid.getDataItems();
var totalPriceExcluding = 0;
var totalPriceIncluding = 0;
var valueAddedTax = 0;
allRows.forEach(function (row, index) {
totalPriceExcluding += parseFloat(row.totalPriceExcluding);
totalPriceIncluding += parseFloat(row.totalPriceIncluding);
});
valueAddedTax = parseFloat(totalPriceIncluding) - parseFloat(totalPriceExcluding);
$("#result-0-totalContractPriceExcluding").val(totalPriceExcluding.toFixed(3))
$("#result-0-totalContractPriceIncluding").val(totalPriceIncluding.toFixed(3))
$("#result-0-valueAddedTax").val(valueAddedTax.toFixed(3))
} }
function fieldValidation() {
var contractType = $("#result-0-contractType").val();
if (contractType == "3") {
var mainContractNumber = $("#result-0-mainContractNumber").val();
if (!mainContractNumber) {
message("请填写主合同号!");
return;
}
}
}
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
</head> </head>
<EF:EFPage title="修改结算单"> <EF:EFPage title="修改结算单">
<EF:EFRegion id="inqu1" title="基本信息"> <EF:EFRegion id="inqu1" title="基本信息">
<EF:EFInput ename="result-0-id" cname="id" type="hidden"/>
<div class="row"> <div class="row">
<EF:EFPopupInput ename="popupInputProjCode" cname="项目编号" colWidth="4" <EF:EFPopupInput ename="popupInputProjCode" cname="项目编号" colWidth="4"
serviceName="HGCW002" methodName="queryContractByType" serviceName="HGCW002" methodName="queryContractByType"
...@@ -65,8 +66,8 @@ ...@@ -65,8 +66,8 @@
<EF:EFRegion id="detail1" title="合同清单"> <EF:EFRegion id="detail1" title="合同清单">
<EF:EFGrid blockId="detail1" autoDraw="override" checkMode="row" isFloat="true" copyToAdd="false"> <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="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="settlementNumber" cname="结算单" hidden="true"/>
<EF:EFColumn ename="settlementBasis" cname="结算依据" align="center" /> <EF:EFColumn ename="settlementBasis" cname="结算依据" align="center" />
<EF:EFColumn ename="taskName" cname="任务名称" align="center" /> <EF:EFColumn ename="taskName" cname="任务名称" align="center" />
<EF:EFColumn ename="engineeringContent" 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 () { $(function () {
IPLATUI.EFGrid = { IPLATUI.EFGrid = {
"result": { "result1": {
toolbarConfig: {
hidden: true, // true时,不显示功能按钮,但保留setting导出按钮
},
query: {
},
columns: []
},
"result2": {
toolbarConfig: { toolbarConfig: {
hidden: true, // true时,不显示功能按钮,但保留setting导出按钮 hidden: true, // true时,不显示功能按钮,但保留setting导出按钮
}, },
...@@ -22,13 +31,16 @@ $(function () { ...@@ -22,13 +31,16 @@ $(function () {
* 确认 * 确认
*/ */
$('#confirm').on('click', function () { $('#confirm').on('click', function () {
let allRows = new Array(); let result1Rows = new Array();
allRows = resultGrid.getCheckedRows(); let result2Rows = new Array();
if (allRows.length > 0) {
parent.JSColorbox.setValueCallback(allRows);
result1Rows = result1Grid.getCheckedRows();
result2Rows = result2Grid.getCheckedRows();
if (result1Rows.length > 0 || result2Rows.length > 0) {
parent.JSColorbox.setValueCallback(result1Rows,result2Rows);
} else { } else {
message("请选择至少一条合同清单!"); message("请选择至少一条数据!");
return; return;
} }
}) })
...@@ -40,7 +52,9 @@ $(function () { ...@@ -40,7 +52,9 @@ $(function () {
* 查询 * 查询
*/ */
function query() { function query() {
resultGrid.dataSource.page(1); result1Grid.dataSource.page(1);
result2Grid.dataSource.page(1);
} }
$(window).load(function () { $(window).load(function () {
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<EF:EFInput cname="IDS" ename="inventoryIds" blockId="inqu_status" row="0" type="hidden" /> <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:EFInput cname="DIDS" ename="deductionIds" blockId="inqu_status" row="0" type="hidden" />
<EF:EFRegion id="result1" title="合同清单"> <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="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="inventory" cname="清单" align="center" enable="false"/> <EF:EFColumn ename="inventory" cname="清单" align="center" enable="false"/>
<EF:EFColumn ename="unit" cname="单位" align="center" enable="false"/> <EF:EFColumn ename="unit" cname="单位" align="center" enable="false"/>
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
</EF:EFGrid> </EF:EFGrid>
</EF:EFRegion> </EF:EFRegion>
<EF:EFRegion id="result2" title="扣款单"> <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="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="projCode" cname="项目编号" align="center" enable="false"/> <EF:EFColumn ename="projCode" cname="项目编号" align="center" enable="false"/>
<EF:EFColumn ename="projName" 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