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() {
......
var sumCumulativeSettlementAmount = 0;
var sumCumulativeSettlementTax = 0;
$(function() {
......@@ -16,84 +18,77 @@ $(function() {
columns: [
],
loadComplete: function (grid) {
$("#BTN_CHOICE").on("click",choiceFunc);
grid.dataSource.bind("change", function(e) {
if (e.field == "dayNumber") {
if (e.field == "thisEngineeringQuantity") {
var tr,index;
// 获取此model元素信息
var item = e.items[0];
var inventoryId = item.inventoryId;
var thisEngineeringQuantity = parseFloat(item.thisEngineeringQuantity) || 0; // 工程量
var unitPrice = parseFloat(item.unitPrice) || 0; // 单价
var totalPrice = thisEngineeringQuantity * unitPrice; // 总价
detail1Grid.setCellValue(item, 'totalPrice', parseFloat(totalPrice));
var cumulativeEngineeringQuantity = queryCumulativeEngineeringQuantity(inventoryId);
detail1Grid.setCellValue(item, 'cumulativeEngineeringQuantity', thisEngineeringQuantity + cumulativeEngineeringQuantity);
// 计算总金额
var taxPoints = $("#result-0-taxPoints").val() ? $("#result-0-taxPoints").val() / 100 : 0;
var deviceNumber = parseFloat(item.deviceNumber) || 0;
var unitPrice = parseFloat(item.unitPrice) || 0;
var dayNumber = parseFloat(item.dayNumber) || 0;
var totalPrice = deviceNumber * unitPrice * dayNumber;
calculateAmount(detail1Grid.getDataItems());
}
});
grid.dataSource.bind("change", function(e) {
if (e.field == "unitPrice") {
var tr,index;
// 获取此model元素信息
var item = e.items[0];
var inventoryId = item.inventoryId;
var thisEngineeringQuantity = parseFloat(item.thisEngineeringQuantity) || 0; // 工程量
var unitPrice = parseFloat(item.unitPrice) || 0; // 单价
var totalPrice = thisEngineeringQuantity * unitPrice; // 总价
detail1Grid.setCellValue(item, 'totalPrice', parseFloat(totalPrice));
console.log(grid.dataSource._data);
console.log(detail1Grid.getDataItems());
var allRows = detail1Grid.getDataItems();
var totalPriceExcluding = 0;
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;
totalPriceIncluding = totalPriceExcluding * (1 + parseFloat(taxPoints));
valueAddedTax = parseFloat(totalPriceIncluding) - parseFloat(totalPriceExcluding);
$("#result-0-totalContractPriceExcluding").val(parseFloat(totalPriceExcluding).toFixed(3))
$("#result-0-totalContractPriceIncluding").val(parseFloat(totalPriceIncluding).toFixed(3))
$("#result-0-valueAddedTax").val(parseFloat(valueAddedTax).toFixed(3))
$("#result-0-totalQuantity").val(parseFloat(deviceNumber).toFixed(3))
// 计算总金额
calculateAmount(detail1Grid.getDataItems());
}
});
setTimeout(function() {
initDate();
}, 1000);
},
beforeAdd :function (e) {
console.log("新增前");
var contractType = $("#contractType").val();
if (contractType == "1") {
} else {
message("劳务合同不可新增!");
e.preventDefault();
}
},
onAdd: function (e) {
var contractNumber = $("#result-0-contractNumber").val();
var settlementNumber = $("#result-0-settlementNumber").val();
$.each(e.items, function (index, item) {
item['contractNumber'] = contractNumber;
item['settlementNumber'] = settlementNumber;
});
var contractType = $("#contractType").val();
if (contractType == "1") {
$.each(e.items, function (index, item) {
item['settlementBasis'] = "罚款";
});
}
},
onSave: function (e) {
// 阻止默认请求,使用自定义保存
e.preventDefault();
let btnNode = $(this);
//禁用按钮
btnNode.attr("disabled", true);
saveResult1Func(btnNode);
saveResult1Func();
calculateAmount(detail1Grid.getDataItems());
},
onDelete: function (e) {
// 阻止默认请求,使用自定义删除
e.preventDefault();
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}}}
......@@ -117,19 +112,9 @@ $(function() {
}
}
IPLATUI.EFPopupInput = {
"popupInputPartyA": {
/**
* EFGrid 查询时触发的事件,通常在此处,设置查询条件
* 注意: 必须返回一个EiInfo,作为初始查询条件
* 配置了query时,默认每次打开窗口都会进行一次查询
*/
query: function (e) {
console.log("Step" + (++i) + ": ----query----");
var info = new EiInfo();
return info;
},
IPLATUI.EFPopupInput = {
"popupInputProjCode": {
/**
* grid中的数据回填时触发的事件
* @param e 回填数据事件
......@@ -141,12 +126,26 @@ $(function() {
console.log("Step" + (++i) + ": ----backFill----");
// 回填数据
var model = e.model;
// var data = model.toJSON();
console.log(model);
var partyA = model.usercode + "-" + model.username;
$("#result-0-partyA").val(partyA);
IPLAT.EFPopupInput.text( $("#popupInputPartyA") , partyA)
e.preventDefault(); // 不使用默认的回填逻辑
var contractNumber = model.contractNumber;
var info = new EiInfo();
info.set("contractNumber", contractNumber);
EiCommunicator.send("HGCW008", "queryCalculateAmount", info, {
onSuccess: function (ei) {
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,106 +159,99 @@ $(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();
function saveResult1Func(btn) {
let rows = detail1Grid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
var info = new EiInfo();
info.addBlock(JSUtils.checkedRows2Block("detail1"));
EiCommunicator.send("HGCW003", "save", info, {
onSuccess: function (ei) {
if (ei.getStatus() >= 0) {
try {
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 {
NotificationUtil(ei, "error");
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);
}
},
onFail: function (ei) {
// 发生异常
NotificationUtil("操作失败,原因[" + ei + "]", "error");
}
});
//释放禁用按钮
btn.attr("disabled", false);
})
}
});
}
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
*/
function uploadFileCallback(data) {
let inEiInfo = new EiInfo();
inEiInfo.set("result-0-matId", data.matId);
inEiInfo.set("result-0-docId", data.docId);
inEiInfo.set("result-0-bizType", data.bizType);
EiCommunicator.send('HGCW999', 'insert', inEiInfo, {
onSuccess(ei) {
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 {
NotificationUtil(ei);
}
} else {
NotificationUtil("执行失败!", "error");
}
},
onFail(errorMessage, status, e) {
NotificationUtil("执行失败!", "error");
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%"})
}
}, {
async: false
});
} else {
message("请先选择合同!");
}
}
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() {
// 关闭弹窗
parent.JSColorbox.setValueCallback();
......@@ -269,30 +261,128 @@ function btnSaveFunc() {
fieldValidation();
JSUtils.confirm("确定对数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGrid("detail1,detail2", "HGCW002", "save", {isAlldata:true,onSuccessCallback:parent.windowCallback});
JSUtils.submitGrid("detail1", "HGCW008", "save", {isAlldata:true,onSuccessCallback:parent.windowCallback});
}
});
}
function queryCumulativeEngineeringQuantity(inventoryId) {
if (inventoryId) {
var info = new EiInfo();
info.set("inventoryId", inventoryId);
EiCommunicator.send("HGCW009", "queryEngineeringQuantity", info, {
onSuccess: function (ei) {
if (ei.getStatus() >= 0) {
return ei.result
} else {
NotificationUtil(ei, "error");
return 0;
}
},
onFail: function (ei) {
// 发生异常
NotificationUtil("操作失败,原因[" + ei + "]", "error");
return 0;
}
});
}
return 0;
}
/**
* 本次结算金额: 明细的本次结算求和
* 累计结算金额: 当前合同的所有结算单本次结算金额求和
* 本次结算税金: 明细的本次结算求和(不含扣款 )*税率
* 累计结算税金:当前合同的所有结算单的“本次结算税金”求和
* 本次价税合计=本次结算金额+本次结算税金
* 累计价税合计=累计结算金额+累计结算税金
* 劳务合同的本次结算税金: 明细的本次结算求和(不含扣款 )*税率
* 销售合同的本次结算税金: 明细的本次结算求和*税率
* @param rows
*/
function calculateAmount(rows) {
var contractType = $("#contractType").val();
var totalPrice = 0;
var deductionPrice= 0;
rows.forEach(function (row, index) {
if (row.settlementBasis == "合同内") {
totalPrice += parseFloat(row.totalPrice);
} else {
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 deleteFileFunc() {
let rows = detail2Grid.getCheckedRows();
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 {
NotificationUtil(ei, "error");
return 0;
}
},
onFail: function (ei) {
// 发生异常
NotificationUtil("操作失败,原因[" + ei + "]", "error");
return 0;
}
});
}
function saveResult1Func(btn) {
let rows = detail1Grid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"删除\"操作? ", {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
var info = new EiInfo();
info.addBlock(JSUtils.checkedRows2Block("detail2"));
EiCommunicator.send("HGCW999", "delete", info, {
info.addBlock(JSUtils.checkedRows2Block("detail1"));
EiCommunicator.send("HGCW009", "save", info, {
onSuccess: function (ei) {
if (ei.getStatus() >= 0) {
try {
NotificationUtil(ei.msg);
NotificationUtil(response.msg);
} catch (e) {
// TODO: handle exception
}
if (IPLAT.isAvailable("detail2")) {
window['detail2Grid'].setEiInfo(ei);
if (IPLAT.isAvailable("detail1")) {
window['detail1Grid'].setEiInfo(ei);
}
if (ei.getStatus() == 0) {
NotificationUtil(ei, 'warning');
......@@ -309,12 +399,10 @@ function deleteFileFunc() {
NotificationUtil("操作失败,原因[" + ei + "]", "error");
}
});
//释放禁用按钮
// btn.attr("disabled", false);
}
});
}
function deleteResult1Func() {
let rows = detail1Grid.getCheckedRows();
if (rows.length < 1) {
......@@ -325,7 +413,7 @@ function deleteResult1Func() {
ok: function () {
var info = new EiInfo();
info.addBlock(JSUtils.checkedRows2Block("detail1"));
EiCommunicator.send("HGCW003", "delete", info, {
EiCommunicator.send("HGCW009", "delete", info, {
onSuccess: function (ei) {
if (ei.getStatus() >= 0) {
try {
......@@ -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 @@
</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