预算三表添加总计,资金计划表添加时间选取

master
OathK1per 2022-04-18 17:31:51 +08:00
parent 6d44cc52a1
commit 7521eff73d
13 changed files with 483 additions and 56 deletions

View File

@ -7,6 +7,14 @@ import java.math.BigDecimal;
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
*/
public class BudgetBean extends IncomeCostBean{
/**
*
*/
private BigDecimal costPurchaseTotalTaxExclude;
/**
*
*/
private BigDecimal costPurchaseTotalTaxInclude;
/**
* null0
*/
@ -14,4 +22,20 @@ public class BudgetBean extends IncomeCostBean{
protected BigDecimal handleSpecial(BigDecimal src) {
return null == src ? new BigDecimal(0) : src;
}
public BigDecimal getCostPurchaseTotalTaxExclude() {
return handleSpecial(costPurchaseTotalTaxExclude);
}
public void setCostPurchaseTotalTaxExclude(BigDecimal costPurchaseTotalTaxExclude) {
this.costPurchaseTotalTaxExclude = costPurchaseTotalTaxExclude;
}
public BigDecimal getCostPurchaseTotalTaxInclude() {
return handleSpecial(costPurchaseTotalTaxInclude);
}
public void setCostPurchaseTotalTaxInclude(BigDecimal costPurchaseTotalTaxInclude) {
this.costPurchaseTotalTaxInclude = costPurchaseTotalTaxInclude;
}
}

View File

@ -177,6 +177,10 @@ public class ProjectController extends BaseController {
Project project = projectService.getProject(id);
model.put("project", project);
model.put("planStartStr", project.getPlanStartStr());
model.put("planStartDate", project.getPlanStartStr());
model.put("planEndStr", project.getPlanEndStr());
model.put("planEndDate", project.getPlanEndStr());
EstimateBean estimateBean = projectEstimateService.getEstimate(project);
model.put("estimateBean", estimateBean);
@ -188,12 +192,15 @@ public class ProjectController extends BaseController {
//收入明细
List<ProjectBudgetIncomeDetail> budgetIncomeDetail = projectBudgetService.getBudgetIncomeDetail(project);
model.put("incomeDetails", budgetIncomeDetail);
model.put("incomeTotalAmount", projectBudgetService.getBudgetIncomeAmount(project));
//成本明细
List<ProjectBudgetCostDetail> budgetCostDetail = projectBudgetService.getBudgetCostDetail(project);
model.put("costDetails", budgetCostDetail);
model.put("costTotalAmount", projectBudgetService.getBudgetCostAmount(project));
//项目管理成本明细
List<ProjectBudgetCostProjectManageDetail> budgetCostProjectManageDetail = projectBudgetService.getBudgetCostProjectManageDetail(project);
model.put("costProjectManageDetails", budgetCostProjectManageDetail);
model.put("costProjectManageTotalAmount", projectBudgetService.getBudgetCostProjectManageAmount(project));
List<ProjectBudgetPlanDetail> projectBudgetPlanDetails = projectBudgetService.getProjectBudgetPlanDetails(project);
//资金计划明细
model.put("projectBudgetPlanDetails", projectBudgetPlanDetails);

View File

@ -167,6 +167,12 @@ public class Project {
@Temporal(TemporalType.TIMESTAMP)
private Date lastUpdateTime;
@Column(name = "plan_start_str")
private String planStartStr;
@Column(name = "plan_end_str")
private String planEndStr;
public int getId() {
return id;
}
@ -454,4 +460,20 @@ public class Project {
public String getEndDateYM(){
return DatetimeUtils.toStr(this.endDate,"yyyy-MM");
}
public String getPlanStartStr() {
return planStartStr;
}
public void setPlanStartStr(String planStartStr) {
this.planStartStr = planStartStr;
}
public String getPlanEndStr() {
return planEndStr;
}
public void setPlanEndStr(String planEndStr) {
this.planEndStr = planEndStr;
}
}

View File

@ -1,9 +1,12 @@
package cn.palmte.work.model;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import java.util.List;
public interface ProjectBudgetCostDetailRepository extends JpaRepository<ProjectBudgetCostDetail,Integer> {
List<ProjectBudgetCostDetail> findAllByProjectIdEquals(int id);
}
@Query(value = "select sum(amount) from project_budget_cost_detail where project_id = ?1", nativeQuery = true)
int findAmountByProject(int projectId);}

View File

@ -1,9 +1,13 @@
package cn.palmte.work.model;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import java.util.List;
public interface ProjectBudgetCostProjectManageDetailRepository extends JpaRepository<ProjectBudgetCostProjectManageDetail,Integer> {
List<ProjectBudgetCostProjectManageDetail> findAllByProjectIdEquals(int id);
@Query(value = "select sum(amount) from project_budget_cost_project_manage_detail where project_id = ?1", nativeQuery = true)
int findAmountByProject(int id);
}

View File

@ -1,9 +1,13 @@
package cn.palmte.work.model;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import java.util.List;
public interface ProjectBudgetIncomeDetailRepository extends JpaRepository<ProjectBudgetIncomeDetail,Integer> {
List<ProjectBudgetIncomeDetail> findAllByProjectIdEquals(int id);
@Query(value = "select sum(amount) from project_budget_income_detail where project_id = ?1", nativeQuery = true)
int findAmountByProject(int projectId);
}

View File

@ -214,6 +214,9 @@ public class ProjectBudgetService {
List<ProjectBudgetCostDetail> collectOther = projectBudgetCostDetails.stream().filter(d -> d.getType() == ProjectBudgetCostDetail.TYPE_OHTER).collect(Collectors.toList());
budgetBean.setCostPurchaseOtherTaxInclude(getCostTotalTaxInclude(collectOther));
budgetBean.setCostPurchaseOtherTaxExclude(getCostTotalTaxExclude(collectOther));
budgetBean.setCostPurchaseTotalTaxInclude(getCostTotalTaxInclude(collectDevice).add(getCostTotalTaxInclude(collectBuild)).add(getCostTotalTaxInclude(collectService)).add(getCostTotalTaxInclude(collectOther)));
budgetBean.setCostPurchaseTotalTaxExclude(getCostTotalTaxExclude(collectDevice).add(getCostTotalTaxExclude(collectBuild)).add(getCostTotalTaxExclude(collectService)).add(getCostTotalTaxExclude(collectOther)));
}
//项目管理成本
@ -367,6 +370,12 @@ public class ProjectBudgetService {
public List<ProjectBudgetIncomeDetail> getBudgetIncomeDetail(Project project){
return projectBudgetIncomeDetailRepository.findAllByProjectIdEquals(project.getId());
}
/**
*
*/
public int getBudgetIncomeAmount(Project project){
return projectBudgetIncomeDetailRepository.findAmountByProject(project.getId());
}
/**
*
*/
@ -415,6 +424,12 @@ public class ProjectBudgetService {
public List<ProjectBudgetCostDetail> getBudgetCostDetail(Project project){
return projectBudgetCostDetailRepository.findAllByProjectIdEquals(project.getId());
}
/**
*
*/
public int getBudgetCostAmount(Project project){
return projectBudgetCostDetailRepository.findAmountByProject(project.getId());
}
/**
*
*/
@ -468,7 +483,12 @@ public class ProjectBudgetService {
// return getFixedNotDeletable();
// }
}
/**
*
*/
public int getBudgetCostProjectManageAmount(Project project){
return projectBudgetCostProjectManageDetailRepository.findAmountByProject(project.getId());
}
private List<ProjectBudgetCostProjectManageDetail> getFixedNotDeletable() {
List<ProjectBudgetCostProjectManageDetail> projectManageDetails = new ArrayList<>(6);
for (String fixedProjectManageDetail : fixedProjectManageDetails) {

View File

@ -338,6 +338,9 @@ function arr2ObjectVerify(line, arr, detailPropertyArr, detailProperty) {
var o = detailProperty[detailPropertyArr[i]];
//空但是要求非空
if (!arr[i] && o[0]) {
if (i === detailPropertyArr.length - 1 && detailProperty !== BUDGET_PLAN_DETAIL) {
continue;
}
layuiAlert("第 " + (line + 1) + " 行的 " + o[1] + " 不允许为空");
return null;
}
@ -359,6 +362,9 @@ function arr2ObjectVerifyCheck(line, arr, detailPropertyArr, detailProperty, s)
var o = detailProperty[detailPropertyArr[i]];
//空但是要求非空
if (!arr[i] && o[0]) {
if (i === detailPropertyArr.length - 1 && s !== "项目资金计划表") {
continue;
}
layuiAlert(s + "第 " + (line + 1) + " 行的 " + o[1] + " 不允许为空");
return null;
}
@ -498,6 +504,36 @@ function bindChangeableInput() {
});
}
/**
* 每次更新数量单价和税率时更改总计中含税和不含税总金额
* @param className
* @param totalClassName
*/
function updateTotal(className, totalClassName) {
var total = 0;
//找到本列所有的
$("."+className).each(function (t) {
total += f2($(this).val());
console.log("total2: " + total);
});
$("."+totalClassName).val(f2Fixed(total));
}
/**
* 每次更新数量时更新总计中数量
* @param className
* @param totalClassName
*/
function updateAmount(className, totalClassName) {
var total = 0;
//找到本列所有的
$("."+className).each(function (t) {
console.log(className + ": " + f2($(this).val()));
total += f2($(this).val());
});
$("."+totalClassName).val(total);
}
/**
* 绑定序号
*/

View File

@ -190,26 +190,50 @@ function appendTrCost() {
'</td>'+
'<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost"></td>'+
'<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost""></td>'+
'<td><input type="number" min="0" max="99999999" step="1" maxlength="8" class="am-modal-prompt-input am-modal-prompt-input-cost input-changeable-amount"></td>'+
'<td><input type="text" min="0.00" max="9999999999.99" step="0.01" maxlength="19" class="price am-modal-prompt-input am-modal-prompt-input-cost input-changeable-price"></td>'+
'<td><input type="text" min="0.00" max="99.99" step="0.01" maxlength="5" class="number am-modal-prompt-input am-modal-prompt-input-cost input-changeable-tax-rate"></td>'+
'<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost input-changeable-total-tax-include" readonly></td>'+
'<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost input-changeable-total-tax-exclude" readonly></td>'+
'<td><input type="number" min="0" max="99999999" step="1" maxlength="8" class="am-modal-prompt-input am-modal-prompt-input-cost input-changeable-amount input-changeable-amount-cost"></td>'+
'<td><input type="text" min="0.00" max="9999999999.99" step="0.01" maxlength="19" class="price am-modal-prompt-input am-modal-prompt-input-cost input-changeable-price input-changeable-price-cost"></td>'+
'<td><input type="text" min="0.00" max="99.99" step="0.01" maxlength="5" class="number am-modal-prompt-input am-modal-prompt-input-cost input-changeable-tax-rate input-changeable-tax-rate-cost"></td>'+
'<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost input-changeable-total-tax-include input-changeable-total-tax-include-cost" readonly></td>'+
'<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost input-changeable-total-tax-exclude input-changeable-total-tax-exclude-cost" readonly></td>'+
'<td><button type="button" class="am-btn am-btn-danger am-btn-xs am-round am-modal-line-delete"><span class="am-icon-minus"></span></button></td>'+
'</tr>';
$("#costTable").append(template);
$("#costTotal").before(template);
//重新绑定删除事件和input修改事件
bindDeleteBtn();
//绑定序号
bindNum();
//重新绑定
bindChangeableInput();
//绑定总计值
bindCostTotal();
//绑定采购明细中select联动事件
bindTypeSelectChange();
//绑定数字输入框保留两位小数
bindNumberInput();
}
/**
* 绑定每个可改变的输入框修改后改变对应输入框的值
*/
function bindCostTotal() {
//数量改变
$(".input-changeable-amount-cost").change(function () {
updateAmount("input-changeable-amount-cost", "input-changeable-total-amount-cost");
updateTotal("input-changeable-total-tax-include-cost", "input-changeable-total-total-tax-include-cost");
updateTotal("input-changeable-total-tax-exclude-cost", "input-changeable-total-total-tax-exclude-cost");
});
//单价改变
$(".input-changeable-price-cost").change(function () {
updateTotal("input-changeable-total-tax-include-cost", "input-changeable-total-total-tax-include-cost");
updateTotal("input-changeable-total-tax-exclude-cost", "input-changeable-total-total-tax-exclude-cost");
});
//税率改变
$(".input-changeable-tax-rate-cost").change(function () {
updateTotal("input-changeable-total-tax-exclude-cost", "input-changeable-total-total-tax-exclude-cost");
});
}
/**
* 更新页面收入的数据累加
*/

View File

@ -129,16 +129,34 @@ function appendTrCostProjectManage() {
' <td><button type="button" style="margin-top: 10px" class="am-btn am-btn-danger am-btn-xs am-round am-modal-line-delete"><span class="am-icon-minus"></span></button>' +
' <input type="hidden" class="am-modal-prompt-input am-modal-prompt-input-cost-project-manage" value="1"></td>\n' +
' </tr>';
$("#costProjectManageTable").append(template);
$("#manageTotal").before(template);
//重新绑定删除事件和input修改事件
bindDeleteBtn();
//绑定序号
bindNum();
bindChangeableInputProjectManage();
//绑定总计值
bindCostManageTotal();
bindTypeSelectChangeManager();
//绑定数字输入框保留两位小数
bindNumberInput();
}
/**
* 绑定每个可改变的输入框修改后改变对应输入框的值
*/
function bindCostManageTotal() {
//数量改变
$(".input-changeable-amount-project-manage").change(function () {
updateAmount("input-changeable-amount-project-manage", "input-changeable-total-amount-project-manage");
updateTotal("input-changeable-total-project-manage", "input-changeable-total-total-project-manage");
});
//单价改变
$(".input-changeable-price-project-manage").change(function () {
updateTotal("input-changeable-total-project-manage", "input-changeable-total-total-project-manage");
});
}
/**
* 大类类别联动效果
*/

View File

@ -138,18 +138,40 @@ function appendTrIncome() {
' </td>\n' +
' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-income"></td>\n' +
' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-income"></td>\n' +
' <td><input type="number" min="0" max="99999999" step="1" maxlength="8" class="am-modal-prompt-input am-modal-prompt-input-income input-changeable-amount"></td>\n' +
' <td><input type="text" min="0.00" max="9999999999.99" step="0.01" maxlength="19" class="price am-modal-prompt-input am-modal-prompt-input-income input-changeable-price"></td>\n' +
' <td><input type="text" min="0.00" max="99.99" step="0.01" maxlength="5" class="number am-modal-prompt-input am-modal-prompt-input-income input-changeable-tax-rate"></td>\n' +
' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-income input-changeable-total-tax-include" readonly></td>\n' +
' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-income input-changeable-total-tax-exclude" readonly></td>\n' +
' <td><input type="number" min="0" max="99999999" step="1" maxlength="8" class="am-modal-prompt-input am-modal-prompt-input-income input-changeable-amount input-changeable-amount-income"></td>\n' +
' <td><input type="text" min="0.00" max="9999999999.99" step="0.01" maxlength="19" class="price am-modal-prompt-input am-modal-prompt-input-income input-changeable-price input-changeable-price-income"></td>\n' +
' <td><input type="text" min="0.00" max="99.99" step="0.01" maxlength="5" class="number am-modal-prompt-input am-modal-prompt-input-income input-changeable-tax-rate input-changeable-tax-rate-income"></td>\n' +
' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-income input-changeable-total-tax-include input-changeable-total-tax-include-income" readonly></td>\n' +
' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-income input-changeable-total-tax-exclude input-changeable-total-tax-exclude-income" readonly></td>\n' +
' <td><button type="button" style="margin-top: 10px" class="am-btn am-btn-danger am-btn-xs am-round am-modal-line-delete"><span class="am-icon-minus"></span></button></td>\n' +
' </tr>';
$("#incomeTable").append(template);
$("#incomeTotal").before(template);
//重新绑定删除事件和input修改事件
bindDeleteBtn();
bindNum();
bindChangeableInput();
bindIncomeTotal();
//绑定数字输入框保留两位小数
bindNumberInput();
}
/**
* 绑定每个可改变的输入框修改后改变对应输入框的值
*/
function bindIncomeTotal() {
//数量改变
$(".input-changeable-amount-income").change(function () {
updateAmount("input-changeable-amount-income", "input-changeable-total-amount-income");
updateTotal("input-changeable-total-tax-include-income", "input-changeable-total-total-tax-include-income");
updateTotal("input-changeable-total-tax-exclude-income", "input-changeable-total-total-tax-exclude-income");
});
//单价改变
$(".input-changeable-price-income").change(function () {
updateTotal("input-changeable-total-tax-include-income", "input-changeable-total-total-tax-include-income");
updateTotal("input-changeable-total-tax-exclude-income", "input-changeable-total-total-tax-exclude-income");
});
//税率改变
$(".input-changeable-tax-rate-income").change(function () {
updateTotal("input-changeable-total-tax-exclude-income", "input-changeable-total-total-tax-exclude-income");
});
}

View File

@ -89,6 +89,180 @@ $(function () {
});
});
layui.use('laydate', function(){
var laydate = layui.laydate;
laydate.render({
elem: '#planStartStr',
type: 'month',
btns: ['confirm'],
trigger: 'click',
ready: function(){
console.log($(this.elem).val());
},
done: function() {
var time = $(this.elem).val();
console.log("planStartStr:" + time)
appendMultiplePlan();
$("#planStartDate").val(time);
}
});
});
layui.use('laydate', function(){
var laydate = layui.laydate;
laydate.render({
elem: '#planEndStr',
type: 'month',
btns: ['confirm'],
trigger: 'click',
ready: function(){
console.log($(this.elem).val());
},
done: function() {
var time = $(this.elem).val();
console.log("planEndStr:" + time);
appendMultiplePlan();
$("#planEndDate").val(time);
}
});
});
function appendMultiplePlan() {
var planStartStr = $("#planStartStr").val();
var planEndStr = $("#planEndStr").val();
if (planStartStr !== "" && planEndStr !== "") {
if (planStartStr > planEndStr) {
layuiAlert("开始时间不可大于结束时间");
return;
}
var planStartDate = $("#planStartDate").val();
var planEndDate = $("#planEndDate").val();
var startYear = planStartStr.substring(0, 4);
var startMonth = planStartStr.substring(5, 7);
var totalStartMonth = startYear * 12 + parseInt(startMonth);
var endYear = planEndStr.substring(0, 4);
var endMonth = planEndStr.substring(5, 7);
var totalEndMonth = endYear * 12 + parseInt(endMonth);
var diff = totalEndMonth - totalStartMonth + 1;
var planIndex = 0;
if (planStartDate === "") {
while (planIndex < diff) {
appendTrBudgetPlan();
planIndex++;
}
} else {
if (planEndDate === "") {
while (planIndex < diff) {
appendTrBudgetPlan();
planIndex++;
}
} else {
var startYear2 = planStartDate.substring(0, 4);
var startMonth2 = planStartDate.substring(5, 7);
var totalStartMonth2 = startYear2 * 12 + parseInt(startMonth2);
var endYear2 = planEndDate.substring(0, 4);
var endMonth2 = planEndDate.substring(5, 7);
var totalEndMonth2 = endYear2 * 12 + parseInt(endMonth2);
if (totalStartMonth < totalStartMonth2) {
console.log("增加开始");
diff = totalStartMonth2 - totalStartMonth;
while (planIndex < diff) {
appendTrBudgetPlan2();
planIndex++;
}
} else if (totalStartMonth > totalStartMonth2) {
console.log("减少开始");
$(".input-changeable-month-budget-plan").each(function () {
var cur = $(this).val();
if (cur < planStartStr) {
//删除自己对应的tr
$(this).parent().parent().remove();
delBudgetPlan();
}
});
}
if (totalEndMonth < totalEndMonth2) {
console.log("减少结束");
$(".input-changeable-month-budget-plan").each(function () {
var cur = $(this).val();
if (cur > planEndStr) {
//删除自己对应的tr
$(this).parent().parent().remove();
delBudgetPlan();
}
});
} else if (totalEndMonth > totalEndMonth2) {
console.log("增加结束");
diff = totalEndMonth - totalEndMonth2;
while (planIndex < diff) {
appendTrBudgetPlan();
planIndex++;
}
}
}
}
}
}
/**
* 删除现有项
*/
function delBudgetPlan() {
//还需要更新每一列的合计数据
updateBudgetPlanTotal("input-changeable-device-cost-budget-plan","input-total-device-cost-budget-plan");
updateBudgetPlanTotal("input-changeable-engineer-cost-budget-plan","input-total-engineer-cost-budget-plan");
updateBudgetPlanTotal("input-changeable-project-manage-cost-budget-plan","input-total-project-manage-cost-budget-plan");
updateBudgetPlanTotal("input-changeable-earnest-money-cost-budget-plan","input-total-earnest-money-cost-budget-plan");
updateBudgetPlanTotal("input-changeable-earnest-money-cost-budget-plan","input-total-title-earnest-money-cost-budget-plan");
updateBudgetPlanTotal("input-changeable-total-cost-budget-plan","input-total-total-cost-budget-plan");
updateBudgetPlanTotal("input-changeable-total-cost-budget-plan","input-total-title-total-cost-budget-plan");
updateBudgetPlanTotal("input-changeable-sale-income-budget-plan","input-total-sale-income-budget-plan");
updateBudgetPlanTotal("input-changeable-earnest-money-income-budget-plan","input-total-earnest-money-income-budget-plan");
updateBudgetPlanTotal("input-changeable-earnest-money-income-budget-plan","input-total-title-earnest-money-income-budget-plan");
updateBudgetPlanTotal("input-changeable-total-income-budget-plan","input-total-total-income-budget-plan");
updateBudgetPlanTotal("input-changeable-total-income-budget-plan","input-total-title-total-income-budget-plan");
/*updateBudgetPlanTotal("input-changeable-fund-balance-budget-plan","input-total-fund-balance-budget-plan");*/
updateBudgetPlanTotal("input-changeable-capital-interest-budget-plan","input-total-capital-interest-budget-plan");
updateBudgetPlanTotal("input-changeable-capital-interest-budget-plan","input-total-title-capital-interest-budget-plan");
updateBudgetPlanTotal("input-changeable-underwritten-plan-budget-plan","input-total-underwritten-plan-budget-plan");
updateBudgetPlanTotal("input-changeable-underwritten-plan-budget-plan","input-total-title-underwritten-plan-budget-plan");
updateBudgetPlanTotal("input-changeable-repayment-plan-budget-plan","input-total-repayment-plan-budget-plan");
updateBudgetPlanTotal("input-changeable-repayment-plan-budget-plan","input-total-title-repayment-plan-budget-plan");
updatePageData();
}
/**
*
*/
function bindMonth() {
//找到每个月的资金余额输入框
$(".input-changeable-month-budget-plan").each(function (t) {
//找到前一个月的数据
var prev = $(this).parent().parent().prev("tr").find(".input-changeable-month-budget-plan").val();
if(!prev){
//第一个月
var startDate = $("#planStartStr").val();
$(this).val(startDate.substring(0, 7));
} else {
var year = prev.substring(0, 4);
var month = prev.substring(5, 7);
var totalMonth = year * 12 + parseInt(month) + 1;
var newYear = Math.floor((totalMonth - 1) / 12);
var newMonth = totalMonth % 12;
if (newMonth == 0) {
newMonth = 12;
}
if (newMonth < 10) {
newMonth = "0" + newMonth;
}
$(this).val(newYear + "-" + newMonth);
}
});
}
//保存资金计划表
$(function () {
@ -140,6 +314,11 @@ function verifyBudgetPlan(){
}
}
var planStartStr = $("#planStartStr").val();
var planEndStr = $("#planEndStr").val();
if (planStartStr === "" || planEndStr === "") {
return "请跳入资金计划表中的开始时间和结束时间";
}
var costPurchaseDeviceTaxInclude = inputVal("costPurchaseDeviceTaxInclude");
var costPurchaseBuildTaxInclude = inputVal("costPurchaseBuildTaxInclude");
@ -215,32 +394,36 @@ function appendTrBudgetPlan() {
}
/**
*
* 资金计划增加一行
*/
function bindMonth() {
//找到每个月的资金余额输入框
$(".input-changeable-month-budget-plan").each(function (t) {
//找到前一个月的数据
var prev = $(this).parent().parent().prev("tr").find(".input-changeable-month-budget-plan").val();
if(!prev){
//第一个月
var startDate = $("#startDate").val();
$(this).val(startDate.substring(0, 7));
} else {
var year = prev.substring(0, 4);
var month = prev.substring(5, 7);
var totalMonth = year * 12 + parseInt(month) + 1;
var newYear = Math.floor((totalMonth - 1) / 12);
var newMonth = totalMonth % 12;
if (newMonth == 0) {
newMonth = 12;
}
if (newMonth < 10) {
newMonth = "0" + newMonth;
}
$(this).val(newYear + "-" + newMonth);
}
});
function appendTrBudgetPlan2() {
var template = '<tr style="display: inline-block;">\n' +
' <td style="display: block;"><input type="text" class="am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-month-budget-plan" readonly></td>\n' +
' <td style="display: block;"><input type="text" maxlength="16" value="0.00" class="number am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-device-cost-budget-plan"></td>\n' +
' <td style="display: block;"><input type="text" maxlength="16" value="0.00" class="number am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-engineer-cost-budget-plan"></td>\n' +
' <td style="display: block;"><input type="text" maxlength="16" value="0.00" class="number am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-project-manage-cost-budget-plan"></td>\n' +
' <td style="display: block;"><input type="text" maxlength="16" value="0.00" class="number am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-earnest-money-cost-budget-plan"></td>\n' +
' <td style="display: block;"><input type="text" value="0.00" class="number am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-total-cost-budget-plan" readonly></td>\n' +
' <td style="display: block;"><input type="text" maxlength="16" value="0.00" class="number am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-sale-income-budget-plan"></td>\n' +
' <td style="display: block;"><input type="text" maxlength="16" value="0.00" class="number am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-earnest-money-income-budget-plan"></td>\n' +
' <td style="display: block;"><input type="text" value="0.00" class="number am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-total-income-budget-plan" readonly></td>\n' +
' <td style="display: block;"><input type="text" class="number am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-fund-balance-budget-plan" readonly></td>\n' +
' <td style="display: block;"><input type="text" class="number am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-capital-interest-budget-plan" readonly></td>\n' +
' <td style="display: block;"><input type="text" class="number am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-underwritten-plan-budget-plan" readonly></td>\n' +
' <td style="display: block;"><input type="text" class="number am-modal-prompt-input am-modal-prompt-input-budget-plan-detail input-changeable-repayment-plan-budget-plan" readonly></td>\n' +
' <td style="display: block;"><button type="button" class="am-btn am-btn-danger am-btn-xs am-round am-modal-line-delete-budget-plan"><span class="am-icon-minus"></span></button></td>\n' +
' </tr>';
$("#firstBlock").after(template);
//根据前一条数据拿到月份
bindMonth();
//新增的收入与支出默认为0并更新每一列的数据
bindBudgetPlanUpdate();
//重新绑定删除事件和input修改事件
bindBudgetPlanDeleteBtn();
//绑定资金计划明细输入框
bindChangeableInputBudgetPlanDetail();
//绑定数字输入框保留两位小数
bindNumberInput();
}
// /**
@ -293,8 +476,16 @@ function bindBudgetPlanUpdate() {
*/
function bindBudgetPlanDeleteBtn() {
$(".am-modal-line-delete-budget-plan").click(function () {
//删除自己对应的tr
$(this).parent().parent().remove();
// //删除自己对应的tr
// $(this).parent().parent().remove();
$(this).parent().parent().find(".input-changeable-device-cost-budget-plan").val(f2Fixed(0));
$(this).parent().parent().find(".input-changeable-engineer-cost-budget-plan").val(f2Fixed(0));
$(this).parent().parent().find(".input-changeable-project-manage-cost-budget-plan").val(f2Fixed(0));
$(this).parent().parent().find(".input-changeable-earnest-money-cost-budget-plan").val(f2Fixed(0));
$(this).parent().parent().find(".input-changeable-total-cost-budget-plan").val(f2Fixed(0));
$(this).parent().parent().find(".input-changeable-sale-income-budget-plan").val(f2Fixed(0));
$(this).parent().parent().find(".input-changeable-earnest-money-income-budget-plan").val(f2Fixed(0));
$(this).parent().parent().find(".input-changeable-total-income-budget-plan").val(f2Fixed(0));
//还需要更新每一列的合计数据
updateBudgetPlanTotal("input-changeable-device-cost-budget-plan","input-total-device-cost-budget-plan");
updateBudgetPlanTotal("input-changeable-engineer-cost-budget-plan","input-total-engineer-cost-budget-plan");
@ -316,8 +507,6 @@ function bindBudgetPlanDeleteBtn() {
updateBudgetPlanTotal("input-changeable-repayment-plan-budget-plan","input-total-repayment-plan-budget-plan");
updateBudgetPlanTotal("input-changeable-repayment-plan-budget-plan","input-total-title-repayment-plan-budget-plan");
//根据前一条数据拿到月份
bindMonth();
updatePageData();
});

View File

@ -397,15 +397,27 @@
</td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-income" value="${incomeDetail.name!}"></td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-income" value="${incomeDetail.unit!}"></td>
<td><input type="number" min="0" max="99999999" step="1" maxlength="8" class="am-modal-prompt-input am-modal-prompt-input-income input-changeable-amount" value="${incomeDetail.amount!0}" oninput="if(value.length>8)value=value.slice(0,8)" <#--onkeyup="integerNumber(this)"-->></td>
<td><input type="text" maxlength="19" class="price am-modal-prompt-input am-modal-prompt-input-income input-changeable-price" value="${Utils.format2(incomeDetail.price,'0')}" oninput="if(value.length>19)value=value.slice(0,19)"></td>
<td><input type="text" maxlength="5" class="number am-modal-prompt-input am-modal-prompt-input-income input-changeable-tax-rate" value="${Utils.format(incomeDetail.taxRate,'0')}" oninput="if(value.length>5)value=value.slice(0,5)"></td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-income input-changeable-total-tax-include" value="${Utils.format(incomeDetail.totalTaxInclude,'0')}" readonly></td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-income input-changeable-total-tax-exclude" value="${Utils.format(incomeDetail.totalTaxExclude,'0')}" readonly></td>
<td><input type="number" min="0" max="99999999" step="1" maxlength="8" class="am-modal-prompt-input am-modal-prompt-input-income input-changeable-amount input-changeable-amount-income" value="${incomeDetail.amount!0}" oninput="if(value.length>8)value=value.slice(0,8)" <#--onkeyup="integerNumber(this)"-->></td>
<td><input type="text" maxlength="19" class="price am-modal-prompt-input am-modal-prompt-input-income input-changeable-price input-changeable-price-income" value="${Utils.format2(incomeDetail.price,'0')}" oninput="if(value.length>19)value=value.slice(0,19)"></td>
<td><input type="text" maxlength="5" class="number am-modal-prompt-input am-modal-prompt-input-income input-changeable-tax-rate input-changeable-tax-rate-income" value="${Utils.format(incomeDetail.taxRate,'0')}" oninput="if(value.length>5)value=value.slice(0,5)"></td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-income input-changeable-total-tax-include input-changeable-total-tax-include-income" value="${Utils.format(incomeDetail.totalTaxInclude,'0')}" readonly></td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-income input-changeable-total-tax-exclude input-changeable-total-tax-exclude-income" value="${Utils.format(incomeDetail.totalTaxExclude,'0')}" readonly></td>
<td><button type="button" style="margin-top: 10px" class="am-btn am-btn-danger am-btn-xs am-round am-modal-line-delete"><span class="am-icon-minus"></span></button></td>
</tr>
</#list>
</#if>
<tr class="total-new" id="incomeTotal">
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-income" value="" readonly></td>
<td><input style="width: 80px;float: left;" type="text" class="am-modal-prompt-input am-modal-prompt-input-income" value="总计" readonly></td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-income" value="" readonly></td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-income" value="" readonly></td>
<td><input type="number" class="am-modal-prompt-input am-modal-prompt-input-income input-changeable-total-amount-income" value="${incomeTotalAmount!0}" readonly <#--onkeyup="integerNumber(this)"-->></td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-income" value="" readonly></td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-income" value="" readonly></td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-income input-changeable-total-total-tax-include-income" value="${Utils.format(budgetBean.incomeTotalTaxInclude,'0')}" readonly></td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-income input-changeable-total-total-tax-exclude-income" value="${Utils.format(budgetBean.incomeTotalTaxExclude,'0')}" readonly></td>
<td></td>
</tr>
</tbody>
</table>
@ -466,15 +478,28 @@
</td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost" value="${costDetail.name!}"></td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost" value="${costDetail.unit!}"></td>
<td><input type="number" min="0" max="99999999" step="1" maxlength="8" class="am-modal-prompt-input am-modal-prompt-input-cost input-changeable-amount" value="${costDetail.amount!0}" oninput="if(value.length>8)value=value.slice(0,8)" <#--onkeyup="integerNumber(this)"-->></td>
<td><input type="text" maxlength="19" class="price am-modal-prompt-input am-modal-prompt-input-cost input-changeable-price" value="${Utils.format2(costDetail.price,'0')}" oninput="if(value.length>19)value=value.slice(0,19)"></td>
<td><input type="text" maxlength="5" class="number am-modal-prompt-input am-modal-prompt-input-cost input-changeable-tax-rate" value="${Utils.format(costDetail.taxRate,'0')}" oninput="if(value.length>5)value=value.slice(0,5)"></td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost input-changeable-total-tax-include" value="${Utils.format(costDetail.totalTaxInclude,'0')}" readonly></td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost input-changeable-total-tax-exclude" value="${Utils.format(costDetail.totalTaxExclude,'0')}" readonly></td>
<td><input type="number" min="0" max="99999999" step="1" maxlength="8" class="am-modal-prompt-input am-modal-prompt-input-cost input-changeable-amount input-changeable-amount-cost" value="${costDetail.amount!0}" oninput="if(value.length>8)value=value.slice(0,8)" <#--onkeyup="integerNumber(this)"-->></td>
<td><input type="text" maxlength="19" class="price am-modal-prompt-input am-modal-prompt-input-cost input-changeable-price input-changeable-price-cost" value="${Utils.format2(costDetail.price,'0')}" oninput="if(value.length>19)value=value.slice(0,19)"></td>
<td><input type="text" maxlength="5" class="number am-modal-prompt-input am-modal-prompt-input-cost input-changeable-tax-rate input-changeable-tax-rate-cost" value="${Utils.format(costDetail.taxRate,'0')}" oninput="if(value.length>5)value=value.slice(0,5)"></td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost input-changeable-total-tax-include input-changeable-total-tax-include-cost" value="${Utils.format(costDetail.totalTaxInclude,'0')}" readonly></td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost input-changeable-total-tax-exclude input-changeable-total-tax-exclude-cost" value="${Utils.format(costDetail.totalTaxExclude,'0')}" readonly></td>
<td><button type="button" style="margin-top: 10px" class="am-btn am-btn-danger am-btn-xs am-round am-modal-line-delete"><span class="am-icon-minus"></span></button></td>
</tr>
</#list>
</#if>
<tr class="total-new" id="costTotal">
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost" value="" readonly></td>
<td><input style="width: 80px;float: left;" type="text" class="am-modal-prompt-input am-modal-prompt-input-cost" value="总计" readonly></td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost" value="" readonly></td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost" value="" readonly></td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost" value="" readonly></td>
<td><input type="number" class="am-modal-prompt-input am-modal-prompt-input-cost input-changeable-total-amount-cost" value="${costTotalAmount!0}" readonly <#--onkeyup="integerNumber(this)"-->></td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost" value="" readonly></td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost" value="" readonly></td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost input-changeable-total-total-tax-include-cost" value="${Utils.format(budgetBean.costPurchaseTotalTaxInclude,'0')}" readonly></td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost input-changeable-total-total-tax-exclude-cost" value="${Utils.format(budgetBean.costPurchaseTotalTaxExclude,'0')}" readonly></td>
<td></td>
</tr>
</tbody>
</table>
@ -548,6 +573,20 @@
</tr>
</#list>
</#if>
<tr class="total-new" id="manageTotal">
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost-project-manage" value="" readonly></td>
<td><input style="width: 80px;float: left;" type="text" class="am-modal-prompt-input am-modal-prompt-input-cost-project-manage" value="总计" readonly></td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost-project-manage" value="" readonly></td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost-project-manage" value="" readonly></td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost-project-manage" value="" readonly></td>
<td><input type="number" class="am-modal-prompt-input am-modal-prompt-input-cost-project-manage input-changeable-total-amount-project-manage" value="${costProjectManageTotalAmount!0}" readonly <#--onkeyup="integerNumber(this)"-->></td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost-project-manage" value="" readonly></td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost-project-manage input-changeable-total-total-project-manage" value="${Utils.format(budgetBean.costProjectManageTaxInclude,'0')}" readonly></td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost-project-manage" value="" readonly></td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost-project-manage" value="" readonly></td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost-project-manage" value="" readonly></td>
<td></td>
</tr>
</tbody>
</table>
@ -563,6 +602,21 @@
<div class="am-tabs-bd">
<div class="am-tab-panel am-fade am-in" id="tab6">
<div class="am-modal-bd">
<input type="hidden" id="planStartDate" name="planStartDate" value='${planStartDate!""}'/>
<input type="hidden" id="planEndDate" name="planEndDate" value='${planEndDate!""}'/>
<td width="700px">
<div class="am-u-sm-10">
<div class="am-form am-form-inline">
<div class="am-form-group am-form-icon">
<input type="text" id="planStartStr" name="planStartStr" placeholder="开始日期(请选择)" autocomplete="off" readonly value="${planStartStr!}">
</div>
<div class="am-form-group">至</div>
<div class="am-form-group am-form-icon">
<input type="text" id="planEndStr" name="planEndStr" placeholder="结束日期(请选择)" autocomplete="off" readonly value="${planEndStr!}">
</div>
</div>
</div>
</td>
<table class="am-table table-main" style="display: block;border-collapse: collapse;width: 1700px;overflow-x: scroll;padding:0;" id="budgetPlanDetailTable">
<thead style="display: inline-block;overflow-x: scroll;width: 200px;">
<tr style="display: inline-block;">
@ -599,7 +653,7 @@
<td style="display: block;"><input type="text" class="number am-modal-prompt-input input-total-title-repayment-plan-budget-plan" value="${Utils.format(projectBudgetPlanDetailTotalTitle.repaymentPlan)}" readonly/></td>
<td style="display: block;border-top: 1px solid #ddd;"><button type="button" class="am-btn am-btn-xs am-round am-modal-line-delete-budget-plan" disabled="disabled"><span class="am-icon-minus"></span></button></td>
</tr>
<tr class="am-hide" style="display: inline-block;">
<tr id="firstBlock" class="am-hide" style="display: inline-block;">
<td style="display: block;"><input type="text" class="am-modal-prompt-input input-total-month-budget-plan" value="${projectBudgetPlanDetailTotal.month}" readonly/></td>
<td style="display: block;"><input type="text" class="number am-modal-prompt-input input-total-device-cost-budget-plan" value="${Utils.format(projectBudgetPlanDetailTotal.deviceCost)}" readonly/></td>
<td style="display: block;"><input type="text" class="number am-modal-prompt-input input-total-engineer-cost-budget-plan" value="${Utils.format(projectBudgetPlanDetailTotal.engineerCost)}" readonly/></td>
@ -639,7 +693,7 @@
</tbody>
</table>
<button type="button" id="budgetPlanDetailAddBtn" 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>-->
<table class="am-table am-table-bordered am-table-radius table-main" style="padding:0;">
<tbody>