Commit 93a24d61 by liuyang

2024-09-20

1、增加按钮功能,手工增加销售开票数据,等有合同和结算单时进行勾选,模式跟先收款后开票一样
parent af47b985
package com.baosight.hggp.hg.cw.domain; package com.baosight.hggp.hg.cw.domain;
import com.baosight.hggp.util.DateUtils;
import com.baosight.iplat4j.core.util.NumberUtils; import com.baosight.iplat4j.core.util.NumberUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import com.baosight.iplat4j.core.ei.EiColumn; import com.baosight.iplat4j.core.ei.EiColumn;
...@@ -653,7 +654,7 @@ public class HGCW010 extends DaoEPBase { ...@@ -653,7 +654,7 @@ public class HGCW010 extends DaoEPBase {
setBillTybe(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_BILL_TYBE)), billTybe)); setBillTybe(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_BILL_TYBE)), billTybe));
setBillNumber(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_BILL_NUMBER)), billNumber)); setBillNumber(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_BILL_NUMBER)), billNumber));
setBillState(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_BILL_STATE)), billState)); setBillState(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_BILL_STATE)), billState));
setSigningDate(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_SIGNING_DATE)), signingDate)); setSigningDate(StringUtils.defaultIfEmpty(StringUtils.toString(DateUtils.formatShort(map.get(FIELD_SIGNING_DATE))), signingDate));
setPartyA(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PARTY_A)), partyA)); setPartyA(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PARTY_A)), partyA));
setReviewStatus(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_REVIEW_STATUS)), reviewStatus)); setReviewStatus(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_REVIEW_STATUS)), reviewStatus));
setThisSettlementTax(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_THIS_SETTLEMENT_TAX)), thisSettlementTax)); setThisSettlementTax(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_THIS_SETTLEMENT_TAX)), thisSettlementTax));
......
...@@ -50,7 +50,7 @@ public class ServiceHGCW010 extends ServiceBase { ...@@ -50,7 +50,7 @@ public class ServiceHGCW010 extends ServiceBase {
/*CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SUP_RECORD_BLOCK_ID, /*CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SUP_RECORD_BLOCK_ID,
DdynamicEnum.PROJ_RECORD_BLOCK_ID), null, false);*/ DdynamicEnum.PROJ_RECORD_BLOCK_ID), null, false);*/
List<String> roleCompanyCode = HGSBTools.getRoleCompanyCode(); List<String> roleCompanyCode = HGSBTools.getRoleCompanyCode();
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.PROJ_RECORD_BLOCK_ID), CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.PROJ_RECORD_BLOCK_ID,DdynamicEnum.CUSTOMER_RECORD_BLOCK_ID),
new HashMap<String,Object>(){{ new HashMap<String,Object>(){{
put(HGSB001.FIELD_COMPANY_CODES,roleCompanyCode); put(HGSB001.FIELD_COMPANY_CODES,roleCompanyCode);
}} }}
...@@ -92,22 +92,26 @@ public class ServiceHGCW010 extends ServiceBase { ...@@ -92,22 +92,26 @@ public class ServiceHGCW010 extends ServiceBase {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows(); List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 写入数据 // 写入数据
for (int i = 0; i < resultRows.size(); i++) { for (int i = 0; i < resultRows.size(); i++) {
HGCW010 HGCW010 = new HGCW010(); HGCW010 hgcw010 = new HGCW010();
HGCW010.fromMap(resultRows.get(i)); hgcw010.fromMap(resultRows.get(i));
UserVO userVO = HGCWTools.HgCw002.getUserCompany(); if (StringUtils.isEmpty(hgcw010.getCompanyCode())){
HGCW010.setCompanyCode(userVO.getUsercode()); UserVO userVO = HGCWTools.HgCw002.getUserCompany();
HGCW010.setCompanyName(userVO.getUsername()); hgcw010.setCompanyCode(userVO.getUsercode());
HGCW010.setBillState(1); hgcw010.setCompanyName(userVO.getUsername());
HGCW010.setReviewStatus(0); }
HGCW010.setSigningDate(DateUtils.formatShort(HGCW010.getSigningDate())); if (StringUtils.isEmpty(hgcw010.getProjName())){
// 获取项目名称 // 获取项目名称
HGSC001 HGSC001 = HGSCTools.Hgsc001.queryByCode(HGCW010.getProjCode()); HGSC001 HGSC001 = HGSCTools.Hgsc001.queryByCode(hgcw010.getProjCode());
AssertUtils.isNull(HGSC001, "项目编码[" + HGCW010.getProjCode() + "]不存在"); AssertUtils.isNull(HGSC001, "项目编码[" + hgcw010.getProjCode() + "]不存在");
HGCW010.setProjName(HGSC001.getProjName()); hgcw010.setProjName(HGSC001.getProjName());
if (HGCW010.getId() == null || HGCW010.getId() == 0) { }
this.add(HGCW010); hgcw010.setBillState(1);
hgcw010.setReviewStatus(0);
hgcw010.setSigningDate(DateUtils.formatShort(hgcw010.getSigningDate()));
if (hgcw010.getId() == null || hgcw010.getId() == 0) {
this.add(hgcw010);
} else { } else {
this.modify(HGCW010); this.modify(hgcw010);
} }
} }
inInfo = this.query(inInfo); inInfo = this.query(inInfo);
...@@ -122,21 +126,22 @@ public class ServiceHGCW010 extends ServiceBase { ...@@ -122,21 +126,22 @@ public class ServiceHGCW010 extends ServiceBase {
/** /**
* 新增操作 * 新增操作
* *
* @param HGCW010 * @param hgcw010
* @return * @return
*/ */
public void add(HGCW010 HGCW010) { public void add(HGCW010 hgcw010) {
DaoUtils.insert("HGCW010.insert", HGCW010); hgcw010.setRemainingAmount(hgcw010.getTotalContractPriceIncluding());
DaoUtils.insert(HGCW010.INSERT, hgcw010);
} }
/** /**
* 修改操作 * 修改操作
* *
* @param HGCW010 * @param hgcw010
* @return * @return
*/ */
public void modify(HGCW010 HGCW010) { public void modify(HGCW010 hgcw010) {
DaoUtils.update("HGCW010.update", HGCW010); DaoUtils.update(HGCW010.UPDATE, hgcw010);
} }
/** /**
...@@ -155,8 +160,18 @@ public class ServiceHGCW010 extends ServiceBase { ...@@ -155,8 +160,18 @@ public class ServiceHGCW010 extends ServiceBase {
List<HGCW011> hgcw011List = HGCWTools.HgCw011.getMainId(HGCW010.getId()); List<HGCW011> hgcw011List = HGCWTools.HgCw011.getMainId(HGCW010.getId());
if (CollectionUtils.isNotEmpty(hgcw011List)) { if (CollectionUtils.isNotEmpty(hgcw011List)) {
for (HGCW011 hgcw011 : hgcw011List) { for (HGCW011 hgcw011 : hgcw011List) {
HGCWTools.HgCw008.deductionAmount(hgcw011.getSettlementNumber(), HGCW002 hgcw002 = HGCWTools.HgCw002.getContractNumber(hgcw011.getSettlementNumber());
hgcw011.getTotalContractPriceIncluding().multiply(new BigDecimal(-1))); HGCW006 hgcw006 = HGCWTools.HgCw006.getContractNumber(hgcw011.getSettlementNumber());
if (StringUtils.isNotNull(hgcw002)){
HGCWTools.HgCw008.remainingAmount(hgcw011.getSettlementNumber(),
hgcw011.getTotalContractPriceIncluding().multiply(new BigDecimal(-1)));
}else if (StringUtils.isNotNull(hgcw006)){
HGCWTools.HgCw006.deductionAmount(hgcw011.getSettlementNumber(),
hgcw011.getTotalContractPriceIncluding().multiply(new BigDecimal(-1)));
}else {
HGCWTools.HgCw008.deductionAmount(hgcw011.getSettlementNumber(),
hgcw011.getTotalContractPriceIncluding().multiply(new BigDecimal(-1)));
}
DaoUtils.update("HGCW011.delete", hgcw011); DaoUtils.update("HGCW011.delete", hgcw011);
} }
} }
...@@ -213,7 +228,6 @@ public class ServiceHGCW010 extends ServiceBase { ...@@ -213,7 +228,6 @@ public class ServiceHGCW010 extends ServiceBase {
hgcw010.setTaxPoints(hgcw011List.get(0).getTaxPoints()); hgcw010.setTaxPoints(hgcw011List.get(0).getTaxPoints());
hgcw010.setThisSettlementTax(hgcw011List.get(0).getThisSettlementTax()); hgcw010.setThisSettlementTax(hgcw011List.get(0).getThisSettlementTax());
hgcw010.setThisSettlementAmount(hgcw011List.get(0).getThisSettlementAmount()); hgcw010.setThisSettlementAmount(hgcw011List.get(0).getThisSettlementAmount());
hgcw010.setBillNumber(hgcw011List.get(0).getBillNumber());
hgcw010.setSettlementNumber(settlementNumber.toString().substring(0, settlementNumber.length() - 1)); hgcw010.setSettlementNumber(settlementNumber.toString().substring(0, settlementNumber.length() - 1));
hgcw010.setRemainingAmount(new BigDecimal(decimalFormat.format(totalContractPriceIncluding))); hgcw010.setRemainingAmount(new BigDecimal(decimalFormat.format(totalContractPriceIncluding)));
this.add(hgcw010); this.add(hgcw010);
...@@ -229,7 +243,6 @@ public class ServiceHGCW010 extends ServiceBase { ...@@ -229,7 +243,6 @@ public class ServiceHGCW010 extends ServiceBase {
} else { } else {
HGCW010 hgcw010 = HGCWTools.HgCw010.getId(mainId); HGCW010 hgcw010 = HGCWTools.HgCw010.getId(mainId);
Map<String, BigDecimal> rowMap = new HashMap<>(); Map<String, BigDecimal> rowMap = new HashMap<>();
for (Map m : resultRows) { for (Map m : resultRows) {
String c = m.get("settlementNumber").toString(); String c = m.get("settlementNumber").toString();
BigDecimal remainingAmount = new BigDecimal(m.get("thisAmount").toString()); BigDecimal remainingAmount = new BigDecimal(m.get("thisAmount").toString());
...@@ -245,12 +258,15 @@ public class ServiceHGCW010 extends ServiceBase { ...@@ -245,12 +258,15 @@ public class ServiceHGCW010 extends ServiceBase {
List<HGCW011> hgcw011s = HGCWTools.HgCw011.getMainId(hgcw010.getId()); List<HGCW011> hgcw011s = HGCWTools.HgCw011.getMainId(hgcw010.getId());
if (CollectionUtils.isNotEmpty(hgcw011s)) { if (CollectionUtils.isNotEmpty(hgcw011s)) {
// 更新主表 // 更新主表
BigDecimal totalContractPriceIncluding = BigDecimal.ZERO;
StringBuffer settlementNumber = new StringBuffer(); StringBuffer settlementNumber = new StringBuffer();
for (HGCW011 hgcw011 : hgcw011s) { BigDecimal totalContractPriceIncluding = hgcw011s.stream().map(HGCW011::getTotalContractPriceIncluding).reduce(BigDecimal.ZERO,BigDecimal::add);
/*for (HGCW011 hgcw011 : hgcw011s) {
totalContractPriceIncluding = totalContractPriceIncluding.add(hgcw011.getTotalContractPriceIncluding()); totalContractPriceIncluding = totalContractPriceIncluding.add(hgcw011.getTotalContractPriceIncluding());
settlementNumber.append(hgcw011.getSettlementNumber()).append(","); settlementNumber.append(hgcw011.getSettlementNumber()).append(",");
} }*/
hgcw011s.forEach(hpcw004A -> {
settlementNumber.append(hpcw004A.getSettlementNumber()).append(",");
});
hgcw010.setTotalContractPriceIncluding(totalContractPriceIncluding); hgcw010.setTotalContractPriceIncluding(totalContractPriceIncluding);
hgcw010.setPartyA(hgcw011s.get(0).getPartyA()); hgcw010.setPartyA(hgcw011s.get(0).getPartyA());
hgcw010.setProjCode(hgcw011s.get(0).getProjCode()); hgcw010.setProjCode(hgcw011s.get(0).getProjCode());
...@@ -258,7 +274,6 @@ public class ServiceHGCW010 extends ServiceBase { ...@@ -258,7 +274,6 @@ public class ServiceHGCW010 extends ServiceBase {
hgcw010.setTaxPoints(hgcw011List.get(0).getTaxPoints()); hgcw010.setTaxPoints(hgcw011List.get(0).getTaxPoints());
hgcw010.setThisSettlementTax(hgcw011List.get(0).getThisSettlementTax()); hgcw010.setThisSettlementTax(hgcw011List.get(0).getThisSettlementTax());
hgcw010.setThisSettlementAmount(hgcw011List.get(0).getThisSettlementAmount()); hgcw010.setThisSettlementAmount(hgcw011List.get(0).getThisSettlementAmount());
hgcw010.setBillNumber(hgcw011List.get(0).getBillNumber());
hgcw010.setSettlementNumber(settlementNumber.toString().substring(0, settlementNumber.length() - 1)); hgcw010.setSettlementNumber(settlementNumber.toString().substring(0, settlementNumber.length() - 1));
this.modify(hgcw010); this.modify(hgcw010);
...@@ -274,6 +289,7 @@ public class ServiceHGCW010 extends ServiceBase { ...@@ -274,6 +289,7 @@ public class ServiceHGCW010 extends ServiceBase {
} }
public void addHGCW011(HGCW011 HGCW011) { public void addHGCW011(HGCW011 HGCW011) {
HGCW011.setId(null);
DaoUtils.insert("HGCW011.insert", HGCW011); DaoUtils.insert("HGCW011.insert", HGCW011);
} }
......
...@@ -3,6 +3,7 @@ package com.baosight.hggp.hg.cw.service; ...@@ -3,6 +3,7 @@ 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.hg.cw.domain.HGCW010; import com.baosight.hggp.hg.cw.domain.HGCW010;
import com.baosight.hggp.hg.cw.domain.HGCW011;
import com.baosight.hggp.hg.cw.domain.HGCW015; import com.baosight.hggp.hg.cw.domain.HGCW015;
import com.baosight.hggp.util.CommonMethod; import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.EiInfoUtils; import com.baosight.hggp.util.EiInfoUtils;
...@@ -52,8 +53,8 @@ public class ServiceHGCW010B extends ServiceBase { ...@@ -52,8 +53,8 @@ public class ServiceHGCW010B extends ServiceBase {
public EiInfo query(EiInfo inInfo) { public EiInfo query(EiInfo inInfo) {
try { try {
Map map = EiInfoUtils.getFirstRow(inInfo); Map map = EiInfoUtils.getFirstRow(inInfo);
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGCW010.FIELD_ID, map.get("mainId")); //inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGCW011.FIELD_MAIN_ID, map.get("mainId"));
inInfo = super.query(inInfo, HGCW010.QUERY, new HGCW010()); inInfo = super.query(inInfo, HGCW011.QUERY, new HGCW010());
} catch (Exception e) { } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败"); LogUtils.setDetailMsg(inInfo, e, "查询失败");
} }
......
...@@ -115,7 +115,6 @@ public class ServiceHGCW010D extends ServiceEPBase { ...@@ -115,7 +115,6 @@ public class ServiceHGCW010D extends ServiceEPBase {
hgcw010.setTaxPoints(hgcw011List.get(0).getTaxPoints()); hgcw010.setTaxPoints(hgcw011List.get(0).getTaxPoints());
hgcw010.setThisSettlementTax(hgcw011List.get(0).getThisSettlementTax()); hgcw010.setThisSettlementTax(hgcw011List.get(0).getThisSettlementTax());
hgcw010.setThisSettlementAmount(hgcw011List.get(0).getThisSettlementAmount()); hgcw010.setThisSettlementAmount(hgcw011List.get(0).getThisSettlementAmount());
hgcw010.setBillNumber(hgcw011List.get(0).getBillNumber());
hgcw010.setSettlementNumber(settlementNumber.toString().substring(0, settlementNumber.length() - 1)); hgcw010.setSettlementNumber(settlementNumber.toString().substring(0, settlementNumber.length() - 1));
hgcw010.setRemainingAmount(new BigDecimal(decimalFormat.format(totalContractPriceIncluding))); hgcw010.setRemainingAmount(new BigDecimal(decimalFormat.format(totalContractPriceIncluding)));
this.add(hgcw010); this.add(hgcw010);
...@@ -162,7 +161,6 @@ public class ServiceHGCW010D extends ServiceEPBase { ...@@ -162,7 +161,6 @@ public class ServiceHGCW010D extends ServiceEPBase {
hgcw010.setTaxPoints(hgcw011List.get(0).getTaxPoints()); hgcw010.setTaxPoints(hgcw011List.get(0).getTaxPoints());
hgcw010.setThisSettlementTax(hgcw011List.get(0).getThisSettlementTax()); hgcw010.setThisSettlementTax(hgcw011List.get(0).getThisSettlementTax());
hgcw010.setThisSettlementAmount(hgcw011List.get(0).getThisSettlementAmount()); hgcw010.setThisSettlementAmount(hgcw011List.get(0).getThisSettlementAmount());
hgcw010.setBillNumber(hgcw011List.get(0).getBillNumber());
hgcw010.setSettlementNumber(settlementNumber.toString().substring(0, settlementNumber.length() - 1)); hgcw010.setSettlementNumber(settlementNumber.toString().substring(0, settlementNumber.length() - 1));
this.modify(hgcw010); this.modify(hgcw010);
...@@ -185,6 +183,7 @@ public class ServiceHGCW010D extends ServiceEPBase { ...@@ -185,6 +183,7 @@ public class ServiceHGCW010D extends ServiceEPBase {
} }
public void addHGCW011(HGCW011 hgcw011) { public void addHGCW011(HGCW011 hgcw011) {
hgcw011.setId(null);
DaoUtils.insert("HGCW011.insert", hgcw011); DaoUtils.insert("HGCW011.insert", hgcw011);
} }
......
...@@ -114,7 +114,6 @@ public class ServiceHGCW010E extends ServiceEPBase { ...@@ -114,7 +114,6 @@ public class ServiceHGCW010E extends ServiceEPBase {
hgcw010.setTaxPoints(hgcw011List.get(0).getTaxPoints()); hgcw010.setTaxPoints(hgcw011List.get(0).getTaxPoints());
hgcw010.setThisSettlementTax(hgcw011List.get(0).getThisSettlementTax()); hgcw010.setThisSettlementTax(hgcw011List.get(0).getThisSettlementTax());
hgcw010.setThisSettlementAmount(hgcw011List.get(0).getThisSettlementAmount()); hgcw010.setThisSettlementAmount(hgcw011List.get(0).getThisSettlementAmount());
hgcw010.setBillNumber(hgcw011List.get(0).getBillNumber());
hgcw010.setSettlementNumber(settlementNumber.toString().substring(0, settlementNumber.length() - 1)); hgcw010.setSettlementNumber(settlementNumber.toString().substring(0, settlementNumber.length() - 1));
hgcw010.setRemainingAmount(new BigDecimal(decimalFormat.format(totalContractPriceIncluding))); hgcw010.setRemainingAmount(new BigDecimal(decimalFormat.format(totalContractPriceIncluding)));
this.add(hgcw010); this.add(hgcw010);
...@@ -159,7 +158,6 @@ public class ServiceHGCW010E extends ServiceEPBase { ...@@ -159,7 +158,6 @@ public class ServiceHGCW010E extends ServiceEPBase {
hgcw010.setTaxPoints(hgcw011List.get(0).getTaxPoints()); hgcw010.setTaxPoints(hgcw011List.get(0).getTaxPoints());
hgcw010.setThisSettlementTax(hgcw011List.get(0).getThisSettlementTax()); hgcw010.setThisSettlementTax(hgcw011List.get(0).getThisSettlementTax());
hgcw010.setThisSettlementAmount(hgcw011List.get(0).getThisSettlementAmount()); hgcw010.setThisSettlementAmount(hgcw011List.get(0).getThisSettlementAmount());
hgcw010.setBillNumber(hgcw011List.get(0).getBillNumber());
hgcw010.setSettlementNumber(settlementNumber.toString().substring(0, settlementNumber.length() - 1)); hgcw010.setSettlementNumber(settlementNumber.toString().substring(0, settlementNumber.length() - 1));
this.modify(hgcw010); this.modify(hgcw010);
...@@ -182,6 +180,7 @@ public class ServiceHGCW010E extends ServiceEPBase { ...@@ -182,6 +180,7 @@ public class ServiceHGCW010E extends ServiceEPBase {
} }
public void addHGCW011(HGCW011 hgcw011) { public void addHGCW011(HGCW011 hgcw011) {
hgcw011.setId(null);
DaoUtils.insert("HGCW011.insert", hgcw011); DaoUtils.insert("HGCW011.insert", hgcw011);
} }
......
...@@ -382,6 +382,14 @@ public class HGCWTools { ...@@ -382,6 +382,14 @@ public class HGCWTools {
return results.get(0); return results.get(0);
} }
public static HGCW006 getContractNumber(String contractNumber) {
AssertUtils.isNull(contractNumber, "合同号不能为空!");
List<HGCW006> results = DaoBase.getInstance().query(HGCW006.QUERY,new HashMap<String,Object>(){
{put("contractNumber",contractNumber);}
});
return CollectionUtils.isEmpty(results)? null :results.get(0);
}
public static void deductionAmount(String settlementNumber, BigDecimal deductionAmount) { public static void deductionAmount(String settlementNumber, BigDecimal deductionAmount) {
AssertUtils.isNull(settlementNumber, "来源单号不能为空!"); AssertUtils.isNull(settlementNumber, "来源单号不能为空!");
// if (deductionAmount.compareTo(new BigDecimal(BigInteger.ZERO)) <= 0) { // if (deductionAmount.compareTo(new BigDecimal(BigInteger.ZERO)) <= 0) {
...@@ -558,14 +566,14 @@ public class HGCWTools { ...@@ -558,14 +566,14 @@ public class HGCWTools {
new HashMap<String,Object>(){{ new HashMap<String,Object>(){{
put("contractNumber",contractNumber); put("contractNumber",contractNumber);
}}); }});
List<HGCW010> hgcw011List = DaoBase.getInstance().query(HGCW011.QUERY, List<HGCW011> hgcw011List = DaoBase.getInstance().query(HGCW011.QUERY,
new HashMap<String,Object>(){{ new HashMap<String,Object>(){{
put("settlementNumber",contractNumber); put("settlementNumber",contractNumber);
}}); }});
//获取项目结算单累计开票金额 //获取项目结算单累计开票金额
BigDecimal totalAmount08 = cw008List.stream().map(HGCW008::getThisPriceTax).reduce(BigDecimal.ZERO,BigDecimal::add); BigDecimal totalAmount08 = cw008List.stream().map(HGCW008::getThisPriceTax).reduce(BigDecimal.ZERO,BigDecimal::add);
//获取销售开票累计开票金额 //获取销售开票累计开票金额
BigDecimal totalAmount11 = hgcw011List.stream().map(HGCW010::getTotalContractPriceIncluding).reduce(BigDecimal.ZERO,BigDecimal::add); BigDecimal totalAmount11 =hgcw011List.size() == 0 ? BigDecimal.ZERO : hgcw011List.stream().map(HGCW011::getTotalContractPriceIncluding).reduce(BigDecimal.ZERO,BigDecimal::add);
DecimalFormat decimalFormat = new DecimalFormat("#.000"); DecimalFormat decimalFormat = new DecimalFormat("#.000");
//合同总金额-(累计开票金额+本次来票金额) //合同总金额-(累计开票金额+本次来票金额)
......
$(function() { $(function() {
var roleCompany = __eiInfo.getBlock("roleCompany").getMappedRows();
var projRecordBox = __eiInfo.getBlock("proj_record_block_id").getMappedRows();
var customerRecordBox = __eiInfo.getBlock("customer_record_block_id").getMappedRows();
// 查询 // 查询
$("#QUERY").on("click", function () { $("#QUERY").on("click", function () {
query(); query();
...@@ -12,28 +16,47 @@ $(function() { ...@@ -12,28 +16,47 @@ $(function() {
pageSize: 20, pageSize: 20,
pageSizes: [10,20,30,50,100,200], pageSizes: [10,20,30,50,100,200],
}, },
columns: [{ columns: [
field: "operator", {
template: function (item) { field: "operator",
let template = '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' template: function (item) {
+ 'onclick="contractDetailFunc(' + item.id + ')">开票清单</a>'; let template = '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' + 'onclick="contractDetailFunc(' + item.id + ')">开票清单</a>';
+ 'onclick="fileDetailFunc(' + item.id + ')">附件详情</a>'; template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
return template; + 'onclick="fileDetailFunc(' + item.id + ')">附件详情</a>';
return template;
}
},
{
field: "projCode",
filter:function (option) {
let companyCode = option.model["companyCode"];
if (companyCode){
return _.filter(projRecordBox, function (item) {
return item["param1Field"] == companyCode;
})
}
return option.values;
}
},
{
field: "signingDate",
defaultValue: function () {
return currShortDate();
}
} }
}
], ],
loadComplete: function (grid) { loadComplete: function (grid) {
//此grid对象 //此grid对象
$("#SELECT_BILL").on("click",addFunc); $("#SELECT_BILL").on("click",addFunc); //结算单
$("#SELECT_CONT").on("click",add1Func); $("#SELECT_CONT").on("click",add1Func); //合同
$("#SELECT_LEASE").on("click",add2Func); $("#SELECT_LEASE").on("click",add2Func); //租赁合同
$("#SUBMIT").on("click",submitFunc); $("#SUBMIT").on("click",submitFunc); //审核
$("#BTN_BILL").on("click",billFunc); $("#BTN_BILL").on("click",billFunc);
$("#BII_SAVE").on("click",saveFunc); $("#BII_SAVE").on("click",saveFunc);
grid.dataSource.bind("change",function(e){ grid.dataSource.bind("change",function(e){
var item = e.items[0]; var item = e.items[0];
if(e.field == "taxPoints"){ if(e.field === "taxPoints"){
if(item.thisSettlementTax && item.totalContractPriceIncluding){ if(item.thisSettlementTax && item.totalContractPriceIncluding){
let thisSettlementAmount = item.totalContractPriceIncluding / (item.taxPoints / 100 + 1); let thisSettlementAmount = item.totalContractPriceIncluding / (item.taxPoints / 100 + 1);
...@@ -49,10 +72,62 @@ $(function() { ...@@ -49,10 +72,62 @@ $(function() {
} }
loadChange(grid,e,"price"); loadChange(grid,e,"price");
} }
if(e.field === "totalContractPriceIncluding"){
if(item.taxPoints && item.totalContractPriceIncluding){
// 不含税金额
let thisSettlementAmount = item.totalContractPriceIncluding / (item.taxPoints / 100 + 1);
// 税额
let thisSettlementTax = item.totalContractPriceIncluding-thisSettlementAmount;
// 使用toFixed方法四舍五入到两位小数,并转换为数字
thisSettlementAmount = Number(thisSettlementAmount.toFixed(2));
resultGrid.setCellValue(item,'thisSettlementAmount',thisSettlementAmount)
thisSettlementTax = Number(thisSettlementTax.toFixed(2));
resultGrid.setCellValue(item,'thisSettlementTax',thisSettlementTax)
}
} }
if (e.field === "partyA"){
let partyA = item.partyA;
for(let i=0;i < customerRecordBox.length;i++){
if(partyA == customerRecordBox[i]["valueField"]){
resultGrid.setCellValue(item,'partyA',partyA+"-"+customerRecordBox[i]["textField"])
break;
}
}
loadChange(grid,e,"billNumber");
}
if (e.field === "projCode"){
let projCode = item.projCode;
let companyCode = item.companyCode;
for(let i=0;i < projRecordBox.length;i++){
if(projCode == projRecordBox[i]["valueField"]){
resultGrid.setCellValue(item,'projName',projRecordBox[i]["textField"])
if (isBlank(companyCode)){
resultGrid.setCellValue(item,'companyCode',projRecordBox[i]["param1Field"]);
resultGrid.setCellValue(item,'companyName',projRecordBox[i]["param2Field"]);
}
break;
}
}
loadChange(grid,e,"partyA");
}
if (e.field === "companyCode"){
for (let i = 0; i < roleCompany.length; i++) {
if (roleCompany[i]["companyCode"] === item["companyCode"]){
resultGrid.setCellValue(item,'companyName',roleCompany[i]["companyName"]);
break;
}
}
loadChange(grid,e,"projCode");
}
})
) },
onSave : function (e) {
e.preventDefault();
let btnNode = $(this);
//禁用按钮
btnNode.attr("disabled", true);
saveFunc(btnNode);
}, },
onSuccess: function (e) { onSuccess: function (e) {
if (e.eiInfo.extAttr.methodName == 'save' || e.eiInfo.extAttr.methodName == 'delete') { if (e.eiInfo.extAttr.methodName == 'save' || e.eiInfo.extAttr.methodName == 'delete') {
...@@ -88,8 +163,18 @@ let query = function () { ...@@ -88,8 +163,18 @@ let query = function () {
* 结算单选择 * 结算单选择
*/ */
function addFunc() { function addFunc() {
let rows = resultGrid.getCheckedRows();
if (rows.length == 1 || rows.length == 0) {
var mainId = "";
if (rows.length == 1) {
mainId = rows[0].id;
}
}else {
message("请选择一条数据或不选择数据");
return;
}
JSColorbox.open({ JSColorbox.open({
href: "HGCW010A?methodName=initLoad&efParentFormEname=HGCW010", href: "HGCW010A?methodName=initLoad&inqu_status-0-mainId=" + mainId +"&efParentFormEname=HGCW010",
title: "<div style='text-align: center;'>结算单</div>", title: "<div style='text-align: center;'>结算单</div>",
width: "90%", width: "90%",
height: "90%", height: "90%",
...@@ -97,8 +182,26 @@ function addFunc() { ...@@ -97,8 +182,26 @@ function addFunc() {
}); });
} }
function add1Func() { function add1Func() {
let rows = resultGrid.getCheckedRows();
if (rows.length == 1 || rows.length == 0) {
var mainId = "";
if (rows.length == 1) {
mainId = rows[0].id;
}
if (rows[0].reviewStatus == "1"){
message("数据已审核,无法选择");
return;
}
if (rows[0].billState == "2"){
message("数据已开票,无法选择");
return;
}
}else {
message("请选择一条数据或不选择数据");
return;
}
JSColorbox.open({ JSColorbox.open({
href: "HGCW010D?methodName=initLoad&efParentFormEname=HGCW010", href: "HGCW010D?methodName=initLoad&inqu_status-0-mainId=" + mainId +"&efParentFormEname=HGCW010",
title: "<div style='text-align: center;'>合同管理</div>", title: "<div style='text-align: center;'>合同管理</div>",
width: "90%", width: "90%",
height: "90%", height: "90%",
...@@ -106,8 +209,18 @@ function add1Func() { ...@@ -106,8 +209,18 @@ function add1Func() {
}); });
} }
function add2Func() { function add2Func() {
let rows = resultGrid.getCheckedRows();
if (rows.length == 1 || rows.length == 0) {
var mainId = "";
if (rows.length == 1) {
mainId = rows[0].id;
}
}else {
message("请选择一条数据或不选择数据");
return;
}
JSColorbox.open({ JSColorbox.open({
href: "HGCW010E?methodName=initLoad&efParentFormEname=HGCW010", href: "HGCW010E?methodName=initLoad&inqu_status-0-mainId=" + mainId +"&efParentFormEname=HGCW010",
title: "<div style='text-align: center;'>租赁合同</div>", title: "<div style='text-align: center;'>租赁合同</div>",
width: "90%", width: "90%",
height: "90%", height: "90%",
...@@ -127,8 +240,28 @@ function saveFunc() { ...@@ -127,8 +240,28 @@ function saveFunc() {
let flag = true; let flag = true;
$.each(rows, function(index, item) { $.each(rows, function(index, item) {
let reviewStatus= item.get("reviewStatus"); let reviewStatus= item.get("reviewStatus");
if((reviewStatus === "1")){ if(isBlank(item.get("companyCode"))){
message("数据已审核,无法修改"); message("选中的第"+(index+1)+"行\"开票总额\",不能为空!");
flag = false;
return false;
}
if(isBlank(item.get("projCode"))){
message("选中的第"+(index+1)+"行\"项目名称\",不能为空!");
flag = false;
return false;
}
if(isBlank(item.get("partyA"))){
message("选中的第"+(index+1)+"行\"客户名称\",不能为空!");
flag = false;
return false;
}
if(reviewStatus === "1"){
message("选中的第"+(index+1)+"行已审核,无法保存!");
flag = false;
return false;
}
if(isBlank(item.get("totalContractPriceIncluding")) && !isNumber(item.get("totalContractPriceIncluding"))){
message("选中的第"+(index+1)+"行开票总额,不能小于0!");
flag = false; flag = false;
return false; return false;
} }
...@@ -136,7 +269,10 @@ function saveFunc() { ...@@ -136,7 +269,10 @@ function saveFunc() {
if(flag) { if(flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", { JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () { ok: function () {
var info = new EiInfo(); JSUtils.submitGrid("result", "HGCW010", "save", {isAlldata:false,onSuccessCallback:function () {
query();
}})
/*var info = new EiInfo();
info.addBlock(JSUtils.checkedRows2Block("result")); info.addBlock(JSUtils.checkedRows2Block("result"));
EiCommunicator.send("HGCW010", "save", info, { EiCommunicator.send("HGCW010", "save", info, {
onSuccess: function (ei) { onSuccess: function (ei) {
...@@ -159,8 +295,7 @@ function saveFunc() { ...@@ -159,8 +295,7 @@ function saveFunc() {
// 发生异常 // 发生异常
NotificationUtil("操作失败,原因[" + ei + "]", "error"); NotificationUtil("操作失败,原因[" + ei + "]", "error");
} }
}); });*/
//JSUtils.submitGridsData("result", "HPSC001", "save", true);
} }
}); });
...@@ -210,18 +345,29 @@ function submitFunc() { ...@@ -210,18 +345,29 @@ function submitFunc() {
return; return;
} }
var flag = true; var flag = true;
rows.forEach(function (row) { rows.forEach(function (row, index) {
if (isBlank(row.id)) {
message("选中的第"+(index+1)+"行\"未保存数据\",无法审核!");
flag = false;
}
if (isBlank(row.settlementNumber)) {
message("选中的第"+(index+1)+"行\"来源单号\",不能为空!");
flag = false;
}
if (row.reviewStatus == "3") { if (row.reviewStatus == "3") {
message("勾选的数据中有已经审核的票据!"); message("选中的第"+(index+1)+"行已经审核的票据!");
flag = false; flag = false;
} }
} })
)
if (flag) { if (flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"审核\"操作? ", { JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"审核\"操作? ", {
ok: function () { ok: function () {
var info = new EiInfo(); JSUtils.submitGrid("result", "HGCW010", "submit",
{isAlldata:false,onSuccessCallback:function () {
query();
}})
/*var info = new EiInfo();
info.addBlock(JSUtils.checkedRows2Block("result")); info.addBlock(JSUtils.checkedRows2Block("result"));
EiCommunicator.send("HGCW010", "submit", info, { EiCommunicator.send("HGCW010", "submit", info, {
onSuccess: function (ei) { onSuccess: function (ei) {
...@@ -245,7 +391,7 @@ function submitFunc() { ...@@ -245,7 +391,7 @@ function submitFunc() {
NotificationUtil("操作失败,原因[" + ei + "]", "error"); NotificationUtil("操作失败,原因[" + ei + "]", "error");
}, },
}); });*/
} }
}); });
...@@ -259,22 +405,32 @@ function billFunc() { ...@@ -259,22 +405,32 @@ function billFunc() {
return; return;
} }
var flag = true; var flag = true;
rows.forEach(function (row) { rows.forEach(function (row, index) {
if (row.billState == "2") { if (isBlank(row.id)) {
message("勾选的数据中有已经开票的票据!"); message("选中的第"+(index+1)+"行\"未保存数据\",无法开票!");
flag = false; flag = false;
} }
if (isBlank(row.settlementNumber)) {
message("选中的第"+(index+1)+"行\"来源单号\",不能为空!");
flag = false;
}
if (row.billState == "2") {
message("勾选的数据中有已经开票的票据!");
flag = false;
}
if (row.billNumber == " ") { if (row.billNumber == " ") {
message("勾选的数据中发票号为空"); message("勾选的数据中发票号为空");
flag = false; flag = false;
} }
} })
)
if (flag) { if (flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"开票\"操作? ", { JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"开票\"操作? ", {
ok: function () { ok: function () {
var info = new EiInfo(); JSUtils.submitGrid("result", "HGCW010", "billing", {isAlldata:false,onSuccessCallback:function (){
query();
}})
/*var info = new EiInfo();
info.addBlock(JSUtils.checkedRows2Block("result")); info.addBlock(JSUtils.checkedRows2Block("result"));
EiCommunicator.send("HGCW010", "billing", info, { EiCommunicator.send("HGCW010", "billing", info, {
onSuccess: function (ei) { onSuccess: function (ei) {
...@@ -298,7 +454,7 @@ function billFunc() { ...@@ -298,7 +454,7 @@ function billFunc() {
NotificationUtil("操作失败,原因[" + ei + "]", "error"); NotificationUtil("操作失败,原因[" + ei + "]", "error");
}, },
}); });*/
} }
}); });
......
...@@ -51,38 +51,50 @@ ...@@ -51,38 +51,50 @@
align="center" filter="contains" sort="true"> align="center" filter="contains" sort="true">
<EF:EFOptions blockId="roleCompany" textField="companyName" valueField="companyCode"/> <EF:EFOptions blockId="roleCompany" textField="companyName" valueField="companyCode"/>
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="partyA" cname="客户名称" width="200" enable="false" readonly="true" align="center"/> <EF:EFColumn ename="companyName" cname="公司名称" hidden="true"/>
<EF:EFColumn ename="projName" cname="项目名称" width="200" enable="false" readonly="true" align="center"/> <EF:EFComboColumn ename="projCode" cname="项目名称" blockName="proj_record_block_id"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" readonly="true" width="210" required="true"
align="center" filter="contains" sort="true">
</EF:EFComboColumn>
<EF:EFColumn ename="projName" cname="公司名称" hidden="true"/>
<EF:EFComboColumn ename="partyA" cname="客户名称" blockName="customer_record_block_id"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" readonly="true" width="210" required="true"
align="center" filter="contains" sort="true">
</EF:EFComboColumn>
<EF:EFColumn ename="settlementNumber" cname="来源单号" width="140" enable="false" readonly="true" align="center"/> <EF:EFColumn ename="settlementNumber" cname="来源单号" width="140" enable="false" readonly="true" align="center"/>
<EF:EFComboColumn ename="billTybe" cname="票据类型" width="120" align="center" required="true" <EF:EFComboColumn ename="billTybe" cname="票据类型" width="120" align="center" required="true"
columnTemplate="#=textField#" itemTemplate="#=textField#" enable="true" > columnTemplate="#=textField#" itemTemplate="#=textField#" enable="true" defaultValue="1">
<EF:EFCodeOption codeName="hggp.cw.billTybe"/> <EF:EFCodeOption codeName="hggp.cw.billTybe"/>
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="signingDate" cname="开票日期" width="120" enable="false" readonly="true" align="center" <EF:EFColumn ename="signingDate" cname="开票日期" width="120" enable="true" readonly="true" align="center"
editType="date" parseFormats="['yyyyMMdd']" parseFormat="yyyy-MM-dd"/> editType="date" parseFormats="['yyyyMMdd']" parseFormat="yyyy-MM-dd"/>
<EF:EFColumn ename="billNumber" cname="发票号" width="120" align="center"/> <EF:EFColumn ename="billNumber" cname="发票号" width="120" align="center"/>
<EF:EFComboColumn ename="taxPoints" cname="税率" width="80" align="center" required="true" <EF:EFComboColumn ename="taxPoints" cname="税率" width="80" align="center" required="true"
columnTemplate="#=textField#" itemTemplate="#=textField#" enable="true" > columnTemplate="#=textField#" itemTemplate="#=textField#" enable="true" defaultValue="13">
<EF:EFCodeOption codeName="hggp.cw.taxPoints"/> <EF:EFCodeOption codeName="hggp.cw.taxPoints"/>
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="thisSettlementAmount" cname="不含税金额" width="120" enable="false" readonly="true" format="{0:C2}" editType="text" <EF:EFColumn ename="totalContractPriceIncluding" cname="开票总额" width="120" enable="true" readonly="true" format="{0:C2}" editType="text"
displayType="0.000" sort="true" align="right" maxLength="15" required="false" displayType="0.000" sort="true" align="right" maxLength="15" required="true"
data-regex="/^-?[0-9]{1,15}([.][0-9]{1,2})?$/" data-regex="/^-?[0-9]{1,15}([.][0-9]{1,2})?$/"
data-errorprompt="请输入数字,该值最大可设置15位整数和2位小数!"/> data-errorprompt="请输入数字,该值最大可设置15位整数和2位小数!"/>
<EF:EFColumn ename="thisSettlementTax" cname="税额" width="120" enable="false" readonly="true" format="{0:C2}" editType="text" <EF:EFColumn ename="thisSettlementAmount" cname="不含税金额" width="120" enable="false" readonly="true" format="{0:C2}" editType="text"
displayType="0.000" sort="true" align="right" maxLength="15" required="false" displayType="0.000" sort="true" align="right" maxLength="15" required="false"
data-regex="/^-?[0-9]{1,15}([.][0-9]{1,2})?$/" data-regex="/^-?[0-9]{1,15}([.][0-9]{1,2})?$/"
data-errorprompt="请输入数字,该值最大可设置15位整数和2位小数!"/> data-errorprompt="请输入数字,该值最大可设置15位整数和2位小数!"/>
<EF:EFColumn ename="totalContractPriceIncluding" cname="开票总额" width="120" enable="false" readonly="true" format="{0:C2}" editType="text" <EF:EFColumn ename="thisSettlementTax" cname="税额" width="120" enable="false" readonly="true" format="{0:C2}" editType="text"
displayType="0.000" sort="true" align="right" maxLength="15" required="false" displayType="0.000" sort="true" align="right" maxLength="15" required="false"
data-regex="/^-?[0-9]{1,15}([.][0-9]{1,2})?$/" data-regex="/^-?[0-9]{1,15}([.][0-9]{1,2})?$/"
data-errorprompt="请输入数字,该值最大可设置15位整数和2位小数!"/> data-errorprompt="请输入数字,该值最大可设置15位整数和2位小数!"/>
<EF:EFComboColumn ename="billState" cname="开票状态" width="100" align="center" required="true" <EF:EFComboColumn ename="billState" cname="开票状态" width="100" align="center" required="true"
columnTemplate="#=textField#" itemTemplate="#=textField#" enable="false" > columnTemplate="#=textField#" itemTemplate="#=textField#" enable="false" defaultValue="1">
<EF:EFCodeOption codeName="hggp.cw.billState"/> <EF:EFCodeOption codeName="hggp.cw.billState"/>
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFComboColumn ename="reviewStatus" cname="审批状态" width="100" align="center" required="true" <EF:EFComboColumn ename="reviewStatus" cname="审批状态" width="100" align="center" required="true"
columnTemplate="#=textField#" itemTemplate="#=textField#" enable="false" > columnTemplate="#=textField#" itemTemplate="#=textField#" enable="false" defaultValue="0">
<EF:EFCodeOption codeName="hggp.cw.reviewStatus"/> <EF:EFCodeOption codeName="hggp.cw.reviewStatus"/>
</EF:EFComboColumn> </EF:EFComboColumn>
</EF:EFGrid> </EF:EFGrid>
......
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