项目编辑概算信息

master
xxssyyyyssxx 2021-11-01 21:09:10 +08:00
parent afc2e5cd49
commit 412dd5de76
9 changed files with 684 additions and 16 deletions

View File

@ -57,14 +57,30 @@ public class ProjectController extends BaseController{
Dept one = deptRepository.findOne(1);
model.put("dept",one);
return "admin/project_estimate_input";
return "admin/project_estimate_add";
}
@RequestMapping("/estimateSave")
public String estimateSave(Project project, EstimateBean estimateBean,
@RequestMapping("/estimateAddSave")
public String estimateAddSave(Project project, EstimateBean estimateBean,
Map<String, Object> model) {
projectService.estimateSave(project, estimateBean, InterfaceUtil.getAdmin());
projectService.estimateAddSave(project, estimateBean, InterfaceUtil.getAdmin());
return "redirect:/project/list";
}
@RequestMapping("/edit")
public String edit(@RequestParam("id") int id,Map<String, Object> model) {
Project project = projectService.getProject(id);
model.put("project", project);
EstimateBean estimateBean = projectService.estimate(project);
model.put("estimateBean", estimateBean);
return "admin/project_estimate_edit";
}
@RequestMapping("/estimateEditSave")
public String estimateEditSave(Project project, EstimateBean estimateBean,
Map<String, Object> model) {
projectService.estimateEditSave(project, estimateBean, InterfaceUtil.getAdmin());
return "redirect:/project/list";
}
@RequestMapping("/estimateSaveAndApprove")
public String estimateSaveAndApprove(Map<String, Object> model) {
return "redirect:/project/list";

View File

@ -24,8 +24,8 @@ public class ProjectEstimateCostManage {
private int type;
@Column(name = "income_tax_exclude")
private BigDecimal incomeTaxExclude;
@Column(name = "cost_tax_exclude")
private BigDecimal costTaxExclude;
public Integer getId() {
return id;
@ -51,11 +51,11 @@ public class ProjectEstimateCostManage {
this.type = type;
}
public BigDecimal getIncomeTaxExclude() {
return incomeTaxExclude;
public BigDecimal getCostTaxExclude() {
return costTaxExclude;
}
public void setIncomeTaxExclude(BigDecimal incomeTaxExclude) {
this.incomeTaxExclude = incomeTaxExclude;
public void setCostTaxExclude(BigDecimal costTaxExclude) {
this.costTaxExclude = costTaxExclude;
}
}

View File

@ -2,5 +2,8 @@ package cn.palmte.work.model;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
public interface ProjectEstimateCostManageRepository extends JpaRepository<ProjectEstimateCostManage,Integer> {
List<ProjectEstimateCostManage> findAllByProjectIdEquals(int id);
}

View File

@ -2,5 +2,8 @@ package cn.palmte.work.model;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
public interface ProjectEstimateCostRepository extends JpaRepository<ProjectEstimateCost,Integer> {
List<ProjectEstimateCost> findAllByProjectIdEquals(int id);
}

View File

@ -2,5 +2,8 @@ package cn.palmte.work.model;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
public interface ProjectEstimateIncomeRepository extends JpaRepository<ProjectEstimateIncome,Integer> {
List<ProjectEstimateIncome> findAllByProjectIdEquals(int id);
}

View File

@ -7,13 +7,17 @@ import cn.palmte.work.bean.TypeEnum;
import cn.palmte.work.model.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import top.jfunc.common.db.QueryHelper;
import top.jfunc.common.db.bean.Page;
import top.jfunc.common.db.utils.Pagination;
import top.jfunc.common.utils.CollectionUtil;
import top.jfunc.common.utils.StrUtil;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author xiongshiyan at 2021/10/29 , contact me with email yanshixiong@126.com or phone 15208384257
@ -82,9 +86,10 @@ public class ProjectService {
}
/**
*
*
*/
public Project estimateSave(Project project, EstimateBean estimateBean, Admin admin) {
@Transactional(rollbackFor = RuntimeException.class)
public Project estimateAddSave(Project project, EstimateBean estimateBean, Admin admin) {
project.setTypeDesc(TypeEnum.parseType(project.getType()).getTypeDesc());
project.setStatusDesc(StatusEnum.parseStatus(project.getStatus()).getStatusDesc());
project.setApproveStatus(ApproveStatusEnum.APPROVAL_PENDING.getApproveStatus());
@ -114,6 +119,36 @@ public class ProjectService {
return project;
}
private void clearEstimate(Project project){
List<ProjectEstimateIncome> incomes = projectEstimateIncomeRepository.findAllByProjectIdEquals(project.getId());
if(CollectionUtil.isNotEmpty(incomes)){
projectEstimateIncomeRepository.deleteInBatch(incomes);
}
List<ProjectEstimateCost> costs = projectEstimateCostRepository.findAllByProjectIdEquals(project.getId());
if(CollectionUtil.isNotEmpty(costs)){
projectEstimateCostRepository.deleteInBatch(costs);
}
List<ProjectEstimateCostManage> costManages = projectEstimateCostManageRepository.findAllByProjectIdEquals(project.getId());
if(CollectionUtil.isNotEmpty(costManages)){
projectEstimateCostManageRepository.deleteInBatch(costManages);
}
}
/**
*
*/
@Transactional(rollbackFor = RuntimeException.class)
public Project estimateEditSave(Project project, EstimateBean estimateBean, Admin admin) {
//删除原来的
projectRepository.delete(project.getId());
//清空概算信息
clearEstimate(project);
return estimateAddSave(project, estimateBean, admin);
}
private void cost(Project project, EstimateBean estimateBean) {
ProjectEstimateCost projectEstimateCostDevice = new ProjectEstimateCost();
projectEstimateCostDevice.setProjectId(project.getId());
@ -169,13 +204,13 @@ public class ProjectService {
ProjectEstimateCostManage projectEstimateCostZijin = new ProjectEstimateCostManage();
projectEstimateCostZijin.setProjectId(project.getId());
projectEstimateCostZijin.setType(1);
projectEstimateCostZijin.setIncomeTaxExclude(estimateBean.getCostCompanyManageTaxExclude());
projectEstimateCostZijin.setCostTaxExclude(estimateBean.getCostExpropriationTaxExclude());
projectEstimateCostManageRepository.saveAndFlush(projectEstimateCostZijin);
ProjectEstimateCostManage projectEstimateCostManage = new ProjectEstimateCostManage();
projectEstimateCostManage.setProjectId(project.getId());
projectEstimateCostManage.setType(2);
projectEstimateCostManage.setIncomeTaxExclude(estimateBean.getCostCompanyManageTaxExclude());
projectEstimateCostManage.setCostTaxExclude(estimateBean.getCostCompanyManageTaxExclude());
projectEstimateCostManageRepository.saveAndFlush(projectEstimateCostManage);
}
private void income(Project project, EstimateBean estimateBean) {
@ -200,4 +235,59 @@ public class ProjectService {
projectEstimateIncomeService.setIncomeTaxExclude(estimateBean.getIncomeServiceTaxExclude());
projectEstimateIncomeRepository.saveAndFlush(projectEstimateIncomeService);
}
public Project getProject(int id) {
return projectRepository.findOne(id);
}
public EstimateBean estimate(Project project) {
EstimateBean estimateBean = new EstimateBean();
List<ProjectEstimateIncome> incomes = projectEstimateIncomeRepository.findAllByProjectIdEquals(project.getId());
ProjectEstimateIncome projectEstimateIncomeDevice = incomes.stream().filter(d -> d.getType() == 1).collect(Collectors.toList()).get(0);
estimateBean.setIncomeDeviceTaxInclude(projectEstimateIncomeDevice.getIncomeTaxInclude());
estimateBean.setIncomeDeviceTaxExclude(projectEstimateIncomeDevice.getIncomeTaxExclude());
ProjectEstimateIncome projectEstimateIncomeEngineer = incomes.stream().filter(d -> d.getType() == 2).collect(Collectors.toList()).get(0);
estimateBean.setIncomeEngineerTaxInclude(projectEstimateIncomeEngineer.getIncomeTaxInclude());
estimateBean.setIncomeEngineerTaxExclude(projectEstimateIncomeEngineer.getIncomeTaxExclude());
ProjectEstimateIncome projectEstimateIncomeService = incomes.stream().filter(d -> d.getType() == 3).collect(Collectors.toList()).get(0);
estimateBean.setIncomeServiceTaxInclude(projectEstimateIncomeService.getIncomeTaxInclude());
estimateBean.setIncomeServiceTaxExclude(projectEstimateIncomeService.getIncomeTaxExclude());
List<ProjectEstimateCost> costs = projectEstimateCostRepository.findAllByProjectIdEquals(project.getId());
ProjectEstimateCost projectEstimateCostDevice = costs.stream().filter(d -> d.getType() == 1).collect(Collectors.toList()).get(0);
estimateBean.setCostPurchaseDeviceTaxInclude(projectEstimateCostDevice.getCostTaxInclude());
estimateBean.setCostPurchaseDeviceTaxExclude(projectEstimateCostDevice.getCostTaxExclude());
ProjectEstimateCost projectEstimateCostBuild = costs.stream().filter(d -> d.getType() == 2).collect(Collectors.toList()).get(0);
estimateBean.setCostPurchaseBuildTaxInclude(projectEstimateCostBuild.getCostTaxInclude());
estimateBean.setCostPurchaseBuildTaxExclude(projectEstimateCostBuild.getCostTaxExclude());
ProjectEstimateCost projectEstimateCostService = costs.stream().filter(d -> d.getType() == 3).collect(Collectors.toList()).get(0);
estimateBean.setCostPurchaseServiceTaxInclude(projectEstimateCostService.getCostTaxInclude());
estimateBean.setCostPurchaseServiceTaxExclude(projectEstimateCostService.getCostTaxExclude());
ProjectEstimateCost projectEstimateCostOther = costs.stream().filter(d -> d.getType() == 4).collect(Collectors.toList()).get(0);
estimateBean.setCostPurchaseOtherTaxInclude(projectEstimateCostOther.getCostTaxInclude());
estimateBean.setCostPurchaseOtherTaxExclude(projectEstimateCostOther.getCostTaxExclude());
ProjectEstimateCost projectEstimateCostProjectManage = costs.stream().filter(d -> d.getType() == 5).collect(Collectors.toList()).get(0);
estimateBean.setCostProjectManageTaxInclude(projectEstimateCostProjectManage.getCostTaxInclude());
estimateBean.setCostProjectManageTaxExclude(projectEstimateCostProjectManage.getCostTaxExclude());
ProjectEstimateCost projectEstimateCostOtherOther = costs.stream().filter(d -> d.getType() == 6).collect(Collectors.toList()).get(0);
estimateBean.setCostOtherOtherTaxInclude(projectEstimateCostOtherOther.getCostTaxInclude());
estimateBean.setCostOtherOtherTaxExclude(projectEstimateCostOtherOther.getCostTaxExclude());
List<ProjectEstimateCostManage> manages = projectEstimateCostManageRepository.findAllByProjectIdEquals(project.getId());
ProjectEstimateCostManage costManageExpropriation = manages.stream().filter(d -> d.getType() == 1).collect(Collectors.toList()).get(0);
estimateBean.setCostExpropriationTaxExclude(costManageExpropriation.getCostTaxExclude());
ProjectEstimateCostManage costManageCompany = manages.stream().filter(d -> d.getType() == 2).collect(Collectors.toList()).get(0);
estimateBean.setCostCompanyManageTaxExclude(costManageCompany.getCostTaxExclude());
return estimateBean;
}
}

View File

@ -8,7 +8,7 @@
<div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">项目概算表</strong> / <small></small></div>
</div>
<form method="post" class="am-form" id="pmsForm" action="${base}/project/estimateSave">
<form method="post" class="am-form" id="pmsForm" action="${base}/project/estimateAddSave">
<!--选项卡tabsbegin-->
<div class="am-tabs am-margin" data-am-tabs>
<ul class="am-tabs-nav am-nav am-nav-tabs">

View File

@ -0,0 +1,543 @@
<#assign base=request.contextPath />
<#import "../common/defaultLayout.ftl" as defaultLayout>
<@defaultLayout.layout>
<div class="admin-content">
<div class="admin-content-body">
<div class="am-cf am-padding">
<div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">项目概算表</strong> / <small>${project.name}</small></div>
</div>
<form method="post" class="am-form" id="pmsForm" action="${base}/project/estimateEditSave">
<!--选项卡tabsbegin-->
<div class="am-tabs am-margin" data-am-tabs>
<ul class="am-tabs-nav am-nav am-nav-tabs">
<li class="am-active"><a href="#tab1">项目基本信息</a></li>
<li><a href="#tab2">项目详细信息</a></li>
</ul>
<div class="am-tabs-bd">
<div class="am-tab-panel am-fade am-in am-active" id="tab1">
<input name="id" id="id" type="hidden" value="${project.id}" />
<!--验证表单元素validate) begin-->
<div class="am-g am-form-group am-margin-top">
<div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>部门名称</div>
<div class="am-u-sm-6 am-u-md-6">
<span>${project.deptName}</span>
</div>
<div class="am-u-sm-2 am-u-md-4 input-msg"></div>
</div>
<div class="am-g am-form-group am-margin-top">
<div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>项目计划开始时间</div>
<div class="am-u-sm-2 am-u-md-2">
<div class="am-form-group am-form-icon">
<i class="am-icon-calendar"></i>
<input type="text" class="am-form-field am-input-sm" id="startDate"
name="startDate" autocomplete="off"
value="${project.startDate}" placeholder="项目计划开始时间"
data-am-datepicker>
</div>
</div>
<div class="am-u-sm-2 am-u-md-4 input-msg"></div>
</div>
<div class="am-g am-form-group am-margin-top">
<div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>项目计划结束时间</div>
<div class="am-u-sm-2 am-u-md-2">
<div class="am-form-group am-form-icon">
<i class="am-icon-calendar"></i>
<input type="text" class="am-form-field am-input-sm" id="endDate"
name="endDate" autocomplete="off"
value="${project.endDate}" placeholder="项目计划结束时间"
data-am-datepicker>
</div>
</div>
<div class="am-u-sm-2 am-u-md-4 input-msg"></div>
</div>
<div class="am-g am-form-group am-margin-top">
<div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>项目名称</div>
<div class="am-u-sm-6 am-u-md-6">
<input type="text" class="am-input" data-validate-async data-validation-message="请输入项目名称20字符以内"
name="name" placeholder="请输入项目名称20字符以内" maxlength="20"
value="${project.name}" required />
</div>
<div class="am-u-sm-2 am-u-md-4 input-msg"></div>
</div>
<div class="am-g am-form-group am-margin-top">
<div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>项目类型</div>
<div class="am-u-sm-6 am-u-md-6">
<select data-am-selected id="type" name="type">
<option value="1" <#if project.type=1>selected</#if>>工程集成类</option>
<option value="2" <#if project.type=2>selected</#if>>设备集成类</option>
<option value="3" <#if project.type=3>selected</#if>>战略合作类</option>
</select>
</div>
<div class="am-u-sm-2 am-u-md-4 input-msg"></div>
</div>
<div class="am-g am-form-group am-margin-top">
<div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>垫资模式</div>
<div class="am-u-sm-6 am-u-md-6">
<select data-am-selected id="underwrittenMode" name="underwrittenMode">
<option value="1" <#if project.underwrittenMode=1>selected</#if>>A类-不垫资(战略合作)</option>
<option value="2" <#if project.underwrittenMode=2>selected</#if>>B类-不垫资(背靠背)</option>
<option value="3" <#if project.underwrittenMode=3>selected</#if>>C类-垫资(账期覆盖)</option>
<option value="4" <#if project.underwrittenMode=4>selected</#if>>D类-垫资(账期不覆盖)</option>
</select>
</div>
<div class="am-u-sm-2 am-u-md-4 input-msg"></div>
</div>
<div class="am-g am-form-group am-margin-top">
<div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>客户名称</div>
<div class="am-u-sm-6 am-u-md-6">
<input type="text" class="am-input" data-validate-async data-validation-message="请输入客户名称20字符以内"
name="customer" placeholder="请输入客户名称20字符以内" maxlength="20"
value="${project.customer}" required />
</div>
<div class="am-u-sm-2 am-u-md-4 input-msg"></div>
</div>
<div class="am-g am-form-group am-margin-top">
<div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>终端客户名称</div>
<div class="am-u-sm-6 am-u-md-6">
<input type="text" class="am-input" data-validate-async data-validation-message="请输入终端客户名称20字符以内"
name="terminalCustomer" placeholder="请输入终端客户名称20字符以内" maxlength="20"
value="${project.terminalCustomer}" required />
</div>
<div class="am-u-sm-2 am-u-md-4 input-msg"></div>
</div>
<div class="am-g am-form-group am-margin-top">
<div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>垫资利息</div>
<div class="am-u-sm-6 am-u-md-6">
<input type="number" class="am-input" data-validate-async data-validation-message="请输入垫资利息"
name="advanceInterestAmount" placeholder="单位(元)" maxlength="20"
value="${project.advanceInterestAmount}" required />
</div>
<div class="am-u-sm-2 am-u-md-4 input-msg"></div>
</div>
<div class="am-g am-form-group am-margin-top">
<div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>垫资峰值</div>
<div class="am-u-sm-6 am-u-md-6">
<input type="number" class="am-input" data-validate-async data-validation-message="请输入垫资峰值"
name="advancePeakAmount" placeholder="单位(元)" maxlength="20"
value="${project.advancePeakAmount}" required />
</div>
<div class="am-u-sm-2 am-u-md-4 input-msg"></div>
</div>
<div class="am-g am-form-group am-margin-top">
<div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>合同金额</div>
<div class="am-u-sm-6 am-u-md-6">
<input type="number" class="am-input" data-validate-async data-validation-message="请输入合同金额"
name="contractAmount" placeholder="单位(元)" maxlength="20"
value="${project.contractAmount}" required />
</div>
<div class="am-u-sm-2 am-u-md-4 input-msg"></div>
</div>
<div class="am-g am-form-group am-margin-top">
<div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>行业场景应用</div>
<div class="am-u-sm-6 am-u-md-6">
<input type="text" class="am-input" data-validate-async data-validation-message="请输入行业场景应用"
name="industryScenario" placeholder="请输入行业场景应用" maxlength="20"
value="${project.industryScenario}" required />
</div>
<div class="am-u-sm-2 am-u-md-4 input-msg"></div>
</div>
<div class="am-g am-form-group am-margin-top">
<div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>华智产品金额</div>
<div class="am-u-sm-6 am-u-md-6">
<input type="number" class="am-input" data-validate-async data-validation-message="华智产品金额"
name="huazhiProductAmount" placeholder="单位(元)" maxlength="20"
value="${project.huazhiProductAmount!}" />
</div>
<div class="am-u-sm-2 am-u-md-4 input-msg"></div>
</div>
<div class="am-g am-form-group am-margin-top">
<div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>紫光其他产品金额</div>
<div class="am-u-sm-6 am-u-md-6">
<input type="number" class="am-input" data-validate-async data-validation-message="请输入紫光其他产品金额"
name="ziguangOtherAmount" placeholder="单位(元)" maxlength="20"
value="${project.ziguangOtherAmount!}" />
</div>
<div class="am-u-sm-2 am-u-md-4 input-msg"></div>
</div>
<div class="am-g am-form-group am-margin-top">
<div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>主合同收款条款</div>
<div class="am-u-sm-6 am-u-md-6">
<input type="text" class="am-input" data-validate-async data-validation-message="请输入收款条款"
name="mainContractCollectionTerms" placeholder="请输入收款条款" maxlength="20"
value="${project.mainContractCollectionTerms}" required />
</div>
<div class="am-u-sm-2 am-u-md-4 input-msg"></div>
</div>
</div>
<!--验证表单元素validate end-->
</div>
<div class="am-tabs-bd">
<div class="am-tab-panel am-fade am-in" id="tab2">
<span class="am-text-xl">收入</span>
<table class="am-table am-table-bordered am-table-radius table-main" style="padding:0;">
<tbody>
<tr class="am-text-xl">
<td>类别</td>
<td>费用</td>
<td>含税金额(元)</td>
<td>不含税金额(元)</td>
</tr>
<tr>
<td>收入</td>
<td>设备类</td>
<td><input name="incomeDeviceTaxInclude" value="${estimateBean.incomeDeviceTaxInclude}" required></td>
<td><input name="incomeDeviceTaxExclude" value="${estimateBean.incomeDeviceTaxExclude}" required></td>
</tr>
<tr>
<td>收入</td>
<td>工程类</td>
<td><input name="incomeEngineerTaxInclude" value="${estimateBean.incomeEngineerTaxInclude}" required></td>
<td><input name="incomeEngineerTaxExclude" value="${estimateBean.incomeEngineerTaxExclude}" required></td>
</tr>
<tr>
<td>收入</td>
<td>服务类</td>
<td><input name="incomeServiceTaxInclude" value="${estimateBean.incomeServiceTaxInclude}" required></td>
<td><input name="incomeServiceTaxExclude" value="${estimateBean.incomeServiceTaxExclude}" required></td>
</tr>
<tr>
<td>合计</td>
<td></td>
<td><input name="incomeTotalTaxInclude" value="${estimateBean.incomeTotalTaxInclude}" readonly></td>
<td><input name="incomeTotalTaxExclude" value="${estimateBean.incomeTotalTaxExclude}" readonly></td>
</tr>
</tbody>
</table>
<span class="am-text-xl">成本</span>
<table class="am-table am-table-bordered am-table-radius table-main" style="padding:0;">
<tbody>
<tr class="am-text-xl">
<td>类别</td>
<td>费用</td>
<td>费用项目</td>
<td>含税金额(元)</td>
<td>不含税金额(元)</td>
</tr>
<tr>
<td>成本</td>
<td>采购成本</td>
<td>设备</td>
<td><input name="costPurchaseDeviceTaxInclude" value="${estimateBean.costPurchaseDeviceTaxInclude}" required></td>
<td><input name="costPurchaseDeviceTaxExclude" value="${estimateBean.costPurchaseDeviceTaxExclude}" required></td>
</tr>
<tr>
<td>成本</td>
<td>采购成本</td>
<td>施工</td>
<td><input name="costPurchaseBuildTaxInclude" value="${estimateBean.costPurchaseBuildTaxInclude}" required></td>
<td><input name="costPurchaseBuildTaxExclude" value="${estimateBean.costPurchaseBuildTaxExclude}" required></td>
</tr>
<tr>
<td>成本</td>
<td>采购成本</td>
<td>服务</td>
<td><input name="costPurchaseServiceTaxInclude" value="${estimateBean.costPurchaseServiceTaxInclude}" required></td>
<td><input name="costPurchaseServiceTaxExclude" value="${estimateBean.costPurchaseServiceTaxExclude}" required></td>
</tr>
<tr>
<td>成本</td>
<td>采购成本</td>
<td>其他</td>
<td><input name="costPurchaseOtherTaxInclude" value="${estimateBean.costPurchaseOtherTaxInclude}" required></td>
<td><input name="costPurchaseOtherTaxExclude" value="${estimateBean.costPurchaseOtherTaxExclude}" required></td>
</tr>
<tr>
<td>成本</td>
<td>项目管理成本</td>
<td>项目管理成本</td>
<td><input name="costProjectManageTaxInclude" value="${estimateBean.costProjectManageTaxInclude}" required></td>
<td><input name="costProjectManageTaxExclude" value="${estimateBean.costProjectManageTaxExclude}" required></td>
</tr>
<tr>
<td>成本</td>
<td>其他</td>
<td>其他</td>
<td><input name="costOtherOtherTaxInclude" value="${estimateBean.costOtherOtherTaxInclude}" required></td>
<td><input name="costOtherOtherTaxExclude" value="${estimateBean.costOtherOtherTaxExclude}" required></td>
</tr>
<tr>
<td>合计</td>
<td></td>
<td></td>
<td><input name="costTotalTaxInclude" value="${estimateBean.costTotalTaxInclude}" readonly></td>
<td><input name="costTotalTaxExclude" value="${estimateBean.costTotalTaxExclude}" readonly></td>
</tr>
</tbody>
</table>
<span class="am-text-xl">管理</span>
<table class="am-table am-table-bordered am-table-radius table-main" style="padding:0;">
<tbody>
<tr class="am-text-xl">
<td>类别</td>
<td>费用项目</td>
<td>不含税金额(元)</td>
</tr>
<tr>
<td>财务费用</td>
<td>资金占用成本</td>
<td><input name="costExpropriationTaxExclude" value="${estimateBean.costExpropriationTaxExclude}" required></td>
</tr>
<tr>
<td>公司管理费用</td>
<td></td>
<td><input name="costCompanyManageTaxExclude" value="${estimateBean.costCompanyManageTaxExclude}" required></td>
</tr>
</tbody>
</table>
<span class="am-text-xl">利润率计算</span>
<table class="am-table am-table-bordered am-table-radius table-main" style="padding:0;">
<tbody>
<tr class="am-text-xl">
<td>类别</td>
<td>不含税金额(元)</td>
<td>利润率(%</td>
</tr>
<tr>
<td>项目毛利</td>
<td><input name="projectGrossProfit" value="${estimateBean.projectGrossProfit}" readonly></td>
<td><input name="projectGrossProfitRate" value="${estimateBean.projectGrossProfitRate}" readonly></td>
</tr>
<tr>
<td>项目贡献利润率</td>
<td><input name="projectContributionProfit" value="${estimateBean.projectContributionProfit}" readonly></td>
<td><input name="projectContributionProfitRate" value="${estimateBean.projectContributionProfitRate}" readonly></td>
</tr>
</tbody>
</table>
</div>
<!--验证表单元素validate end-->
</div>
</div>
</div>
<!--选项卡tabsend-->
<div class="am-margin">
<button type="button" class="am-btn am-btn-warning am-btn-xs" onclick="javascript:history.go(-1);">返回上一级</button>
<button type="submit" class="am-btn am-btn-primary am-btn-xs" onclick="javascript:$("#pmsForm").attr('action')='${base}/project/estimateSave';">保存草稿</button>
<button type="submit" class="am-btn am-btn-primary am-btn-xs" onclick="javascript:$("#pmsForm").attr('action')='${base}/project/estimateSaveAndApprove'">提交审核</button>
</div>
</form>
</div>
</div>
<script>
$(function () {
$("input[name='incomeDeviceTaxInclude']").change(function () {
calIncomeInclude();
calIncomeCost();
});
$("input[name='incomeEngineerTaxInclude']").change(function () {
calIncomeInclude();
calIncomeCost();
});
$("input[name='incomeServiceTaxInclude']").change(function () {
calIncomeInclude();
calIncomeCost();
});
$("input[name='incomeDeviceTaxExclude']").change(function () {
calIncomeExclude();
calIncomeCost();
});
$("input[name='incomeEngineerTaxExclude']").change(function () {
calIncomeExclude();
calIncomeCost();
});
$("input[name='incomeServiceTaxExclude']").change(function () {
calIncomeExclude();
calIncomeCost();
});
$("input[name='costPurchaseDeviceTaxInclude']").change(function () {
calCostInclude();
calIncomeCost();
});
$("input[name='costPurchaseBuildTaxInclude']").change(function () {
calCostInclude();
calIncomeCost();
});
$("input[name='costPurchaseServiceTaxInclude']").change(function () {
calCostInclude();
calIncomeCost();
});
$("input[name='costPurchaseOtherTaxInclude']").change(function () {
calCostInclude();
calIncomeCost();
});
$("input[name='costProjectManageTaxInclude']").change(function () {
calCostInclude();
calIncomeCost();
});
$("input[name='costOtherOtherTaxInclude']").change(function () {
calCostInclude();
calIncomeCost();
});
$("input[name='costPurchaseDeviceTaxExclude']").change(function () {
calCostExclude();
calIncomeCost();
});
$("input[name='costPurchaseBuildTaxExclude']").change(function () {
calCostExclude();
calIncomeCost();
});
$("input[name='costPurchaseServiceTaxExclude']").change(function () {
calCostExclude();
calIncomeCost();
});
$("input[name='costPurchaseOtherTaxExclude']").change(function () {
calCostExclude();
calIncomeCost();
});
$("input[name='costProjectManageTaxExclude']").change(function () {
calCostExclude();
calIncomeCost();
});
$("input[name='costOtherOtherTaxExclude']").change(function () {
calCostExclude();
calIncomeCost();
});
$("input[name='costExpropriationTaxExclude']").change(function () {
calIncomeCost();
});
$("input[name='costCompanyManageTaxExclude']").change(function () {
calIncomeCost();
});
});
/**
* 统计收入(含税),有一项没填就置空
*/
function calIncomeInclude() {
var incomeDeviceTaxInclude = $("input[name='incomeDeviceTaxInclude']").val();
var incomeEngineerTaxInclude = $("input[name='incomeEngineerTaxInclude']").val();
var incomeServiceTaxInclude = $("input[name='incomeServiceTaxInclude']").val();
var incomeTotalTaxInclude = $("input[name='incomeTotalTaxInclude']");
if(incomeDeviceTaxInclude && incomeEngineerTaxInclude && incomeServiceTaxInclude){
incomeTotalTaxInclude.val(parseFloat(incomeDeviceTaxInclude)+parseFloat(incomeEngineerTaxInclude)+parseFloat(incomeServiceTaxInclude));
}else {
incomeTotalTaxInclude.val("");
}
}
/**
* 统计收入(不含税),有一项没填就置空
*/
function calIncomeExclude() {
var incomeDeviceTaxExclude = $("input[name='incomeDeviceTaxExclude']").val();
var incomeEngineerTaxExclude = $("input[name='incomeEngineerTaxExclude']").val();
var incomeServiceTaxExclude = $("input[name='incomeServiceTaxExclude']").val();
var incomeTotalTaxExclude = $("input[name='incomeTotalTaxExclude']");
if(incomeDeviceTaxExclude && incomeEngineerTaxExclude && incomeServiceTaxExclude){
incomeTotalTaxExclude.val(parseFloat(incomeDeviceTaxExclude)+parseFloat(incomeEngineerTaxExclude)+parseFloat(incomeServiceTaxExclude));
}else {
incomeTotalTaxExclude.val("");
}
}
/**
* 统计成本(含税),有一项没填就置空
*/
function calCostInclude() {
var costPurchaseDeviceTaxInclude = $("input[name='costPurchaseDeviceTaxInclude']").val();
var costPurchaseBuildTaxInclude = $("input[name='costPurchaseBuildTaxInclude']").val();
var costPurchaseServiceTaxInclude = $("input[name='costPurchaseServiceTaxInclude']").val();
var costPurchaseOtherTaxInclude = $("input[name='costPurchaseOtherTaxInclude']").val();
var costProjectManageTaxInclude = $("input[name='costProjectManageTaxInclude']").val();
var costOtherOtherTaxInclude = $("input[name='costOtherOtherTaxInclude']").val();
var costTotalTaxInclude = $("input[name='costTotalTaxInclude']");
if(costPurchaseDeviceTaxInclude && costPurchaseBuildTaxInclude && costPurchaseServiceTaxInclude && costPurchaseOtherTaxInclude && costProjectManageTaxInclude && costOtherOtherTaxInclude){
costTotalTaxInclude.val(parseFloat(costPurchaseDeviceTaxInclude)+parseFloat(costPurchaseBuildTaxInclude)+parseFloat(costPurchaseServiceTaxInclude)+parseFloat(costPurchaseOtherTaxInclude)+parseFloat(costProjectManageTaxInclude)+parseFloat(costOtherOtherTaxInclude));
}else {
costTotalTaxInclude.val("");
}
}
/**
* 统计成本(不含税),有一项没填就置空
*/
function calCostExclude() {
var costPurchaseDeviceTaxExclude = $("input[name='costPurchaseDeviceTaxExclude']").val();
var costPurchaseBuildTaxExclude = $("input[name='costPurchaseBuildTaxExclude']").val();
var costPurchaseServiceTaxExclude = $("input[name='costPurchaseServiceTaxExclude']").val();
var costPurchaseOtherTaxExclude = $("input[name='costPurchaseOtherTaxExclude']").val();
var costProjectManageTaxExclude = $("input[name='costProjectManageTaxExclude']").val();
var costOtherOtherTaxExclude = $("input[name='costOtherOtherTaxExclude']").val();
var costTotalTaxExclude = $("input[name='costTotalTaxExclude']");
if(costPurchaseDeviceTaxExclude && costPurchaseBuildTaxExclude && costPurchaseServiceTaxExclude && costPurchaseOtherTaxExclude && costProjectManageTaxExclude && costOtherOtherTaxExclude){
costTotalTaxExclude.val(parseFloat(costPurchaseDeviceTaxExclude)+parseFloat(costPurchaseBuildTaxExclude)+parseFloat(costPurchaseServiceTaxExclude)+parseFloat(costPurchaseOtherTaxExclude)+parseFloat(costProjectManageTaxExclude)+parseFloat(costOtherOtherTaxExclude));
}else {
costTotalTaxExclude.val("");
}
}
/**
* 计算毛利、毛利率、贡献、贡献率
*/
function calIncomeCost() {
var incomeTotalTaxExclude = $("input[name='incomeTotalTaxExclude']").val();
var costTotalTaxExclude = $("input[name='costTotalTaxExclude']").val();
var costExpropriationTaxExclude = $("input[name='costExpropriationTaxExclude']").val();
var costCompanyManageTaxExclude = $("input[name='costCompanyManageTaxExclude']").val();
var projectGrossProfit = $("input[name='projectGrossProfit']");
var projectGrossProfitRate = $("input[name='projectGrossProfitRate']");
var projectContributionProfit = $("input[name='projectContributionProfit']");
var projectContributionProfitRate = $("input[name='projectContributionProfitRate']");
if(incomeTotalTaxExclude && costTotalTaxExclude && costExpropriationTaxExclude){
projectGrossProfit.val(parseFloat(incomeTotalTaxExclude)-parseFloat(costTotalTaxExclude)-parseFloat(costExpropriationTaxExclude));
projectGrossProfitRate.val(parseFloat(projectGrossProfit.val())*100/parseFloat(incomeTotalTaxExclude));
}else {
projectGrossProfit.val("");
projectGrossProfitRate.val("");
}
if(projectGrossProfit.val() && costCompanyManageTaxExclude){
projectContributionProfit.val(parseFloat(projectGrossProfit.val())-parseFloat(costCompanyManageTaxExclude));
projectContributionProfitRate.val(parseFloat(projectContributionProfit.val())*100/parseFloat(incomeTotalTaxExclude))
}else {
projectContributionProfit.val("");
projectContributionProfitRate.val("");
}
}
</script>
</@defaultLayout.layout>

View File

@ -171,7 +171,17 @@
<td>${list.deptName!}</td>
<td>${list.startDate?string("yyyy-MM")} ~ ${list.endDate?string("yyyy-MM")}</td>
<td>
--
<div class="am-btn-toolbar">
<div class="am-btn-group am-btn-group-xs">
<@shiro.hasPermission name="PROJECT_EDIT">
<button type="button"
class="am-btn am-btn-default am-btn-xs am-text-secondary"
onclick="location.href='${base}/project/edit?id=${list.id}'"><span
class="am-icon-pencil-square-o"></span>编辑
</button>
</@shiro.hasPermission>
</div>
</div>
</td>
</tr>