Commit 18591263 by 江和松

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

parents 5d3037e5 47381568
...@@ -441,6 +441,22 @@ public class HGCWTools { ...@@ -441,6 +441,22 @@ public class HGCWTools {
return results.get(0); 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) { public static void cutAmount(String settlementNumber, BigDecimal cutAmount) {
AssertUtils.isNull(settlementNumber, "来源单号不能为空!"); AssertUtils.isNull(settlementNumber, "来源单号不能为空!");
// if (cutAmount.compareTo(new BigDecimal(BigInteger.ZERO)) <= 0) { // if (cutAmount.compareTo(new BigDecimal(BigInteger.ZERO)) <= 0) {
...@@ -462,7 +478,6 @@ public class HGCWTools { ...@@ -462,7 +478,6 @@ public class HGCWTools {
DaoUtils.update("HGCW012.updateDeductionAmount", HGCW012); DaoUtils.update("HGCW012.updateDeductionAmount", HGCW012);
} }
public static List<HGCW012> checkList(Map paramMap) { public static List<HGCW012> checkList(Map paramMap) {
AssertUtils.isEmpty(paramMap, "数据检查参数不能为空"); AssertUtils.isEmpty(paramMap, "数据检查参数不能为空");
return DaoBase.getInstance().query("HGCW012.queryCheckList", paramMap); return DaoBase.getInstance().query("HGCW012.queryCheckList", paramMap);
...@@ -486,7 +501,6 @@ public class HGCWTools { ...@@ -486,7 +501,6 @@ public class HGCWTools {
* 采购收票明细清单 * 采购收票明细清单
*/ */
public static class HgCw013 { public static class HgCw013 {
public static HGCW013 getId(Long id) { public static HGCW013 getId(Long id) {
AssertUtils.isNull(id, "销售开票单ID不能为空!"); AssertUtils.isNull(id, "销售开票单ID不能为空!");
List<HGCW013> results = DaoBase.getInstance().query(HGCW013.QUERY,new HashMap<String,Object>(){ List<HGCW013> results = DaoBase.getInstance().query(HGCW013.QUERY,new HashMap<String,Object>(){
...@@ -494,26 +508,85 @@ public class HGCWTools { ...@@ -494,26 +508,85 @@ public class HGCWTools {
}); });
return results.get(0); 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) { public static List<HGCW013> mapToList(List<Map> rows, Long mainId) {
List<HGCW013> hgcw013List = new ArrayList<>(); List<HGCW013> HGCW013List = new ArrayList<>();
if (CollectionUtils.isNotEmpty(rows)) { if (CollectionUtils.isNotEmpty(rows)) {
rows.forEach(row -> { rows.forEach(row -> {
HGCW013 hgcw013 = new HGCW013(); HGCW013 HGCW013 = new HGCW013();
hgcw013.fromMap(row); HGCW013.fromMap(row);
String settlementNumber = row.get("settlementNumber").toString(); String settlementNumber = row.get("settlementNumber").toString();
String remainingAmount = row.get("thisSettlementAmount").toString(); String remainingAmount = row.get("thisAmount").toString();
hgcw013.setTotalContractPriceIncluding(new BigDecimal(remainingAmount)); BigDecimal taxPoints = new BigDecimal(row.get("taxPoints").toString()); // 假设这是以整数形式给出的税率,比如17表示17%
hgcw013.setSettlementNumber(settlementNumber); 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) { 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) { public static List<HGCW013> getMainId(Long mainId) {
AssertUtils.isNull(mainId, "主表ID不能为空!"); AssertUtils.isNull(mainId, "主表ID不能为空!");
List<HGCW013> results = DaoBase.getInstance().query(HGCW013.QUERY,new HashMap<String,Object>(){ List<HGCW013> results = DaoBase.getInstance().query(HGCW013.QUERY,new HashMap<String,Object>(){
...@@ -521,6 +594,8 @@ public class HGCWTools { ...@@ -521,6 +594,8 @@ public class HGCWTools {
}); });
return results; return results;
} }
} }
public static class HgCw014 { public static class HgCw014 {
......
...@@ -46,39 +46,43 @@ function cancelFunc() { ...@@ -46,39 +46,43 @@ function cancelFunc() {
} }
function btnSaveFunc(btnNode, gridNode) { function btnSaveFunc(btnNode, gridNode) {
let nobe = '';
let buld = '';
let rows; let rows;
if (gridNode == "result") { if (gridNode == "result") {
rows = resultGrid.getCheckedRows(); rows = resultGrid.getCheckedRows();
nobe = "HGCW012";
buld = "selecta";
}else if (gridNode == "resultA") { }else if (gridNode == "resultA") {
rows = resultAGrid.getCheckedRows(); rows = resultAGrid.getCheckedRows();
nobe = "HGCW012";
buld = "select";
}else if (gridNode == "resultB") { }else if (gridNode == "resultB") {
rows = resultBGrid.getCheckedRows(); rows = resultBGrid.getCheckedRows();
nobe = "HGCW012";
buld = "selectb";
} }
if (rows.length < 1) { if (rows.length < 1) {
message("请选择数据") message("请选择数据")
return; return;
} }
let flag = true; let flag = true;
if(gridNode == 'resultA'){
$.each(rows, function(index, item) { $.each(rows, function(index, item) {
let thisAmount = item['thisSettlementAmount']; let thisAmount = item['thisAmount'];
let remainingAmount = item['remainingAmount']; let remainingAmount = item['remainingAmount'];
let billNumber = item['billNumber'];
if (!isNumber(thisAmount) && !isPositiveNumber(thisAmount)) { if (!isNumber(thisAmount) && !isPositiveNumber(thisAmount)) {
message("勾选的第" + (index + 1) + "行本次票金额必须是大于0的数字"); message("勾选的第" + (index + 1) + "行本次票金额必须是大于0的数字");
flag = false; flag = false;
return false; return false;
} }
if (parseFloat(thisAmount) > parseFloat(remainingAmount)) { if (parseFloat(thisAmount) > parseFloat(remainingAmount)) {
message("第" + (index + 1) + "行本次开票金额不能大于剩余开票金额"); message("第" + (index + 1) + "行本次收票金额不能大于剩余收票金额");
flag = false;
return false;
}
if (isBlank(billNumber)) {
message("第" + (index + 1) + "行发票号不能为空,请填写发票号");
flag = false; flag = false;
return false; return false;
} }
}); })};
if (flag){ if (flag){
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据生成票据吗?", { JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据生成票据吗?", {
ok: function () { ok: function () {
...@@ -86,7 +90,7 @@ function btnSaveFunc(btnNode, gridNode) { ...@@ -86,7 +90,7 @@ function btnSaveFunc(btnNode, gridNode) {
info.addBlock(JSUtils.checkedRows2Block(gridNode)); info.addBlock(JSUtils.checkedRows2Block(gridNode));
info.set("inqu_status-0-type",gridNode); info.set("inqu_status-0-type",gridNode);
info.set("inqu_status-0-mainId", $("#inqu_status-0-mainId").val()); info.set("inqu_status-0-mainId", $("#inqu_status-0-mainId").val());
EiCommunicator.send("HGCW012", "select", info, { EiCommunicator.send(nobe, buld, info, {
onSuccess: function (ei) { onSuccess: function (ei) {
if (ei.getStatus() >= 0) { if (ei.getStatus() >= 0) {
try { try {
...@@ -256,31 +260,31 @@ $(function () { ...@@ -256,31 +260,31 @@ $(function () {
{ {
field: "thisPriceTax", field: "thisPriceTax",
title: "收款价税合计金额", title: "收款价税合计金额",
headerTemplate: "<span style='color: '>结算价税合计金额 </span>", headerTemplate: "<span style='color: '>收款价税合计金额 </span>",
locked: false locked: false
}, },
{ {
field: "thisSettlementTax", field: "thisSettlementTax",
title: "收款税金", title: "收款税金",
headerTemplate: "<span style='color: '>结算税金 </span>", headerTemplate: "<span style='color: '>收款税金 </span>",
locked: false locked: false
}, },
{ {
field: "thisSettlementAmount", field: "thisSettlementAmount",
title: "收款金额", title: "收款金额",
headerTemplate: "<span style='color: '>结算税金 </span>", headerTemplate: "<span style='color: '>收款金额 </span>",
locked: false locked: false
}, },
{ {
field: "thisAmount", field: "thisAmount",
title: "本次收款金额", title: "本次收款金额",
headerTemplate: "<span style='color: '>结算税金 </span>", headerTemplate: "<span style='color: '>本次收款金额 </span>",
locked: false locked: false
}, },
{ {
field: "remainingAmount", field: "remainingAmount",
title: "剩余收款金额", title: "剩余收款金额",
headerTemplate: "<span style='color: '>结算税金 </span>", headerTemplate: "<span style='color: '>剩余收款金额 </span>",
locked: false locked: false
}], }],
loadComplete: function(grid) { loadComplete: function(grid) {
...@@ -342,26 +346,26 @@ $(function () { ...@@ -342,26 +346,26 @@ $(function () {
locked: false locked: false
}, },
{ {
field: "totalContractPriceExcluding", field: "totalContractPriceIncluding",
title: "收款价税合计金额", title: "收款价税合计金额",
headerTemplate: "<span style='color: '>结算价税合计金额 </span>", headerTemplate: "<span style='color: '>收款价税合计金额 </span>",
locked: false locked: false
}, },
{ {
field: "valueAddedTax", field: "valueAddedTax",
title: "收款税金", title: "收款税金",
headerTemplate: "<span style='color: '>结算税金 </span>", headerTemplate: "<span style='color: '>收款税金 </span>",
locked: false locked: false
}, },
{ {
field: "totalContractPriceExcluding", field: "totalContractPriceExcluding",
title: "收款金额", title: "收款金额",
headerTemplate: "<span style='color: '>结算金额 </span>", headerTemplate: "<span style='color: '>收款金额 </span>",
locked: false locked: false
},{ },{
field: "thisAmount", field: "thisAmount",
title: "本次收款金额", title: "本次收款金额",
headerTemplate: "<span style='color: '>剩余付款金额 </span>", headerTemplate: "<span style='color: '>本次收款金额 </span>",
locked: false locked: false
}], }],
loadComplete: function(grid) { loadComplete: function(grid) {
......
...@@ -135,15 +135,20 @@ $(function () { ...@@ -135,15 +135,20 @@ $(function () {
grid.dataSource.bind("change", function(e) { grid.dataSource.bind("change", function(e) {
// 判断父级节点是否发生变化 // 判断父级节点是否发生变化
if (e.field === "calloutCompanyCode") { 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]["calloutWhCode"]= '';
e.items[0]["calloutWhName"]= ''; e.items[0]["calloutWhName"]= '';
e.items[0]["callinWhCode"] = ''; e.items[0]["callinWhCode"] = '';
e.items[0]["callinWhName"] = ''; 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,"callinCompanyCode");
loadChange(grid,e,"calloutWhCode"); loadChange(grid,e,"calloutWhCode");
}/*if (e.items[0]["allotType"] == 1){
}*/
} }
if (e.field == "calloutWhCode") { if (e.field == "calloutWhCode") {
if (e.items[0]["allotType"] == 2 && isBlank(e.items[0]["callinCompanyCode"])){ 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