项目状态和审核状态调整

master
xxssyyyyssxx 2021-11-02 12:20:20 +08:00
parent b49786ef4f
commit 589187d846
9 changed files with 328 additions and 427 deletions

View File

@ -4,9 +4,10 @@ package cn.palmte.work.bean;
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
*/
public enum ApproveStatusEnum {
APPROVAL_PENDING(0,"待审核"),
APPROVAL_PASSED(1,"审核通过"),
APPROVAL_UNPASS(2,"审核不通过");
APPROVAL_UNCOMMIT(0,"草稿"),
APPROVAL_PENDING(1,"待审核"),
APPROVAL_PASSED(2,"审核通过"),
APPROVAL_UNPASS(3,"审核不通过");
private int approveStatus;
private String approveStatusDesc;
@ -34,12 +35,15 @@ public enum ApproveStatusEnum {
public static ApproveStatusEnum parseApproveStatus(int approveStatus){
if(approveStatus == 0){
return APPROVAL_PENDING;
return APPROVAL_UNCOMMIT;
}
if(approveStatus == 1){
return APPROVAL_PASSED;
return APPROVAL_PENDING;
}
if(approveStatus == 2){
return APPROVAL_PASSED;
}
if(approveStatus == 3){
return APPROVAL_UNPASS;
}
throw new IllegalArgumentException("Unkown approveStatus:"+approveStatus);

View File

@ -4,7 +4,6 @@ package cn.palmte.work.bean;
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
*/
public enum StatusEnum {
DRAFT(0,"草稿"),
CREATED(1,"项目创建"),
ESTIMATE_ACCOUNTS(5,"概算完成"),
BUDGET_ACCOUNTS(10,"预算完成"),
@ -36,9 +35,6 @@ public enum StatusEnum {
}
public static StatusEnum parseStatus(int status){
if(status == 0){
return DRAFT;
}
if(status == 1){
return CREATED;
}

View File

@ -1,5 +1,6 @@
package cn.palmte.work.controller.backend;
import cn.palmte.work.bean.ApproveStatusEnum;
import cn.palmte.work.bean.EstimateBean;
import cn.palmte.work.model.Dept;
import cn.palmte.work.model.DeptRepository;
@ -79,10 +80,24 @@ public class ProjectController extends BaseController{
return "admin/project_estimate_add";
}
/**
* 稿
*/
@RequestMapping("/estimateAddSave")
public String estimateAddSave(Project project, EstimateBean estimateBean,
Map<String, Object> model) {
projectService.estimateAddSave(project, estimateBean, InterfaceUtil.getAdmin());
projectService.estimateAddSave(project, estimateBean, InterfaceUtil.getAdmin(), ApproveStatusEnum.APPROVAL_UNCOMMIT);
return "redirect:/project/list";
}
/**
*
*/
@RequestMapping("/estimateAddSaveAndApprove")
public String estimateAddSaveAndApprove(Project project, EstimateBean estimateBean,
Map<String, Object> model) {
projectService.estimateAddSave(project, estimateBean, InterfaceUtil.getAdmin(), ApproveStatusEnum.APPROVAL_PENDING);
return "redirect:/project/list";
}
@RequestMapping("/edit")
@ -93,19 +108,21 @@ public class ProjectController extends BaseController{
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());
projectService.estimateEditSave(project, estimateBean, InterfaceUtil.getAdmin(), ApproveStatusEnum.APPROVAL_UNCOMMIT);
return "redirect:/project/list";
}
@RequestMapping("/estimateEditSaveAndApprove")
public String estimateEditSaveAndApprove(Project project, EstimateBean estimateBean,
Map<String, Object> model) {
projectService.estimateEditSave(project, estimateBean, InterfaceUtil.getAdmin(), ApproveStatusEnum.APPROVAL_PENDING);
return "redirect:/project/list";
}
@RequestMapping("/estimateSaveAndApprove")
public String estimateSaveAndApprove(Map<String, Object> model) {
return "redirect:/project/list";
}
@InitBinder
public void initBinder(WebDataBinder webDataBinder){
webDataBinder.addCustomFormatter(new DateFormatter("yyyy-MM-dd"));

View File

@ -1,5 +1,6 @@
package cn.palmte.work.model;
import cn.palmte.work.bean.ApproveStatusEnum;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
@ -13,6 +14,11 @@ import java.util.Date;
@Entity
@Table(name = "project")
public class Project {
public static final int STATUS_CREATED = 1;
public static final int STATUS_ESTIMATE = 5;
public static final int STATUS_BUDGET = 10;
public static final int STATUS_SETTLE = 15;
public static final int STATUS_FINAL = 20;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@GenericGenerator(name = "persistenceGenerator", strategy = "increment")
@ -28,18 +34,23 @@ public class Project {
@Column(name = "type_desc")
private String typeDesc;
/**
* 0稿15101520
* 15101520
*/
private int status;
@Column(name = "status_desc")
private String statusDesc;
/**
* 012
* 0稿123
*/
@Column(name = "approve_status")
private int approveStatus;
@Column(name = "approve_status_desc")
private String approveStatusDesc;
@Column(name = "approve_status_estimate")
private Integer approveStatusEstimate;
@Column(name = "approve_status_budget")
private Integer approveStatusBudget;
@Column(name = "approve_status_settle")
private Integer approveStatusSettle;
@Column(name = "approve_status_final")
private Integer approveStatusFinal;
/**
* id
*/
@ -178,20 +189,60 @@ public class Project {
this.statusDesc = statusDesc;
}
public int getApproveStatus() {
return approveStatus;
public Integer getApproveStatusEstimate() {
return approveStatusEstimate;
}
public void setApproveStatus(int approveStatus) {
this.approveStatus = approveStatus;
public void setApproveStatusEstimate(Integer approveStatusEstimate) {
this.approveStatusEstimate = approveStatusEstimate;
}
public Integer getApproveStatusBudget() {
return approveStatusBudget;
}
public void setApproveStatusBudget(Integer approveStatusBudget) {
this.approveStatusBudget = approveStatusBudget;
}
public Integer getApproveStatusSettle() {
return approveStatusSettle;
}
public void setApproveStatusSettle(Integer approveStatusSettle) {
this.approveStatusSettle = approveStatusSettle;
}
public Integer getApproveStatusFinal() {
return approveStatusFinal;
}
public void setApproveStatusFinal(Integer approveStatusFinal) {
this.approveStatusFinal = approveStatusFinal;
}
public Integer getApproveStatus() {
if(status == STATUS_CREATED || status == STATUS_ESTIMATE){
return approveStatusEstimate;
}
if(status == STATUS_BUDGET){
return approveStatusBudget;
}
if(status == STATUS_SETTLE){
return approveStatusSettle;
}
if(status == STATUS_FINAL){
return approveStatusFinal;
}
return null;
}
public String getApproveStatusDesc() {
return approveStatusDesc;
}
public void setApproveStatusDesc(String approveStatusDesc) {
this.approveStatusDesc = approveStatusDesc;
Integer approveStatus = getApproveStatus();
if(null == approveStatus){
return "未知";
}
return ApproveStatusEnum.parseApproveStatus(approveStatus).getApproveStatusDesc();
}
public Integer getApproveId() {

View File

@ -46,7 +46,9 @@ public class ProjectService {
queryHelper.addCondition("p.status=?", Integer.parseInt(searchInfo.get("status")));
}
if(StrUtil.isNotEmpty(searchInfo.get("approveStatus")) && !"-1".equals(searchInfo.get("approveStatus"))){
queryHelper.addCondition("p.approve_status=?", Integer.parseInt(searchInfo.get("approveStatus")));
int approveStatus = Integer.parseInt(searchInfo.get("approveStatus"));
//四种状态满足其一即可
queryHelper.addCondition("(p.approve_status_estimate=? OR p.approve_status_budget=? OR p.approve_status_settle=? OR p.approve_status_final=?)", approveStatus,approveStatus,approveStatus,approveStatus);
}
if(StrUtil.isNotEmpty(searchInfo.get("deptId")) && !"-1".equals(searchInfo.get("deptId"))){
queryHelper.addCondition("p.dept_id=?", Integer.parseInt(searchInfo.get("deptId")));
@ -89,21 +91,20 @@ public class ProjectService {
*
*/
@Transactional(rollbackFor = RuntimeException.class)
public Project estimateAddSave(Project project, EstimateBean estimateBean, Admin admin) {
public Project estimateAddSave(Project project, EstimateBean estimateBean, Admin admin, ApproveStatusEnum approveStatusEnum) {
project.setTypeDesc(TypeEnum.parseType(project.getType()).getTypeDesc());
project.setStatusDesc(StatusEnum.parseStatus(project.getStatus()).getStatusDesc());
project.setApproveStatus(ApproveStatusEnum.APPROVAL_PENDING.getApproveStatus());
project.setApproveStatusDesc(ApproveStatusEnum.APPROVAL_PENDING.getApproveStatusDesc());
project.setStatus(StatusEnum.CREATED.getStatus());
project.setStatusDesc(StatusEnum.CREATED.getStatusDesc());
project.setApproveStatusEstimate(approveStatusEnum.getApproveStatus());
project.setCreatorId(admin.getId());
project.setCreatorName(admin.getUserName());
//TODO 审核人通过计算得到
project.setApproveId(0);
project.setApproveId(null);
project.setApproveName("");
//TODO 获取登录人的部门信息
project.setDeptId(admin.getId());
project.setDeptName("");
project.setDeptName("工程部");
project.setCreateTime(new Date());
@ -116,6 +117,7 @@ public class ProjectService {
cost(project, estimateBean);
//管理记录
costManage(project, estimateBean);
return project;
}
@ -140,13 +142,13 @@ public class ProjectService {
*
*/
@Transactional(rollbackFor = RuntimeException.class)
public Project estimateEditSave(Project project, EstimateBean estimateBean, Admin admin) {
public Project estimateEditSave(Project project, EstimateBean estimateBean, Admin admin, ApproveStatusEnum approveStatusEnum) {
//删除原来的
projectRepository.delete(project.getId());
//清空概算信息
clearEstimate(project);
return estimateAddSave(project, estimateBean, admin);
return estimateAddSave(project, estimateBean, admin, approveStatusEnum);
}
private void cost(Project project, EstimateBean estimateBean) {

View File

@ -0,0 +1,192 @@
function calIncomeAndCost() {
$("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("");
}
}

View File

@ -5,7 +5,7 @@
<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></small></div>
<div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">项目概算表</strong></div>
</div>
<form method="post" class="am-form" id="pmsForm" action="${base}/project/estimateAddSave">
@ -323,207 +323,27 @@
<!--选项卡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>
<button type="submit" class="am-btn am-btn-primary am-btn-xs" id="saveDraft">保存草稿</button>
<button type="submit" class="am-btn am-btn-primary am-btn-xs" id="saveApprove">提交审核</button>
</div>
</form>
</div>
</div>
<script src="${base}/assets/js/project_estimate.js"></script>
<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();
calIncomeAndCost();
$("#saveDraft").click(function () {
$("#pmsForm").attr("action","${base}/project/estimateAddSave");
$("#pmsForm").submit();
});
$("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();
$("#saveApprove").click(function () {
$("#pmsForm").attr("action","${base}/project/estimateAddSaveAndApprove");
$("#pmsForm").submit();
});
});
/**
* 统计收入(含税),有一项没填就置空
*/
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

@ -323,207 +323,26 @@
<!--选项卡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>
<button type="submit" class="am-btn am-btn-primary am-btn-xs" id="saveDraft">保存草稿</button>
<button type="submit" class="am-btn am-btn-primary am-btn-xs" id="saveApprove">提交审核</button>
</div>
</form>
</div>
</div>
<script src="${base}/assets/js/project_estimate.js"></script>
<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();
calIncomeAndCost();
$("#saveDraft").click(function () {
$("#pmsForm").attr("action","${base}/project/estimateEditSave");
$("#pmsForm").submit();
});
$("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();
$("#saveApprove").click(function () {
$("#pmsForm").attr("action","${base}/project/estimateEditSaveAndApprove");
$("#pmsForm").submit();
});
});
/**
* 统计收入(含税),有一项没填就置空
*/
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

@ -64,7 +64,6 @@
<div class="am-u-sm-10">
<select data-am-selected id="status" name="status">
<option value="-1">全部</option>
<option value="0" <#if status?? && status='0'>selected</#if>>草稿</option>
<option value="1" <#if status?? && status='1'>selected</#if>>项目创建</option>
<option value="5" <#if status?? && status='5'>selected</#if>>概算完成</option>
<option value="10" <#if status?? && status='10'>selected</#if>>预算完成</option>
@ -78,9 +77,10 @@
<div class="am-u-sm-10">
<select data-am-selected id="approveStatus" name="approveStatus">
<option value="-1">全部</option>
<option value="0" <#if approveStatus?? && approveStatus='0'>selected</#if>>待审核</option>
<option value="1" <#if approveStatus?? && approveStatus='1'>selected</#if>>审核通过</option>
<option value="2" <#if approveStatus?? && approveStatus='2'>selected</#if>>审核不通过</option>
<option value="0" <#if approveStatus?? && approveStatus='0'>selected</#if>>草稿</option>
<option value="1" <#if approveStatus?? && approveStatus='1'>selected</#if>>待审核</option>
<option value="2" <#if approveStatus?? && approveStatus='2'>selected</#if>>审核通过</option>
<option value="3" <#if approveStatus?? && approveStatus='3'>selected</#if>>审核不通过</option>
</select>
</div>
</td>