资金计划保存与展示,页面基本计算关系

master
xxssyyyyssxx 2021-11-04 16:05:36 +08:00
parent 476168b21b
commit b9b5e61efd
8 changed files with 265 additions and 97 deletions

View File

@ -147,11 +147,11 @@ public class ProjectController extends BaseController{
model.put("costDetails", projectBudgetService.getBudgetCostDetail(project)); model.put("costDetails", projectBudgetService.getBudgetCostDetail(project));
//项目管理成本明细 //项目管理成本明细
model.put("costProjectManageDetails", projectBudgetService.getBudgetCostProjectManageDetail(project)); model.put("costProjectManageDetails", projectBudgetService.getBudgetCostProjectManageDetail(project));
List<ProjectBudgetPlan> projectBudgetPlans = projectBudgetService.getProjectBudgetPlans(project); List<ProjectBudgetPlanDetail> projectBudgetPlanDetails = projectBudgetService.getProjectBudgetPlanDetails(project);
//资金计划明细 //资金计划明细
model.put("projectBudgetPlans", projectBudgetPlans); model.put("projectBudgetPlanDetails", projectBudgetPlanDetails);
//资金计划总 //资金计划总
model.put("projectBudgetPlanTotal", projectBudgetService.getProjectBudgetPlanTotal(projectBudgetPlans)); model.put("projectBudgetPlanDetailTotal", projectBudgetService.getProjectBudgetPlanDetailTotal(projectBudgetPlanDetails));
return "admin/project_budget_edit"; return "admin/project_budget_edit";
} }
@ -182,8 +182,8 @@ public class ProjectController extends BaseController{
JSONArray details = jsonObject.getJSONArray("details"); JSONArray details = jsonObject.getJSONArray("details");
List<ProjectBudgetIncomeDetail> detailList = new ArrayList<>(details.size()); List<ProjectBudgetIncomeDetail> detailList = new ArrayList<>(details.size());
for (int i = 0; i < details.size(); i++) { for (int i = 0; i < details.size(); i++) {
ProjectBudgetIncomeDetail incomeDetail = details.getObject(i, ProjectBudgetIncomeDetail.class); ProjectBudgetIncomeDetail detail = details.getObject(i, ProjectBudgetIncomeDetail.class);
detailList.add(incomeDetail); detailList.add(detail);
} }
Project project = projectService.getProject(jsonObject.getInteger("projectId")); Project project = projectService.getProject(jsonObject.getInteger("projectId"));
@ -203,8 +203,8 @@ public class ProjectController extends BaseController{
JSONArray details = jsonObject.getJSONArray("details"); JSONArray details = jsonObject.getJSONArray("details");
List<ProjectBudgetCostDetail> detailList = new ArrayList<>(details.size()); List<ProjectBudgetCostDetail> detailList = new ArrayList<>(details.size());
for (int i = 0; i < details.size(); i++) { for (int i = 0; i < details.size(); i++) {
ProjectBudgetCostDetail costDetail = details.getObject(i, ProjectBudgetCostDetail.class); ProjectBudgetCostDetail detail = details.getObject(i, ProjectBudgetCostDetail.class);
detailList.add(costDetail); detailList.add(detail);
} }
Project project = projectService.getProject(jsonObject.getInteger("projectId")); Project project = projectService.getProject(jsonObject.getInteger("projectId"));
@ -224,8 +224,8 @@ public class ProjectController extends BaseController{
JSONArray details = jsonObject.getJSONArray("details"); JSONArray details = jsonObject.getJSONArray("details");
List<ProjectBudgetCostProjectManageDetail> detailList = new ArrayList<>(details.size()); List<ProjectBudgetCostProjectManageDetail> detailList = new ArrayList<>(details.size());
for (int i = 0; i < details.size(); i++) { for (int i = 0; i < details.size(); i++) {
ProjectBudgetCostProjectManageDetail costDetail = details.getObject(i, ProjectBudgetCostProjectManageDetail.class); ProjectBudgetCostProjectManageDetail detail = details.getObject(i, ProjectBudgetCostProjectManageDetail.class);
detailList.add(costDetail); detailList.add(detail);
} }
Project project = projectService.getProject(jsonObject.getInteger("projectId")); Project project = projectService.getProject(jsonObject.getInteger("projectId"));
@ -235,6 +235,27 @@ public class ProjectController extends BaseController{
return ResponseMsg.buildSuccessMsg("成功"); return ResponseMsg.buildSuccessMsg("成功");
} }
/**
*
*/
@RequestMapping("/budgetEditSaveBudgetPlanDetail")
@ResponseBody
public ResponseMsg budgetEditSaveBudgetPlanDetail(@RequestBody String body) {
JSONObject jsonObject = JSON.parseObject(body);
JSONArray details = jsonObject.getJSONArray("details");
List<ProjectBudgetPlanDetail> detailList = new ArrayList<>(details.size());
for (int i = 0; i < details.size(); i++) {
ProjectBudgetPlanDetail detail = details.getObject(i, ProjectBudgetPlanDetail.class);
detailList.add(detail);
}
Project project = projectService.getProject(jsonObject.getInteger("projectId"));
projectBudgetService.clearBudgetPlanDetail(project);
projectBudgetService.saveBudgetPlanDetail(project, detailList);
return ResponseMsg.buildSuccessMsg("成功");
}
@InitBinder @InitBinder
public void initBinder(WebDataBinder webDataBinder){ public void initBinder(WebDataBinder webDataBinder){
webDataBinder.addCustomFormatter(new DateFormatter("yyyy-MM-dd")); webDataBinder.addCustomFormatter(new DateFormatter("yyyy-MM-dd"));

View File

@ -6,11 +6,11 @@ import javax.persistence.*;
import java.math.BigDecimal; import java.math.BigDecimal;
/** /**
* *
*/ */
@Entity @Entity
@Table(name = "project_budget_plan") @Table(name = "project_budget_plan_detail")
public class ProjectBudgetPlan { public class ProjectBudgetPlanDetail {
/** /**
* id * id
*/ */

View File

@ -0,0 +1,9 @@
package cn.palmte.work.model;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
public interface ProjectBudgetPlanDetailRepository extends JpaRepository<ProjectBudgetPlanDetail,Integer> {
List<ProjectBudgetPlanDetail> findAllByProjectIdEquals(int id);
}

View File

@ -1,9 +0,0 @@
package cn.palmte.work.model;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
public interface ProjectBudgetPlanRepository extends JpaRepository<ProjectBudgetPlan,Integer> {
List<ProjectBudgetPlan> findAllByProjectIdEquals(int id);
}

View File

@ -7,7 +7,6 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import top.jfunc.common.utils.CollectionUtil; import top.jfunc.common.utils.CollectionUtil;
import javax.persistence.Column;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -32,7 +31,7 @@ public class ProjectBudgetService {
@Autowired @Autowired
private ProjectBudgetCostProjectManageDetailRepository projectBudgetCostProjectManageDetailRepository; private ProjectBudgetCostProjectManageDetailRepository projectBudgetCostProjectManageDetailRepository;
@Autowired @Autowired
private ProjectBudgetPlanRepository projectBudgetPlanRepository; private ProjectBudgetPlanDetailRepository projectBudgetPlanDetailRepository;
@Value("#{'${fourcal.fixedprojectmanagedetails}'.split('\\|')}") @Value("#{'${fourcal.fixedprojectmanagedetails}'.split('\\|')}")
private String[] fixedProjectManageDetails; private String[] fixedProjectManageDetails;
@ -320,20 +319,40 @@ public class ProjectBudgetService {
return projectManageDetails; return projectManageDetails;
} }
/**
*
*/
public void clearBudgetPlanDetail(Project project){
List<ProjectBudgetPlanDetail> costDetails = projectBudgetPlanDetailRepository.findAllByProjectIdEquals(project.getId());
if(CollectionUtil.isNotEmpty(costDetails)){
projectBudgetPlanDetailRepository.deleteInBatch(costDetails);
}
}
/**
*
*/
public void saveBudgetPlanDetail(Project project, List<ProjectBudgetPlanDetail> detailList){
if(CollectionUtil.isNotEmpty(detailList)){
for (ProjectBudgetPlanDetail projectBudgetPlanDetail : detailList) {
projectBudgetPlanDetail.setProjectId(project.getId());
}
projectBudgetPlanDetailRepository.save(detailList);
}
}
/** /**
* *
*/ */
public List<ProjectBudgetPlan> getProjectBudgetPlans(Project project){ public List<ProjectBudgetPlanDetail> getProjectBudgetPlanDetails(Project project){
return projectBudgetPlanRepository.findAllByProjectIdEquals(project.getId()); return projectBudgetPlanDetailRepository.findAllByProjectIdEquals(project.getId());
} }
/** /**
* *
*/ */
public ProjectBudgetPlan getProjectBudgetPlanTotal(List<ProjectBudgetPlan> projectBudgetPlans) { public ProjectBudgetPlanDetail getProjectBudgetPlanDetailTotal(List<ProjectBudgetPlanDetail> projectBudgetPlanDetails) {
ProjectBudgetPlan projectBudgetPlan = new ProjectBudgetPlan(); ProjectBudgetPlanDetail projectBudgetPlanDetail = new ProjectBudgetPlanDetail();
BigDecimal deviceCost = new BigDecimal(0); BigDecimal deviceCost = new BigDecimal(0);
BigDecimal engineerCost = new BigDecimal(0); BigDecimal engineerCost = new BigDecimal(0);
BigDecimal projectManageCost = new BigDecimal(0); BigDecimal projectManageCost = new BigDecimal(0);
@ -347,8 +366,8 @@ public class ProjectBudgetService {
BigDecimal underwrittenPlan = new BigDecimal(0); BigDecimal underwrittenPlan = new BigDecimal(0);
BigDecimal repaymentPlan = new BigDecimal(0); BigDecimal repaymentPlan = new BigDecimal(0);
if(CollectionUtil.isNotEmpty(projectBudgetPlans)){ if(CollectionUtil.isNotEmpty(projectBudgetPlanDetails)){
for (ProjectBudgetPlan budgetPlan : projectBudgetPlans) { for (ProjectBudgetPlanDetail budgetPlan : projectBudgetPlanDetails) {
deviceCost = deviceCost.add(budgetPlan.getDeviceCost()); deviceCost = deviceCost.add(budgetPlan.getDeviceCost());
engineerCost = engineerCost.add(budgetPlan.getEngineerCost()); engineerCost = engineerCost.add(budgetPlan.getEngineerCost());
projectManageCost = projectManageCost.add(budgetPlan.getProjectManageCost()); projectManageCost = projectManageCost.add(budgetPlan.getProjectManageCost());
@ -365,19 +384,19 @@ public class ProjectBudgetService {
} }
projectBudgetPlan.setMonth("合计"); projectBudgetPlanDetail.setMonth("合计");
projectBudgetPlan.setDeviceCost(deviceCost); projectBudgetPlanDetail.setDeviceCost(deviceCost);
projectBudgetPlan.setEngineerCost(engineerCost); projectBudgetPlanDetail.setEngineerCost(engineerCost);
projectBudgetPlan.setProjectManageCost(projectManageCost); projectBudgetPlanDetail.setProjectManageCost(projectManageCost);
projectBudgetPlan.setEarnestMoneyCost(earnestMoneyCost); projectBudgetPlanDetail.setEarnestMoneyCost(earnestMoneyCost);
projectBudgetPlan.setTotalCost(totalCost); projectBudgetPlanDetail.setTotalCost(totalCost);
projectBudgetPlan.setSaleIncome(saleIncome); projectBudgetPlanDetail.setSaleIncome(saleIncome);
projectBudgetPlan.setEarnestMoneyIncome(earnestMoneyIncome); projectBudgetPlanDetail.setEarnestMoneyIncome(earnestMoneyIncome);
projectBudgetPlan.setTotalIncome(totalIncome); projectBudgetPlanDetail.setTotalIncome(totalIncome);
projectBudgetPlan.setFundBalance(fundBalance); projectBudgetPlanDetail.setFundBalance(fundBalance);
projectBudgetPlan.setCapitalInterest(capitalInterest); projectBudgetPlanDetail.setCapitalInterest(capitalInterest);
projectBudgetPlan.setUnderwrittenPlan(underwrittenPlan); projectBudgetPlanDetail.setUnderwrittenPlan(underwrittenPlan);
projectBudgetPlan.setRepaymentPlan(repaymentPlan); projectBudgetPlanDetail.setRepaymentPlan(repaymentPlan);
return projectBudgetPlan; return projectBudgetPlanDetail;
} }
} }

View File

@ -1,5 +1,5 @@
/** /**
* 一个采购成本详情的字段 * 一个项目管理成本详情的字段
*/ */
COST_PROJECT_MANAGE_DETAIL_ARR=["type","name","detail","unit","amount","price","total","predictMethod","predictWhy","remark","deletable"]; COST_PROJECT_MANAGE_DETAIL_ARR=["type","name","detail","unit","amount","price","total","predictMethod","predictWhy","remark","deletable"];
$(function () { $(function () {

View File

@ -1,22 +1,22 @@
/** /**
* 一个资金计划的字段 * 一个资金计划的字段
*/ */
BUDGET_PLAN_DETAIL_ARR=["type","name","detail","unit","amount","price","total","predictMethod","predictWhy","remark","deletable"]; BUDGET_PLAN_DETAIL_ARR=["month","deviceCost","engineerCost","project_manageCost","earnestMoneyCost","totalCost","saleIncome","earnestMoneyIncome","totalIncome","fundBalance","capitalInterest","underwrittenPlan","repaymentPlan"];
$(function () { $(function () {
$(".budget-plan-detail").click(function () { $(".budget-plan-detail").click(function () {
$('#my-prompt-budget-detail').modal({ $('#my-prompt-budget-plan-detail').modal({
relatedTarget: this, relatedTarget: this,
onConfirm: function(e) { onConfirm: function(e) {
//不能使用e.data因为无法获取动态添加的 //不能使用e.data因为无法获取动态添加的
var data = collectData("am-modal-prompt-input-budget-plan"); var data = collectData("am-modal-prompt-input-budget-plan-detail");
data = prepareAjaxData(data, BUDGET_PLAN_DETAIL_ARR, $("#id").val()); data = prepareAjaxData(data, BUDGET_PLAN_DETAIL_ARR, $("#id").val());
saveDetail("/fourcal/project/budgetEditSaveBudgetPlanDetail", data, updateBudgetPlanData); saveDetail("/fourcal/project/budgetEditSaveBudgetPlanDetail", data, updateBudgetPlanDetailData);
}, },
onCancel: function(e) { onCancel: function(e) {
} }
}); });
}); });
$("#budgetPlanAddBtn").click(function () { $("#budgetPlanDetailAddBtn").click(function () {
appendTrBudgetPlan(); appendTrBudgetPlan();
}); });
}); });
@ -25,31 +25,153 @@ $(function () {
*/ */
function appendTrBudgetPlan() { function appendTrBudgetPlan() {
var template = '<tr>\n' + var template = '<tr>\n' +
' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan"></td>\n' + ' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan-detail"></td>\n' +
' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan"></td>\n' + ' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-device-cost-budget-plan"></td>\n' +
' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan"></td>\n' + ' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-engineer-cost-budget-plan"></td>\n' +
' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan"></td>\n' + ' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-project-manage-cost-budget-plan"></td>\n' +
' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan"></td>\n' + ' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-earnest-money-cost-budget-plan"></td>\n' +
' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan" readonly></td>\n' + ' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-total-cost-budget-plan" readonly></td>\n' +
' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan"></td>\n' + ' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-sale-income-budget-plan"></td>\n' +
' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan"></td>\n' + ' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-earnest-money-income-budget-plan"></td>\n' +
' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan" readonly></td>\n' + ' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-total-income-budget-plan" readonly></td>\n' +
' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan"></td>\n' + ' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-fund-balance-budget-plan"></td>\n' +
' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan"></td>\n' + ' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-capital-interest-budget-plan"></td>\n' +
' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan"></td>\n' + ' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-underwritten-plan-budget-plan"></td>\n' +
' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan"></td>\n' + ' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-repayment-plan-budget-plan"></td>\n' +
' <td><button type="button" class="am-btn am-btn-warning am-btn-xs am-round am-modal-line-delete"><span class="am-icon-minus"></span></button></td>\n' + ' <td><button type="button" class="am-btn am-btn-warning am-btn-xs am-round am-modal-line-delete"><span class="am-icon-minus"></span></button></td>\n' +
' </tr>'; ' </tr>';
$("#budgetPlanTable").append(template); $("#budgetPlanDetailTable").append(template);
//重新绑定删除事件和input修改事件 //重新绑定删除事件和input修改事件
bindDeleteBtn(); bindDeleteBtn();
bindChangeableInputBudgetPlan(); bindChangeableInputBudgetPlanDetail();
} }
function bindChangeableInputBudgetPlan() { function bindChangeableInputBudgetPlanDetail() {
//设备支出改变
$(".input-changeable-device-cost-budget-plan").change(function () {
var deviceCost = parseFloat($(this).val());
//找到对应的工程支出、经营性支出、保证金支出
var engineerCost = parseFloat($(this).parent().parent().find(".input-changeable-engineer-cost-budget-plan").val());
var projectManageCost = parseFloat($(this).parent().parent().find(".input-changeable-project-manage-cost-budget-plan").val());
var earnestMoneyCost = parseFloat($(this).parent().parent().find(".input-changeable-earnest-money-cost-budget-plan").val());
console.log(deviceCost,engineerCost,projectManageCost,earnestMoneyCost);
$(this).parent().parent().find(".input-changeable-total-cost-budget-plan").val(deviceCost+engineerCost+projectManageCost+earnestMoneyCost);
updateBudgetPlanTotal("input-changeable-device-cost-budget-plan","input-total-device-cost-budget-plan");
updateBudgetPlanTotal("input-changeable-total-cost-budget-plan","input-total-total-cost-budget-plan");
});
//工程支出改变
$(".input-changeable-engineer-cost-budget-plan").change(function () {
var engineerCost = parseFloat($(this).val());
//找到对应的设备支出、经营性支出、保证金支出
var deviceCost = parseFloat($(this).parent().parent().find(".input-changeable-device-cost-budget-plan").val());
var projectManageCost = parseFloat($(this).parent().parent().find(".input-changeable-project-manage-cost-budget-plan").val());
var earnestMoneyCost = parseFloat($(this).parent().parent().find(".input-changeable-earnest-money-cost-budget-plan").val());
console.log(deviceCost,engineerCost,projectManageCost,earnestMoneyCost);
$(this).parent().parent().find(".input-changeable-total-cost-budget-plan").val(deviceCost+engineerCost+projectManageCost+earnestMoneyCost);
updateBudgetPlanTotal("input-changeable-engineer-cost-budget-plan","input-total-engineer-cost-budget-plan");
updateBudgetPlanTotal("input-changeable-total-cost-budget-plan","input-total-total-cost-budget-plan");
});
//经营性支出改变
$(".input-changeable-project-manage-cost-budget-plan").change(function () {
var projectManageCost = parseFloat($(this).val());
//找到对应的设备支出、工程支出、保证金支出
var deviceCost = parseFloat($(this).parent().parent().find(".input-changeable-device-cost-budget-plan").val());
var engineerCost = parseFloat($(this).parent().parent().find(".input-changeable-engineer-cost-budget-plan").val());
var earnestMoneyCost = parseFloat($(this).parent().parent().find(".input-changeable-earnest-money-cost-budget-plan").val());
console.log(deviceCost,engineerCost,projectManageCost,earnestMoneyCost);
$(this).parent().parent().find(".input-changeable-total-cost-budget-plan").val(deviceCost+engineerCost+projectManageCost+earnestMoneyCost);
updateBudgetPlanTotal("input-changeable-project-manage-cost-budget-plan","input-total-project-manage-cost-budget-plan");
updateBudgetPlanTotal("input-changeable-total-cost-budget-plan","input-total-total-cost-budget-plan");
});
//保证金改变
$(".input-changeable-earnest-money-cost-budget-plan").change(function () {
var earnestMoneyCost = parseFloat($(this).val());
//找到对应的设备支出、经营性支出、保证金支出
var deviceCost = parseFloat($(this).parent().parent().find(".input-changeable-device-cost-budget-plan").val());
var engineerCost = parseFloat($(this).parent().parent().find(".input-changeable-engineer-cost-budget-plan").val());
var projectManageCost = parseFloat($(this).parent().parent().find(".input-changeable-project-manage-cost-budget-plan").val());
console.log(deviceCost,engineerCost,projectManageCost,earnestMoneyCost);
$(this).parent().parent().find(".input-changeable-total-cost-budget-plan").val(deviceCost+engineerCost+projectManageCost+earnestMoneyCost);
updateBudgetPlanTotal("input-changeable-earnest-money-cost-budget-plan","input-total-earnest-money-cost-budget-plan");
updateBudgetPlanTotal("input-changeable-total-cost-budget-plan","input-total-total-cost-budget-plan");
});
//销售收款改变
$(".input-changeable-sale-income-budget-plan").change(function () {
var saleIncome = parseFloat($(this).val());
//找到保证金收款
var earnestMoneyIncome = parseFloat($(this).parent().parent().find(".input-changeable-earnest-money-income-budget-plan").val());
console.log(saleIncome, earnestMoneyIncome);
$(this).parent().parent().find(".input-changeable-total-income-budget-plan").val(saleIncome+earnestMoneyIncome);
updateBudgetPlanTotal("input-changeable-sale-income-budget-plan","input-total-sale-income-budget-plan");
updateBudgetPlanTotal("input-changeable-total-income-budget-plan","input-total-total-income-budget-plan");
});
//保证金收款改变
$(".input-changeable-earnest-money-income-budget-plan").change(function () {
var earnestMoneyIncome = parseFloat($(this).val());
//找到保证金收款
var saleIncome = parseFloat($(this).parent().parent().find(".input-changeable-sale-income-budget-plan").val());
console.log(saleIncome, earnestMoneyIncome);
$(this).parent().parent().find(".input-changeable-total-income-budget-plan").val(saleIncome+earnestMoneyIncome);
updateBudgetPlanTotal("input-changeable-earnest-money-income-budget-plan","input-total-earnest-money-income-budget-plan");
updateBudgetPlanTotal("input-changeable-total-income-budget-plan","input-total-total-income-budget-plan");
});
//资金余额改变
$(".input-changeable-fund-balance-budget-plan").change(function () {
updateBudgetPlanTotal("input-changeable-fund-balance-budget-plan","input-total-fund-balance-budget-plan");
});
//资金利息改变
$(".input-changeable-capital-interest-budget-plan").change(function () {
updateBudgetPlanTotal("input-changeable-capital-interest-budget-plan","input-total-capital-interest-budget-plan");
});
//垫资计划改变
$(".input-changeable-underwritten-plan-budget-plan").change(function () {
updateBudgetPlanTotal("input-changeable-underwritten-plan-budget-plan","input-total-underwritten-plan-budget-plan");
});
//还款计划改变
$(".input-changeable-repayment-plan-budget-plan").change(function () {
updateBudgetPlanTotal("input-changeable-repayment-plan-budget-plan","input-total-repayment-plan-budget-plan");
});
/*//支出合计改变
$(".input-changeable-total-cost-budget-plan").change(function () {
updateBudgetPlanTotal("input-changeable-total-cost-budget-plan","input-total-total-cost-budget-plan");
});
//收款合计改变
$(".input-total-total-income-budget-plan").change(function () {
updateBudgetPlanTotal("input-changeable-total-income-budget-plan","input-total-total-income-budget-plan");
});*/
} }
/**
* 更新每列的总计
*/
function updateBudgetPlanTotal(className, totalClassName) {
var total = 0;
//找到本列所有的
$("."+className).each(function (t) {
total += parseFloat($(this).val());
});
$("."+totalClassName).val(total);
}
/** /**
* 更新页面收入的数据 * 更新页面收入的数据
*/ */
function updateBudgetPlanData(details) { function updateBudgetPlanDetailData(details) {
} }

View File

@ -584,11 +584,11 @@
</div> </div>
</div> </div>
<#--资金计划明细表弹窗--> <#--资金计划明细表弹窗-->
<div class="am-modal am-modal-prompt" style="width: 1200px;max-height:600px;overflow-y:auto;" tabindex="-1" id="my-prompt-budget-detail"> <div class="am-modal am-modal-prompt" style="width: 1200px;max-height:600px;overflow-y:auto;" tabindex="-1" id="my-prompt-budget-plan-detail">
<div class="am-modal-dialog"> <div class="am-modal-dialog">
<div class="am-modal-hd">新增资金计划明细表——${project.name}</div> <div class="am-modal-hd">新增资金计划明细表——${project.name}</div>
<div class="am-modal-bd"> <div class="am-modal-bd">
<table class="am-table am-table-bordered am-table-radius table-main" style="padding:0;" id="budgetPlanTable"> <table class="am-table am-table-bordered am-table-radius table-main" style="padding:0;" id="budgetPlanDetailTable">
<tbody> <tbody>
<tr> <tr>
<td>月份</td> <td>月份</td>
@ -607,38 +607,38 @@
<td>操作</td> <td>操作</td>
</tr> </tr>
<tr> <tr>
<td>${projectBudgetPlanTotal.month}</td> <td><input type="text" class="am-modal-prompt-input" value="${projectBudgetPlanDetailTotal.month}" readonly/></td>
<td>${projectBudgetPlanTotal.deviceCost}</td> <td><input type="text" class="am-modal-prompt-input input-total-device-cost-budget-plan" value="${projectBudgetPlanDetailTotal.deviceCost}" readonly/></td>
<td>${projectBudgetPlanTotal.engineerCost}</td> <td><input type="text" class="am-modal-prompt-input input-total-engineer-cost-budget-plan" value="${projectBudgetPlanDetailTotal.engineerCost}" readonly/></td>
<td>${projectBudgetPlanTotal.projectManageCost}</td> <td><input type="text" class="am-modal-prompt-input input-total-project-manage-cost-budget-plan" value="${projectBudgetPlanDetailTotal.projectManageCost}" readonly/></td>
<td>${projectBudgetPlanTotal.earnestMoneyCost}</td> <td><input type="text" class="am-modal-prompt-input input-total-earnest-money-cost-budget-plan" value="${projectBudgetPlanDetailTotal.earnestMoneyCost}" readonly/></td>
<td>${projectBudgetPlanTotal.totalCost}</td> <td><input type="text" class="am-modal-prompt-input input-total-total-cost-budget-plan" value="${projectBudgetPlanDetailTotal.totalCost}" readonly/></td>
<td>${projectBudgetPlanTotal.saleIncome}</td> <td><input type="text" class="am-modal-prompt-input input-total-sale-income-budget-plan" value="${projectBudgetPlanDetailTotal.saleIncome}" readonly/></td>
<td>${projectBudgetPlanTotal.earnestMoneyIncome}</td> <td><input type="text" class="am-modal-prompt-input input-total-earnest-money-income-budget-plan" value="${projectBudgetPlanDetailTotal.earnestMoneyIncome}" readonly/></td>
<td>${projectBudgetPlanTotal.totalIncome}</td> <td><input type="text" class="am-modal-prompt-input input-total-total-income-budget-plan" value="${projectBudgetPlanDetailTotal.totalIncome}" readonly/></td>
<td>${projectBudgetPlanTotal.fundBalance}</td> <td><input type="text" class="am-modal-prompt-input input-total-fund-balance-budget-plan" value="${projectBudgetPlanDetailTotal.fundBalance}" readonly/></td>
<td>${projectBudgetPlanTotal.capitalInterest}</td> <td><input type="text" class="am-modal-prompt-input input-total-capital-interest-budget-plan" value="${projectBudgetPlanDetailTotal.capitalInterest}" readonly/></td>
<td>${projectBudgetPlanTotal.underwrittenPlan}</td> <td><input type="text" class="am-modal-prompt-input input-total-underwritten-plan-budget-plan" value="${projectBudgetPlanDetailTotal.underwrittenPlan}" readonly/></td>
<td>${projectBudgetPlanTotal.repaymentPlan}</td> <td><input type="text" class="am-modal-prompt-input input-total-repayment-plan-budget-plan" value="${projectBudgetPlanDetailTotal.repaymentPlan}" readonly/></td>
<td></td> <td></td>
</tr> </tr>
<#if projectBudgetPlans??> <#if projectBudgetPlanDetails??>
<#list projectBudgetPlans as projectBudgetPlan> <#list projectBudgetPlanDetails as projectBudgetPlanDetail>
<tr> <tr>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan" value="${projectBudgetPlan.month!}"></td> <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan-detail" value="${projectBudgetPlanDetail.month!}"></td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan" value="${projectBudgetPlan.deviceCost!}"></td> <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-device-cost-budget-plan" value="${projectBudgetPlanDetail.deviceCost!}"></td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan" value="${projectBudgetPlan.engineerCost!}"></td> <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-engineer-cost-budget-plan" value="${projectBudgetPlanDetail.engineerCost!}"></td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan" value="${projectBudgetPlan.projectManageCost!}"></td> <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-project-manage-cost-budget-plan" value="${projectBudgetPlanDetail.projectManageCost!}"></td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan" value="${projectBudgetPlan.earnestMoneyCost!}"></td> <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-earnest-money-cost-budget-plan" value="${projectBudgetPlanDetail.earnestMoneyCost!}"></td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan" value="${projectBudgetPlan.totalCost!}" readonly></td> <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-total-cost-budget-plan" value="${projectBudgetPlanDetail.totalCost!}" readonly></td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan" value="${projectBudgetPlan.saleIncome!}"></td> <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-sale-income-budget-plan" value="${projectBudgetPlanDetail.saleIncome!}"></td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan" value="${projectBudgetPlan.earnestMoneyIncome!}"></td> <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-earnest-money-income-budget-plan" value="${projectBudgetPlanDetail.earnestMoneyIncome!}"></td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan" value="${projectBudgetPlan.totalIncome!}" readonly></td> <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-total-income-budget-plan" value="${projectBudgetPlanDetail.totalIncome!}" readonly></td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan" value="${projectBudgetPlan.fundBalance!}"></td> <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-fund-balance-budget-plan" value="${projectBudgetPlanDetail.fundBalance!}"></td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan" value="${projectBudgetPlan.capitalInterest!}"></td> <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-capital-interest-budget-plan" value="${projectBudgetPlanDetail.capitalInterest!}"></td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan" value="${projectBudgetPlan.underwrittenPlan!}"></td> <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-underwritten-plan-budget-plan" value="${projectBudgetPlanDetail.underwrittenPlan!}"></td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan" value="${projectBudgetPlan.repaymentPlan!}"></td> <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-repayment-plan-budget-plan" value="${projectBudgetPlanDetail.repaymentPlan!}"></td>
<td><button type="button" class="am-btn am-btn-warning am-btn-xs am-round am-modal-line-delete"><span class="am-icon-minus"></span></button></td> <td><button type="button" class="am-btn am-btn-warning am-btn-xs am-round am-modal-line-delete"><span class="am-icon-minus"></span></button></td>
</tr> </tr>
</#list> </#list>
@ -646,7 +646,7 @@
</tbody> </tbody>
</table> </table>
<button type="button" id="budgetPlanAddBtn" class="am-btn am-btn-primary am-btn-xs am-round"><span class="am-icon-plus"></span></button> <button type="button" id="budgetPlanDetailAddBtn" class="am-btn am-btn-primary am-btn-xs am-round"><span class="am-icon-plus"></span></button>
</div> </div>
<div class="am-modal-footer"> <div class="am-modal-footer">
<span class="am-modal-btn" data-am-modal-cancel>取消</span> <span class="am-modal-btn" data-am-modal-cancel>取消</span>
@ -679,10 +679,16 @@
<script> <script>
$(function () { $(function () {
//绑定删除按钮删除当前行
bindDeleteBtn(); bindDeleteBtn();
//绑定收入和采购成本的输入框【都有税率】
bindChangeableInput(); bindChangeableInput();
//绑定其他其他的输入框
bindOtherOtherChangeable(); bindOtherOtherChangeable();
//绑定项目管理明细输入框
bindChangeableInputProjectManage(); bindChangeableInputProjectManage();
//绑定资金计划明细输入框
bindChangeableInputBudgetPlanDetail();
$("#saveDraft").click(function () { $("#saveDraft").click(function () {