资金计划保存与展示,页面基本计算关系
parent
476168b21b
commit
b9b5e61efd
|
@ -147,11 +147,11 @@ public class ProjectController extends BaseController{
|
|||
model.put("costDetails", projectBudgetService.getBudgetCostDetail(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";
|
||||
}
|
||||
|
||||
|
@ -182,8 +182,8 @@ public class ProjectController extends BaseController{
|
|||
JSONArray details = jsonObject.getJSONArray("details");
|
||||
List<ProjectBudgetIncomeDetail> detailList = new ArrayList<>(details.size());
|
||||
for (int i = 0; i < details.size(); i++) {
|
||||
ProjectBudgetIncomeDetail incomeDetail = details.getObject(i, ProjectBudgetIncomeDetail.class);
|
||||
detailList.add(incomeDetail);
|
||||
ProjectBudgetIncomeDetail detail = details.getObject(i, ProjectBudgetIncomeDetail.class);
|
||||
detailList.add(detail);
|
||||
}
|
||||
|
||||
Project project = projectService.getProject(jsonObject.getInteger("projectId"));
|
||||
|
@ -203,8 +203,8 @@ public class ProjectController extends BaseController{
|
|||
JSONArray details = jsonObject.getJSONArray("details");
|
||||
List<ProjectBudgetCostDetail> detailList = new ArrayList<>(details.size());
|
||||
for (int i = 0; i < details.size(); i++) {
|
||||
ProjectBudgetCostDetail costDetail = details.getObject(i, ProjectBudgetCostDetail.class);
|
||||
detailList.add(costDetail);
|
||||
ProjectBudgetCostDetail detail = details.getObject(i, ProjectBudgetCostDetail.class);
|
||||
detailList.add(detail);
|
||||
}
|
||||
|
||||
Project project = projectService.getProject(jsonObject.getInteger("projectId"));
|
||||
|
@ -224,8 +224,8 @@ public class ProjectController extends BaseController{
|
|||
JSONArray details = jsonObject.getJSONArray("details");
|
||||
List<ProjectBudgetCostProjectManageDetail> detailList = new ArrayList<>(details.size());
|
||||
for (int i = 0; i < details.size(); i++) {
|
||||
ProjectBudgetCostProjectManageDetail costDetail = details.getObject(i, ProjectBudgetCostProjectManageDetail.class);
|
||||
detailList.add(costDetail);
|
||||
ProjectBudgetCostProjectManageDetail detail = details.getObject(i, ProjectBudgetCostProjectManageDetail.class);
|
||||
detailList.add(detail);
|
||||
}
|
||||
|
||||
Project project = projectService.getProject(jsonObject.getInteger("projectId"));
|
||||
|
@ -235,6 +235,27 @@ public class ProjectController extends BaseController{
|
|||
|
||||
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
|
||||
public void initBinder(WebDataBinder webDataBinder){
|
||||
webDataBinder.addCustomFormatter(new DateFormatter("yyyy-MM-dd"));
|
||||
|
|
|
@ -6,11 +6,11 @@ import javax.persistence.*;
|
|||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 资金计划表
|
||||
* 资金计划明细表
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "project_budget_plan")
|
||||
public class ProjectBudgetPlan {
|
||||
@Table(name = "project_budget_plan_detail")
|
||||
public class ProjectBudgetPlanDetail {
|
||||
/**
|
||||
* id
|
||||
*/
|
|
@ -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);
|
||||
}
|
|
@ -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);
|
||||
}
|
|
@ -7,7 +7,6 @@ import org.springframework.beans.factory.annotation.Value;
|
|||
import org.springframework.stereotype.Service;
|
||||
import top.jfunc.common.utils.CollectionUtil;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -32,7 +31,7 @@ public class ProjectBudgetService {
|
|||
@Autowired
|
||||
private ProjectBudgetCostProjectManageDetailRepository projectBudgetCostProjectManageDetailRepository;
|
||||
@Autowired
|
||||
private ProjectBudgetPlanRepository projectBudgetPlanRepository;
|
||||
private ProjectBudgetPlanDetailRepository projectBudgetPlanDetailRepository;
|
||||
|
||||
@Value("#{'${fourcal.fixedprojectmanagedetails}'.split('\\|')}")
|
||||
private String[] fixedProjectManageDetails;
|
||||
|
@ -320,20 +319,40 @@ public class ProjectBudgetService {
|
|||
|
||||
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){
|
||||
return projectBudgetPlanRepository.findAllByProjectIdEquals(project.getId());
|
||||
public List<ProjectBudgetPlanDetail> getProjectBudgetPlanDetails(Project project){
|
||||
return projectBudgetPlanDetailRepository.findAllByProjectIdEquals(project.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据每个月的计算资金计划的总
|
||||
*/
|
||||
public ProjectBudgetPlan getProjectBudgetPlanTotal(List<ProjectBudgetPlan> projectBudgetPlans) {
|
||||
ProjectBudgetPlan projectBudgetPlan = new ProjectBudgetPlan();
|
||||
public ProjectBudgetPlanDetail getProjectBudgetPlanDetailTotal(List<ProjectBudgetPlanDetail> projectBudgetPlanDetails) {
|
||||
ProjectBudgetPlanDetail projectBudgetPlanDetail = new ProjectBudgetPlanDetail();
|
||||
BigDecimal deviceCost = new BigDecimal(0);
|
||||
BigDecimal engineerCost = new BigDecimal(0);
|
||||
BigDecimal projectManageCost = new BigDecimal(0);
|
||||
|
@ -347,8 +366,8 @@ public class ProjectBudgetService {
|
|||
BigDecimal underwrittenPlan = new BigDecimal(0);
|
||||
BigDecimal repaymentPlan = new BigDecimal(0);
|
||||
|
||||
if(CollectionUtil.isNotEmpty(projectBudgetPlans)){
|
||||
for (ProjectBudgetPlan budgetPlan : projectBudgetPlans) {
|
||||
if(CollectionUtil.isNotEmpty(projectBudgetPlanDetails)){
|
||||
for (ProjectBudgetPlanDetail budgetPlan : projectBudgetPlanDetails) {
|
||||
deviceCost = deviceCost.add(budgetPlan.getDeviceCost());
|
||||
engineerCost = engineerCost.add(budgetPlan.getEngineerCost());
|
||||
projectManageCost = projectManageCost.add(budgetPlan.getProjectManageCost());
|
||||
|
@ -365,19 +384,19 @@ public class ProjectBudgetService {
|
|||
}
|
||||
|
||||
|
||||
projectBudgetPlan.setMonth("合计");
|
||||
projectBudgetPlan.setDeviceCost(deviceCost);
|
||||
projectBudgetPlan.setEngineerCost(engineerCost);
|
||||
projectBudgetPlan.setProjectManageCost(projectManageCost);
|
||||
projectBudgetPlan.setEarnestMoneyCost(earnestMoneyCost);
|
||||
projectBudgetPlan.setTotalCost(totalCost);
|
||||
projectBudgetPlan.setSaleIncome(saleIncome);
|
||||
projectBudgetPlan.setEarnestMoneyIncome(earnestMoneyIncome);
|
||||
projectBudgetPlan.setTotalIncome(totalIncome);
|
||||
projectBudgetPlan.setFundBalance(fundBalance);
|
||||
projectBudgetPlan.setCapitalInterest(capitalInterest);
|
||||
projectBudgetPlan.setUnderwrittenPlan(underwrittenPlan);
|
||||
projectBudgetPlan.setRepaymentPlan(repaymentPlan);
|
||||
return projectBudgetPlan;
|
||||
projectBudgetPlanDetail.setMonth("合计");
|
||||
projectBudgetPlanDetail.setDeviceCost(deviceCost);
|
||||
projectBudgetPlanDetail.setEngineerCost(engineerCost);
|
||||
projectBudgetPlanDetail.setProjectManageCost(projectManageCost);
|
||||
projectBudgetPlanDetail.setEarnestMoneyCost(earnestMoneyCost);
|
||||
projectBudgetPlanDetail.setTotalCost(totalCost);
|
||||
projectBudgetPlanDetail.setSaleIncome(saleIncome);
|
||||
projectBudgetPlanDetail.setEarnestMoneyIncome(earnestMoneyIncome);
|
||||
projectBudgetPlanDetail.setTotalIncome(totalIncome);
|
||||
projectBudgetPlanDetail.setFundBalance(fundBalance);
|
||||
projectBudgetPlanDetail.setCapitalInterest(capitalInterest);
|
||||
projectBudgetPlanDetail.setUnderwrittenPlan(underwrittenPlan);
|
||||
projectBudgetPlanDetail.setRepaymentPlan(repaymentPlan);
|
||||
return projectBudgetPlanDetail;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* 一个采购成本详情的字段
|
||||
* 一个项目管理成本详情的字段
|
||||
*/
|
||||
COST_PROJECT_MANAGE_DETAIL_ARR=["type","name","detail","unit","amount","price","total","predictMethod","predictWhy","remark","deletable"];
|
||||
$(function () {
|
||||
|
|
|
@ -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 () {
|
||||
$(".budget-plan-detail").click(function () {
|
||||
$('#my-prompt-budget-detail').modal({
|
||||
$('#my-prompt-budget-plan-detail').modal({
|
||||
relatedTarget: this,
|
||||
onConfirm: function(e) {
|
||||
//不能使用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());
|
||||
saveDetail("/fourcal/project/budgetEditSaveBudgetPlanDetail", data, updateBudgetPlanData);
|
||||
saveDetail("/fourcal/project/budgetEditSaveBudgetPlanDetail", data, updateBudgetPlanDetailData);
|
||||
},
|
||||
onCancel: function(e) {
|
||||
}
|
||||
});
|
||||
});
|
||||
$("#budgetPlanAddBtn").click(function () {
|
||||
$("#budgetPlanDetailAddBtn").click(function () {
|
||||
appendTrBudgetPlan();
|
||||
});
|
||||
});
|
||||
|
@ -25,31 +25,153 @@ $(function () {
|
|||
*/
|
||||
function appendTrBudgetPlan() {
|
||||
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"></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"></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" 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"></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"></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"></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"></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-detail input-changeable-engineer-cost-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-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-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-detail input-changeable-sale-income-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-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-detail input-changeable-fund-balance-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-detail input-changeable-underwritten-plan-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' +
|
||||
' </tr>';
|
||||
$("#budgetPlanTable").append(template);
|
||||
$("#budgetPlanDetailTable").append(template);
|
||||
//重新绑定删除事件和input修改事件
|
||||
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) {
|
||||
}
|
|
@ -584,11 +584,11 @@
|
|||
</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-hd">新增资金计划明细表——${project.name}</div>
|
||||
<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>
|
||||
<tr>
|
||||
<td>月份</td>
|
||||
|
@ -607,38 +607,38 @@
|
|||
<td>操作</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>${projectBudgetPlanTotal.month}</td>
|
||||
<td>${projectBudgetPlanTotal.deviceCost}</td>
|
||||
<td>${projectBudgetPlanTotal.engineerCost}</td>
|
||||
<td>${projectBudgetPlanTotal.projectManageCost}</td>
|
||||
<td>${projectBudgetPlanTotal.earnestMoneyCost}</td>
|
||||
<td>${projectBudgetPlanTotal.totalCost}</td>
|
||||
<td>${projectBudgetPlanTotal.saleIncome}</td>
|
||||
<td>${projectBudgetPlanTotal.earnestMoneyIncome}</td>
|
||||
<td>${projectBudgetPlanTotal.totalIncome}</td>
|
||||
<td>${projectBudgetPlanTotal.fundBalance}</td>
|
||||
<td>${projectBudgetPlanTotal.capitalInterest}</td>
|
||||
<td>${projectBudgetPlanTotal.underwrittenPlan}</td>
|
||||
<td>${projectBudgetPlanTotal.repaymentPlan}</td>
|
||||
<td><input type="text" class="am-modal-prompt-input" value="${projectBudgetPlanDetailTotal.month}" readonly/></td>
|
||||
<td><input type="text" class="am-modal-prompt-input input-total-device-cost-budget-plan" value="${projectBudgetPlanDetailTotal.deviceCost}" readonly/></td>
|
||||
<td><input type="text" class="am-modal-prompt-input input-total-engineer-cost-budget-plan" value="${projectBudgetPlanDetailTotal.engineerCost}" readonly/></td>
|
||||
<td><input type="text" class="am-modal-prompt-input input-total-project-manage-cost-budget-plan" value="${projectBudgetPlanDetailTotal.projectManageCost}" readonly/></td>
|
||||
<td><input type="text" class="am-modal-prompt-input input-total-earnest-money-cost-budget-plan" value="${projectBudgetPlanDetailTotal.earnestMoneyCost}" readonly/></td>
|
||||
<td><input type="text" class="am-modal-prompt-input input-total-total-cost-budget-plan" value="${projectBudgetPlanDetailTotal.totalCost}" readonly/></td>
|
||||
<td><input type="text" class="am-modal-prompt-input input-total-sale-income-budget-plan" value="${projectBudgetPlanDetailTotal.saleIncome}" readonly/></td>
|
||||
<td><input type="text" class="am-modal-prompt-input input-total-earnest-money-income-budget-plan" value="${projectBudgetPlanDetailTotal.earnestMoneyIncome}" readonly/></td>
|
||||
<td><input type="text" class="am-modal-prompt-input input-total-total-income-budget-plan" value="${projectBudgetPlanDetailTotal.totalIncome}" readonly/></td>
|
||||
<td><input type="text" class="am-modal-prompt-input input-total-fund-balance-budget-plan" value="${projectBudgetPlanDetailTotal.fundBalance}" readonly/></td>
|
||||
<td><input type="text" class="am-modal-prompt-input input-total-capital-interest-budget-plan" value="${projectBudgetPlanDetailTotal.capitalInterest}" readonly/></td>
|
||||
<td><input type="text" class="am-modal-prompt-input input-total-underwritten-plan-budget-plan" value="${projectBudgetPlanDetailTotal.underwrittenPlan}" readonly/></td>
|
||||
<td><input type="text" class="am-modal-prompt-input input-total-repayment-plan-budget-plan" value="${projectBudgetPlanDetailTotal.repaymentPlan}" readonly/></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
|
||||
<#if projectBudgetPlans??>
|
||||
<#list projectBudgetPlans as projectBudgetPlan>
|
||||
<#if projectBudgetPlanDetails??>
|
||||
<#list projectBudgetPlanDetails as projectBudgetPlanDetail>
|
||||
<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" value="${projectBudgetPlan.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" value="${projectBudgetPlan.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" value="${projectBudgetPlan.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" value="${projectBudgetPlan.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" value="${projectBudgetPlan.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" value="${projectBudgetPlan.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" value="${projectBudgetPlanDetail.month!}"></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-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-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-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-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-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-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-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-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-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-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-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>
|
||||
</tr>
|
||||
</#list>
|
||||
|
@ -646,7 +646,7 @@
|
|||
|
||||
</tbody>
|
||||
</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 class="am-modal-footer">
|
||||
<span class="am-modal-btn" data-am-modal-cancel>取消</span>
|
||||
|
@ -679,10 +679,16 @@
|
|||
<script>
|
||||
$(function () {
|
||||
|
||||
//绑定删除按钮删除当前行
|
||||
bindDeleteBtn();
|
||||
//绑定收入和采购成本的输入框【都有税率】
|
||||
bindChangeableInput();
|
||||
//绑定其他其他的输入框
|
||||
bindOtherOtherChangeable();
|
||||
//绑定项目管理明细输入框
|
||||
bindChangeableInputProjectManage();
|
||||
//绑定资金计划明细输入框
|
||||
bindChangeableInputBudgetPlanDetail();
|
||||
|
||||
|
||||
$("#saveDraft").click(function () {
|
||||
|
|
Loading…
Reference in New Issue