Commit 18591263 by 江和松

Merge remote-tracking branch 'origin/dev' into dev

parents 5d3037e5 47381568
......@@ -4,7 +4,6 @@ import com.baosight.eplat.utils.StringUtils;
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.cw.domain.HGCW010;
import com.baosight.hggp.hg.cw.domain.HGCW012;
import com.baosight.hggp.hg.cw.domain.HGCW013;
import com.baosight.hggp.hg.cw.tools.HGCWTools;
......@@ -23,6 +22,7 @@ import org.apache.commons.collections.CollectionUtils;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -151,14 +151,12 @@ public class ServiceHGCW012 extends ServiceBase {
@OperationLogAnnotation(operModul = "采购收票",operType = "插入",operDesc = "生成采购收票")
public EiInfo select(EiInfo inInfo) {
try {
Map queryRows = EiInfoUtils.getFirstRow(inInfo);
String typeBlockId = queryRows.get("type").toString();
List<Map> resultRows = inInfo.getBlock(typeBlockId).getRows();
List<Map> resultRows = inInfo.getBlock("resultA").getRows();
List<Map> queryRows = inInfo.getBlock(EiConstant.queryBlock).getRows();
String mainId = "";
if (queryRows.get("mainId")!=null){
mainId = queryRows.get("mainId").toString();
if (CollectionUtils.isNotEmpty(queryRows)) {
mainId = queryRows.get(0).get("mainId").toString();
}
Integer contractType = getContractTypeStr(queryRows.get("type").toString());
//获取相应的数据
List<HGCW013> hgcw013List = HGCWTools.HgCw013.mapToList(resultRows, NumberUtils.toLong(mainId));
DecimalFormat decimalFormat = new DecimalFormat("#.000");
......@@ -166,53 +164,269 @@ public class ServiceHGCW012 extends ServiceBase {
if (StringUtils.isEmpty(mainId)) {
//先生成主表
HGCW012 hgcw012 = new HGCW012();
hgcw012.fromMap(resultRows.get(0));
UserVO userVO = HGCWTools.HgCw002.getUserCompany();
hgcw012.setCompanyCode(userVO.getUsercode());
hgcw012.setCompanyName(userVO.getUsername());
hgcw012.setReviewStatus(0);
hgcw012.setBillState(1);
hgcw012.setSigningDate(DateUtils.shortDate());
hgcw012.setReceiveDate(DateUtils.shortDate());
BigDecimal totalContractPriceIncluding = BigDecimal.ZERO;
StringBuffer contractNumber = new StringBuffer();
StringBuffer settlementNumber = new StringBuffer();
Map<String, BigDecimal> rowMap = new HashMap<>();
for (HGCW013 hgcw013 : hgcw013List) {
totalContractPriceIncluding = totalContractPriceIncluding.add(hgcw013.getTotalContractPriceIncluding());
settlementNumber.append(hgcw013.getSettlementNumber()).append(",");
}
for (Map m : resultRows) {
String c = m.get("settlementNumber").toString();
BigDecimal remainingAmount = new BigDecimal(m.get("thisAmount").toString());
rowMap.put(c, remainingAmount);
totalContractPriceIncluding = totalContractPriceIncluding.add(remainingAmount);
}
hgcw012.setTotalContractPriceIncluding(new BigDecimal(decimalFormat.format(totalContractPriceIncluding)));
hgcw012.setContractType(contractType);
hgcw012.setPartyA(hgcw013List.get(0).getPartyA());
hgcw012.setTaxPoints(hgcw013List.get(0).getTaxPoints());
hgcw012.setThisSettlementTax(hgcw013List.get(0).getThisSettlementTax());
hgcw012.setThisSettlementAmount(hgcw013List.get(0).getThisSettlementAmount());
hgcw012.setBillNumber(hgcw013List.get(0).getBillNumber());
hgcw012.setSettlementNumber(settlementNumber.toString().substring(0, settlementNumber.length() - 1));
hgcw012.setRemainingAmount(new BigDecimal(decimalFormat.format(totalContractPriceIncluding)));
this.add(hgcw012);
//生成明细表
for (HGCW013 hgcw013 : hgcw013List) {
hgcw013.setMainId(hgcw012.getId());
hgcw013.setId(null);
// 反写金额
HGCWTools.HgCw008.deductionAmount(hgcw013.getSettlementNumber(),rowMap.get(hgcw013.getSettlementNumber()));
DaoUtils.insert(HGCW013.INSERT, hgcw013);
}
} else {
HGCW012 hgcw012 = HGCWTools.HgCw012.getId(mainId);
Map<String, BigDecimal> rowMap = new HashMap<>();
for (Map m : resultRows) {
String c = m.get("settlementNumber").toString();
BigDecimal remainingAmount = new BigDecimal(m.get("thisAmount").toString());
rowMap.put(c, remainingAmount);
}
// 生成明细表
for (HGCW013 hgcw013 : hgcw013List) {
hgcw013.setMainId(hgcw012.getId());
// 反写金额
HGCWTools.HgCw008.deductionAmount(hgcw013.getSettlementNumber(),rowMap.get(hgcw013.getSettlementNumber()));
this.addHGCW013(hgcw013);
}
List<HGCW013> hgcw013s = HGCWTools.HgCw013.getMainId(hgcw012.getId());
if (CollectionUtils.isNotEmpty(hgcw013s)) {
// 更新主表
HGCW012 HGCW012 = HGCWTools.HgCw012.getId(mainId);
BigDecimal totalContractPriceIncluding = BigDecimal.ZERO;
StringBuffer contractNumber = new StringBuffer();
for (HGCW013 hgcw013 : hgcw013List) {
StringBuffer settlementNumber = new StringBuffer();
for (HGCW013 hgcw013 : hgcw013s) {
totalContractPriceIncluding = totalContractPriceIncluding.add(hgcw013.getTotalContractPriceIncluding());
settlementNumber.append(hgcw013.getSettlementNumber()).append(",");
}
hgcw012.setTotalContractPriceIncluding(totalContractPriceIncluding);
hgcw012.setPartyA(hgcw013s.get(0).getPartyA());
hgcw012.setTaxPoints(hgcw013List.get(0).getTaxPoints());
hgcw012.setThisSettlementTax(hgcw013List.get(0).getThisSettlementTax());
hgcw012.setThisSettlementAmount(hgcw013List.get(0).getThisSettlementAmount());
hgcw012.setBillNumber(hgcw013List.get(0).getBillNumber());
hgcw012.setSettlementNumber(settlementNumber.toString().substring(0, settlementNumber.length() - 1));
this.modify(hgcw012);
}
HGCW012.setTotalContractPriceIncluding(new BigDecimal(decimalFormat.format(totalContractPriceIncluding)));
}inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据生成成功!");
}
}
this.modify(HGCW012);
catch (Exception e) {
LogUtils.setMsg(inInfo, e, "生成收款单失败");
}
return inInfo;
}
public EiInfo selecta(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock("result").getRows();
List<Map> queryRows = inInfo.getBlock(EiConstant.queryBlock).getRows();
String mainId = "";
if (CollectionUtils.isNotEmpty(queryRows)) {
mainId = queryRows.get(0).get("mainId").toString();
}
//获取相应的数据
List<HGCW013> hgcw013List = HGCWTools.HgCw013.mapToeList(resultRows, NumberUtils.toLong(mainId));
DecimalFormat decimalFormat = new DecimalFormat("#.000");
if (CollectionUtils.isNotEmpty(hgcw013List)) {
if (StringUtils.isEmpty(mainId)) {
//先生成主表
HGCW012 hgcw012 = new HGCW012();
UserVO userVO = HGCWTools.HgCw002.getUserCompany();
hgcw012.setCompanyCode(userVO.getUsercode());
hgcw012.setCompanyName(userVO.getUsername());
hgcw012.setReviewStatus(0);
hgcw012.setBillState(1);
hgcw012.setSigningDate(DateUtils.shortDate());
BigDecimal totalContractPriceIncluding = BigDecimal.ZERO;
StringBuffer settlementNumber = new StringBuffer();
Map<String, BigDecimal> rowMap = new HashMap<>();
for (HGCW013 hgcw013 : hgcw013List) {
settlementNumber.append(hgcw013.getSettlementNumber()).append(",");
}
for (Map m : resultRows) {
String c = m.get("receiveNo").toString();
BigDecimal remainingAmount = new BigDecimal(m.get("thisSettlementAmount").toString());
rowMap.put(c, remainingAmount);
totalContractPriceIncluding = totalContractPriceIncluding.add(remainingAmount);
}
hgcw012.setTotalContractPriceIncluding(new BigDecimal(decimalFormat.format(totalContractPriceIncluding)));
hgcw012.setPartyA(hgcw013List.get(0).getPartyA());
hgcw012.setTaxPoints(hgcw013List.get(0).getTaxPoints());
hgcw012.setThisSettlementTax(hgcw013List.get(0).getThisSettlementTax());
hgcw012.setThisSettlementAmount(hgcw013List.get(0).getThisSettlementAmount());
hgcw012.setSettlementNumber(settlementNumber.toString().substring(0, settlementNumber.length() - 1));
hgcw012.setRemainingAmount(new BigDecimal(decimalFormat.format(totalContractPriceIncluding)));
this.add(hgcw012);
//生成明细表
for (HGCW013 hgcw013 : hgcw013List) {
hgcw013.setMainId(hgcw012.getId());
hgcw013.setId(null);
}
} else {
HGCW012 hgcw012 = HGCWTools.HgCw012.getId(mainId);
Map<String, BigDecimal> rowMap = new HashMap<>();
for (Map m : resultRows) {
String c = m.get("receiveNo").toString();
BigDecimal remainingAmount = new BigDecimal(m.get("thisSettlementAmount").toString());
rowMap.put(c, remainingAmount);
}
// 生成明细表
for (HGCW013 hgcw013 : hgcw013List) {
hgcw013.setMainId(HGCW012.getId());
DaoUtils.insert(HGCW013.INSERT, hgcw013);
hgcw013.setMainId(hgcw012.getId());
}
List<HGCW013> hgcw013s = HGCWTools.HgCw013.getMainId(hgcw012.getId());
if (CollectionUtils.isNotEmpty(hgcw013s)) {
// 更新主表
BigDecimal totalContractPriceIncluding = BigDecimal.ZERO;
StringBuffer settlementNumber = new StringBuffer();
for (HGCW013 hgcw013 : hgcw013s) {
totalContractPriceIncluding = totalContractPriceIncluding.add(hgcw013.getTotalContractPriceIncluding());
settlementNumber.append(hgcw013.getSettlementNumber()).append(",");
}
hgcw012.setTotalContractPriceIncluding(totalContractPriceIncluding);
hgcw012.setPartyA(hgcw013s.get(0).getPartyA());
hgcw012.setTaxPoints(hgcw013List.get(0).getTaxPoints());
hgcw012.setThisSettlementTax(hgcw013List.get(0).getThisSettlementTax());
hgcw012.setThisSettlementAmount(hgcw013List.get(0).getThisSettlementAmount());
hgcw012.setSettlementNumber(settlementNumber.toString().substring(0, settlementNumber.length() - 1));
this.modify(hgcw012);
}
}inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据生成成功!");
}
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "生成采购收票失败");
}
catch (Exception e) {
LogUtils.setMsg(inInfo, e, "生成收款单失败");
}
return inInfo;
}
public EiInfo selectb(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock("resultB").getRows();
List<Map> queryRows = inInfo.getBlock(EiConstant.queryBlock).getRows();
String mainId = "";
if (CollectionUtils.isNotEmpty(queryRows)) {
mainId = queryRows.get(0).get("mainId").toString();
}
//获取相应的数据
List<HGCW013> hgcw013List = HGCWTools.HgCw013.mapTofList(resultRows, NumberUtils.toLong(mainId));
DecimalFormat decimalFormat = new DecimalFormat("#.000");
if (CollectionUtils.isNotEmpty(hgcw013List)) {
if (StringUtils.isEmpty(mainId)) {
//先生成主表
HGCW012 hgcw012 = new HGCW012();
UserVO userVO = HGCWTools.HgCw002.getUserCompany();
hgcw012.setCompanyCode(userVO.getUsercode());
hgcw012.setCompanyName(userVO.getUsername());
hgcw012.setReviewStatus(0);
hgcw012.setBillState(1);
hgcw012.setSigningDate(DateUtils.shortDate());
BigDecimal totalContractPriceIncluding = BigDecimal.ZERO;
StringBuffer settlementNumber = new StringBuffer();
Map<String, BigDecimal> rowMap = new HashMap<>();
for (HGCW013 hgcw013 : hgcw013List) {
settlementNumber.append(hgcw013.getSettlementNumber()).append(",");
}
for (Map m : resultRows) {
String c = m.get("contractNumber").toString();
BigDecimal remainingAmount = new BigDecimal(m.get("thisAmount").toString());
rowMap.put(c, remainingAmount);
totalContractPriceIncluding = totalContractPriceIncluding.add(remainingAmount);
}
hgcw012.setTotalContractPriceIncluding(new BigDecimal(decimalFormat.format(totalContractPriceIncluding)));
hgcw012.setPartyA(hgcw013List.get(0).getPartyA());
hgcw012.setTaxPoints(hgcw013List.get(0).getTaxPoints());
hgcw012.setThisSettlementTax(hgcw013List.get(0).getThisSettlementTax());
hgcw012.setThisSettlementAmount(hgcw013List.get(0).getThisSettlementAmount());
hgcw012.setBillNumber(hgcw013List.get(0).getBillNumber());
hgcw012.setSettlementNumber(settlementNumber.toString().substring(0, settlementNumber.length() - 1));
hgcw012.setRemainingAmount(new BigDecimal(decimalFormat.format(totalContractPriceIncluding)));
this.add(hgcw012);
//生成明细表
for (HGCW013 hgcw013 : hgcw013List) {
hgcw013.setMainId(hgcw012.getId());
hgcw013.setId(null);
}
} else {
HGCW012 hgcw012 = HGCWTools.HgCw012.getId(mainId);
Map<String, BigDecimal> rowMap = new HashMap<>();
for (Map m : resultRows) {
String c = m.get("contractNumber").toString();
BigDecimal remainingAmount = new BigDecimal(m.get("thisAmount").toString());
rowMap.put(c, remainingAmount);
}
// 生成明细表
for (HGCW013 hgcw013 : hgcw013List) {
hgcw013.setMainId(hgcw012.getId());
// 反写金额
HGCWTools.HgCw008.deductionAmount(hgcw013.getSettlementNumber(),rowMap.get(hgcw013.getSettlementNumber()));
this.addHGCW013(hgcw013);
}
List<HGCW013> hgcw013s = HGCWTools.HgCw013.getMainId(hgcw012.getId());
if (CollectionUtils.isNotEmpty(hgcw013s)) {
// 更新主表
BigDecimal totalContractPriceIncluding = BigDecimal.ZERO;
StringBuffer settlementNumber = new StringBuffer();
for (HGCW013 hgcw013 : hgcw013s) {
totalContractPriceIncluding = totalContractPriceIncluding.add(hgcw013.getTotalContractPriceIncluding());
settlementNumber.append(hgcw013.getSettlementNumber()).append(",");
}
hgcw012.setTotalContractPriceIncluding(totalContractPriceIncluding);
hgcw012.setPartyA(hgcw013s.get(0).getPartyA());
hgcw012.setTaxPoints(hgcw013List.get(0).getTaxPoints());
hgcw012.setThisSettlementTax(hgcw013List.get(0).getThisSettlementTax());
hgcw012.setThisSettlementAmount(hgcw013List.get(0).getThisSettlementAmount());
hgcw012.setBillNumber(hgcw013List.get(0).getBillNumber());
hgcw012.setSettlementNumber(settlementNumber.toString().substring(0, settlementNumber.length() - 1));
this.modify(hgcw012);
}
}inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据生成成功!");
}
}
catch (Exception e) {
LogUtils.setMsg(inInfo, e, "生成收款单失败");
}
return inInfo;
}
public void addHGCW013(HGCW013 HGCW013) {
DaoUtils.insert("HGCW013.insert", HGCW013);
}
/**
* 提交操作
* @param inInfo
......
......@@ -441,6 +441,22 @@ public class HGCWTools {
return results.get(0);
}
public static void updateAmount(Long id) {
AssertUtils.isNull(id, "采购收票单ID不能为空!");
HGCW012 HGCW012 = HGCWTools.HgCw012.getId(id.toString());
List<HGCW013> HGCW013s = HGCWTools.HgCw013.getMainId(HGCW012.getId());
if (CollectionUtils.isNotEmpty(HGCW013s)) {
// 更新主表
BigDecimal totalContractPriceIncluding = BigDecimal.ZERO;
StringBuffer contractNumber = new StringBuffer();
for (HGCW013 HGCW013 : HGCW013s) {
totalContractPriceIncluding = totalContractPriceIncluding.add(HGCW013.getTotalContractPriceIncluding());
}
HGCW012.setTotalContractPriceIncluding(totalContractPriceIncluding);
HGCW012.setPartyA(HGCW013s.get(0).getPartyA());
DaoUtils.update("HGCW012.update", HGCW012);
}
}
public static void cutAmount(String settlementNumber, BigDecimal cutAmount) {
AssertUtils.isNull(settlementNumber, "来源单号不能为空!");
// if (cutAmount.compareTo(new BigDecimal(BigInteger.ZERO)) <= 0) {
......@@ -462,7 +478,6 @@ public class HGCWTools {
DaoUtils.update("HGCW012.updateDeductionAmount", HGCW012);
}
public static List<HGCW012> checkList(Map paramMap) {
AssertUtils.isEmpty(paramMap, "数据检查参数不能为空");
return DaoBase.getInstance().query("HGCW012.queryCheckList", paramMap);
......@@ -486,7 +501,6 @@ public class HGCWTools {
* 采购收票明细清单
*/
public static class HgCw013 {
public static HGCW013 getId(Long id) {
AssertUtils.isNull(id, "销售开票单ID不能为空!");
List<HGCW013> results = DaoBase.getInstance().query(HGCW013.QUERY,new HashMap<String,Object>(){
......@@ -494,26 +508,85 @@ public class HGCWTools {
});
return results.get(0);
}
public static List<HGCW013> mapTofList(List<Map> rows, Long mainId) {
List<HGCW013> HGCW013List = new ArrayList<>();
if (CollectionUtils.isNotEmpty(rows)) {
rows.forEach(row -> {
HGCW013 HGCW013 = new HGCW013();
HGCW013.fromMap(row);
String settlementNumber = row.get("contractNumber").toString();
String remainingAmount = row.get("thisAmount").toString();
BigDecimal taxPoints = new BigDecimal(row.get("taxPoints").toString()); // 假设这是以整数形式给出的税率,比如17表示17%
BigDecimal thisAmount = new BigDecimal(row.get("thisAmount").toString());
BigDecimal taxRateAsDecimal = taxPoints.divide(new BigDecimal("100")).add(new BigDecimal("1")); // 将税率转换为小数形式
BigDecimal thisSettlementAmount = thisAmount.divide(taxRateAsDecimal, 2, RoundingMode.HALF_UP);
BigDecimal thisSettlementTax = thisAmount.subtract(thisSettlementAmount); // 计算税额
HGCW013.setTotalContractPriceIncluding(new BigDecimal(remainingAmount));
HGCW013.setSettlementNumber(settlementNumber);
HGCW013.setThisSettlementTax(thisSettlementTax.toString());
HGCW013.setThisSettlementAmount(thisSettlementAmount.toString());
if (mainId != null) {
HGCW013.setMainId(mainId);
}
HGCW013List.add(HGCW013);
});
}
return HGCW013List;
}
public static List<HGCW013> mapToList(List<Map> rows, Long mainId) {
List<HGCW013> hgcw013List = new ArrayList<>();
List<HGCW013> HGCW013List = new ArrayList<>();
if (CollectionUtils.isNotEmpty(rows)) {
rows.forEach(row -> {
HGCW013 hgcw013 = new HGCW013();
hgcw013.fromMap(row);
HGCW013 HGCW013 = new HGCW013();
HGCW013.fromMap(row);
String settlementNumber = row.get("settlementNumber").toString();
String remainingAmount = row.get("thisSettlementAmount").toString();
hgcw013.setTotalContractPriceIncluding(new BigDecimal(remainingAmount));
hgcw013.setSettlementNumber(settlementNumber);
String remainingAmount = row.get("thisAmount").toString();
BigDecimal taxPoints = new BigDecimal(row.get("taxPoints").toString()); // 假设这是以整数形式给出的税率,比如17表示17%
BigDecimal thisAmount = new BigDecimal(row.get("thisAmount").toString());
BigDecimal taxRateAsDecimal = taxPoints.divide(new BigDecimal("100")).add(new BigDecimal("1")); // 将税率转换为小数形式
BigDecimal thisSettlementAmount = thisAmount.divide(taxRateAsDecimal, 2, RoundingMode.HALF_UP);
BigDecimal thisSettlementTax = thisAmount.subtract(thisSettlementAmount); // 计算税额
HGCW013.setTotalContractPriceIncluding(new BigDecimal(remainingAmount));
HGCW013.setSettlementNumber(settlementNumber);
HGCW013.setThisSettlementTax(thisSettlementTax.toString());
HGCW013.setThisSettlementAmount(thisSettlementAmount.toString());
if (mainId != null) {
hgcw013.setMainId(mainId);
HGCW013.setMainId(mainId);
}
hgcw013List.add(hgcw013);
HGCW013List.add(HGCW013);
});
}
return hgcw013List;
return HGCW013List;
}
public static List<HGCW013> mapToeList(List<Map> rows, Long mainId) {
List<HGCW013> HGCW013List = new ArrayList<>();
if (CollectionUtils.isNotEmpty(rows)) {
rows.forEach(row -> {
HGCW013 HGCW013 = new HGCW013();
HGCW013.fromMap(row);
String settlementNumber = row.get("receiveNo").toString();
String partA = row.get("supName").toString();
String remainingAmount = row.get("thisSettlementAmount").toString();
BigDecimal taxPoints = new BigDecimal("13"); // 假设这是以整数形式给出的税率,比如17表示17%
BigDecimal thisAmount = new BigDecimal(row.get("thisSettlementAmount").toString());
BigDecimal taxRateAsDecimal = taxPoints.divide(new BigDecimal("100")).add(new BigDecimal("1")); // 将税率转换为小数形式
BigDecimal thisSettlementAmount = thisAmount.divide(taxRateAsDecimal, 2, RoundingMode.HALF_UP);
BigDecimal thisSettlementTax = thisAmount.subtract(thisSettlementAmount); // 计算税额
HGCW013.setPartyA(partA);
HGCW013.setTaxPoints(new Integer(String.valueOf(taxPoints)));
HGCW013.setTotalContractPriceIncluding(new BigDecimal(remainingAmount));
HGCW013.setSettlementNumber(settlementNumber);
HGCW013.setThisSettlementTax(thisSettlementTax.toString());
HGCW013.setThisSettlementAmount(thisSettlementAmount.toString());
if (mainId != null) {
HGCW013.setMainId(mainId);
}
HGCW013List.add(HGCW013);
});
}
return HGCW013List;
}
public static List<HGCW013> getMainId(Long mainId) {
AssertUtils.isNull(mainId, "主表ID不能为空!");
List<HGCW013> results = DaoBase.getInstance().query(HGCW013.QUERY,new HashMap<String,Object>(){
......@@ -521,6 +594,8 @@ public class HGCWTools {
});
return results;
}
}
public static class HgCw014 {
......
......@@ -46,39 +46,43 @@ function cancelFunc() {
}
function btnSaveFunc(btnNode, gridNode) {
let nobe = '';
let buld = '';
let rows;
if (gridNode == "result") {
rows = resultGrid.getCheckedRows();
nobe = "HGCW012";
buld = "selecta";
}else if (gridNode == "resultA") {
rows = resultAGrid.getCheckedRows();
nobe = "HGCW012";
buld = "select";
}else if (gridNode == "resultB") {
rows = resultBGrid.getCheckedRows();
nobe = "HGCW012";
buld = "selectb";
}
if (rows.length < 1) {
message("请选择数据")
return;
}
let flag = true;
if(gridNode == 'resultA'){
$.each(rows, function(index, item) {
let thisAmount = item['thisSettlementAmount'];
let thisAmount = item['thisAmount'];
let remainingAmount = item['remainingAmount'];
let billNumber = item['billNumber'];
if (!isNumber(thisAmount) && !isPositiveNumber(thisAmount)) {
message("勾选的第" + (index + 1) + "行本次票金额必须是大于0的数字");
message("勾选的第" + (index + 1) + "行本次票金额必须是大于0的数字");
flag = false;
return false;
}
if (parseFloat(thisAmount) > parseFloat(remainingAmount)) {
message("第" + (index + 1) + "行本次开票金额不能大于剩余开票金额");
flag = false;
return false;
}
if (isBlank(billNumber)) {
message("第" + (index + 1) + "行发票号不能为空,请填写发票号");
message("第" + (index + 1) + "行本次收票金额不能大于剩余收票金额");
flag = false;
return false;
}
});
})};
if (flag){
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据生成票据吗?", {
ok: function () {
......@@ -86,7 +90,7 @@ function btnSaveFunc(btnNode, gridNode) {
info.addBlock(JSUtils.checkedRows2Block(gridNode));
info.set("inqu_status-0-type",gridNode);
info.set("inqu_status-0-mainId", $("#inqu_status-0-mainId").val());
EiCommunicator.send("HGCW012", "select", info, {
EiCommunicator.send(nobe, buld, info, {
onSuccess: function (ei) {
if (ei.getStatus() >= 0) {
try {
......@@ -256,31 +260,31 @@ $(function () {
{
field: "thisPriceTax",
title: "收款价税合计金额",
headerTemplate: "<span style='color: '>结算价税合计金额 </span>",
headerTemplate: "<span style='color: '>收款价税合计金额 </span>",
locked: false
},
{
field: "thisSettlementTax",
title: "收款税金",
headerTemplate: "<span style='color: '>结算税金 </span>",
headerTemplate: "<span style='color: '>收款税金 </span>",
locked: false
},
{
field: "thisSettlementAmount",
title: "收款金额",
headerTemplate: "<span style='color: '>结算税金 </span>",
headerTemplate: "<span style='color: '>收款金额 </span>",
locked: false
},
{
field: "thisAmount",
title: "本次收款金额",
headerTemplate: "<span style='color: '>结算税金 </span>",
headerTemplate: "<span style='color: '>本次收款金额 </span>",
locked: false
},
{
field: "remainingAmount",
title: "剩余收款金额",
headerTemplate: "<span style='color: '>结算税金 </span>",
headerTemplate: "<span style='color: '>剩余收款金额 </span>",
locked: false
}],
loadComplete: function(grid) {
......@@ -342,26 +346,26 @@ $(function () {
locked: false
},
{
field: "totalContractPriceExcluding",
field: "totalContractPriceIncluding",
title: "收款价税合计金额",
headerTemplate: "<span style='color: '>结算价税合计金额 </span>",
headerTemplate: "<span style='color: '>收款价税合计金额 </span>",
locked: false
},
{
field: "valueAddedTax",
title: "收款税金",
headerTemplate: "<span style='color: '>结算税金 </span>",
headerTemplate: "<span style='color: '>收款税金 </span>",
locked: false
},
{
field: "totalContractPriceExcluding",
title: "收款金额",
headerTemplate: "<span style='color: '>结算金额 </span>",
headerTemplate: "<span style='color: '>收款金额 </span>",
locked: false
},{
field: "thisAmount",
title: "本次收款金额",
headerTemplate: "<span style='color: '>剩余付款金额 </span>",
headerTemplate: "<span style='color: '>本次收款金额 </span>",
locked: false
}],
loadComplete: function(grid) {
......
......@@ -135,15 +135,20 @@ $(function () {
grid.dataSource.bind("change", function(e) {
// 判断父级节点是否发生变化
if (e.field === "calloutCompanyCode") {
if (e.items[0]["allotType"] == 1){
e.items[0]["callinCompanyCode"] = e.items[0]["calloutCompanyCode"];
}
e.items[0]["calloutWhCode"]= '';
e.items[0]["calloutWhName"]= '';
e.items[0]["callinWhCode"] = '';
e.items[0]["callinWhName"] = '';
if(e.items[0]["allotType"] == 2){
loadChange(grid,e,"calloutWhCode");
}else if (e.items[0]["allotType"] == 1){
e.items[0]["callinCompanyCode"] = e.items[0]["calloutCompanyCode"];
loadChange(grid,e,"callinCompanyCode");
loadChange(grid,e,"calloutWhCode");
}/*if (e.items[0]["allotType"] == 1){
}*/
}
if (e.field == "calloutWhCode") {
if (e.items[0]["allotType"] == 2 && isBlank(e.items[0]["callinCompanyCode"])){
......
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