按需求修改

master
OathK1per 2021-11-22 00:51:12 +08:00
parent 7cec6cfdd0
commit afd5f9ef1b
14 changed files with 890 additions and 168 deletions

View File

@ -58,14 +58,14 @@ public class HumanCostController extends BaseController{
Map<String, Object> model) {
//当前登录人的角色类型
Admin admin = getAdmin();
int roleId = admin.getRoleId();
int roleLevel = admin.getRoleLevel();
List<Project> selfProjects = projectRepository.findByCreator(admin.getId(), new Date());
if (roleId <= 18) {
if (roleLevel <= 2 || roleLevel == 4) {
model.put("deptVary", 1);
model.put("deptList", deptRepository.findAll());
model.put("projectList", projectRepository.findAll());
model.put("showSalary", 1);
} else if (roleId <= 20) {
} else if (roleLevel == 3) {
model.put("deptVary", -1);
model.put("deptList", new ArrayList<>());
model.put("projectList", projectRepository.findByDeptId(admin.getDeptId()));
@ -140,14 +140,12 @@ public class HumanCostController extends BaseController{
*/
@RequestMapping("/template")
public void importTemplate(HttpServletResponse response) throws IOException {
String[] headers = new String[]{"项目名称", "人员1", "人员2"};
String[] columns = new String[]{""};
downloadHeader(response , Utils.generateExcelName("人力成本导入模板"));
ExportUtils exportUtils = new ExportUtils(headers);
List<String> data = new ArrayList<>();
data.add("成本");
data.add("项目1");
data.add("项目2");
String[] headers = humanCostService.template(data);
ExportUtils exportUtils = new ExportUtils(headers);
exportUtils.exportTemplate(columns , data, "yyyy-MM-dd HH:mm:ss" , 1);
exportUtils.write(response.getOutputStream());
}

View File

@ -4,10 +4,7 @@ import cn.palmte.work.bean.BudgetSettleBean;
import cn.palmte.work.bean.EstimateSettleBean;
import cn.palmte.work.bean.FormerBean;
import cn.palmte.work.bean.SettleBean;
import cn.palmte.work.model.Project;
import cn.palmte.work.model.ProjectBudgetPlanDetail;
import cn.palmte.work.model.ProjectSettleIncome;
import cn.palmte.work.model.ProjectSettleIncomeRepository;
import cn.palmte.work.model.*;
import cn.palmte.work.service.ProjectBudgetService;
import cn.palmte.work.service.ProjectEstimateService;
import cn.palmte.work.service.ProjectService;
@ -18,7 +15,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import top.jfunc.common.utils.CollectionUtil;
import java.math.BigDecimal;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
@ -48,8 +47,12 @@ public class ProjectSettleController extends BaseController{
@Autowired
private ProjectSettleIncomeRepository projectSettleIncomeRepository;
@Autowired
private ProjectUserTimeRepository projectUserTimeRepository;
@RequestMapping("/add")
public String add(@RequestParam("id") int id, Map<String, Object> model) {
String time = null;
Project project = projectService.getProject(id);
List<ProjectBudgetPlanDetail> projectBudgetPlanDetails = projectBudgetService.getProjectBudgetPlanDetails(project);
ProjectSettleIncome projectSettleIncome = projectSettleIncomeRepository.findNewByProjectId(id);
@ -60,11 +63,11 @@ public class ProjectSettleController extends BaseController{
instance.setTime(date);
instance.set(Calendar.MONTH, instance.get(Calendar.MONTH) + 1);
Date current = instance.getTime();
String time = DateKit.toStr(current, DateKit.DATE_FORMAT_YEAR_MONTH2);
time = DateKit.toStr(current, DateKit.DATE_FORMAT_YEAR_MONTH2);
model.put("time", time);
model.put("formerBean", projectSettleService.getFormerSettle(project, time));
} else {
String time = DateKit.toStr(project.getStartDate(), DateKit.DATE_FORMAT_YEAR_MONTH2);
time = DateKit.toStr(project.getStartDate(), DateKit.DATE_FORMAT_YEAR_MONTH2);
model.put("time", time);
model.put("formerBean", new FormerBean());
@ -73,7 +76,13 @@ public class ProjectSettleController extends BaseController{
model.put("project", project);
model.put("estimateBean", projectEstimateService.getEstimate(project));
model.put("budgetBean", projectBudgetService.getBudget(project));
List<ProjectUserTime> projectUserTimes = projectUserTimeRepository.findByProjectIdAndTime(project.getId(), time);
if(CollectionUtil.isNotEmpty(projectUserTimes)){
BigDecimal result = projectUserTimes.stream().map((ProjectUserTime t) -> t.getUserCost().multiply(t.getUserSalary())).reduce(BigDecimal.ZERO, BigDecimal::add);
model.put("salary", result);
} else {
model.put("salary", new BigDecimal(0));
}
//现金表
model.put("cashFlowBean", projectBudgetService.getCashFlowBean(project, projectBudgetPlanDetails));
//freemarker可以利用的静态方法
@ -94,6 +103,13 @@ public class ProjectSettleController extends BaseController{
model.put("formerBean", projectSettleService.getFormerSettle(project, time));
model.put("monthBean", projectSettleService.getMonthSettle(project, time));
model.put("currentBean", projectSettleService.getCurrentSettle(project, time));
List<ProjectUserTime> projectUserTimes = projectUserTimeRepository.findByProjectIdAndTime(project.getId(), time);
if(CollectionUtil.isNotEmpty(projectUserTimes)){
BigDecimal result = projectUserTimes.stream().map((ProjectUserTime t) -> t.getUserCost().multiply(t.getUserSalary())).reduce(BigDecimal.ZERO, BigDecimal::add);
model.put("salary", result);
} else {
model.put("salary", new BigDecimal(0));
}
//现金表
model.put("cashFlowBean", projectBudgetService.getCashFlowBean(project, projectBudgetPlanDetails));
//freemarker可以利用的静态方法

View File

@ -53,8 +53,7 @@ public class ProjectSummaryController extends BaseController {
} else {
time = searchInfo.get("time");
}
List<SettleBean> list = projectSummaryService.getList(searchInfo, time);
List<SettleBean> list = projectSummaryService.getList(searchInfo, time, admin);
model.put("pager", list);
return "admin/project_statistics";

View File

@ -5,6 +5,7 @@ import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.List;
/**
@ -20,6 +21,9 @@ public interface ProjectUserTimeRepository extends JpaRepository<ProjectUserTime
@Query(value = "select * from project_user_time where time = ?1", nativeQuery = true)
List<ProjectUserTime> findAllByTime(String time);
@Query(value = "select * from project_user_time where project_id = ?1 and time = ?2", nativeQuery = true)
List<ProjectUserTime> findByProjectIdAndTime(int projectId, String time);
@Modifying
@Query(value = "delete from project_user_time where time = ?1", nativeQuery = true)
int deleteByTime(String date);

View File

@ -10,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import top.jfunc.common.db.bean.Page;
import top.jfunc.common.db.utils.Pagination;
import top.jfunc.common.utils.CollectionUtil;
import java.math.BigDecimal;
@ -36,6 +37,9 @@ public class HumanCostService {
@Autowired
private AdminRepository adminRepository;
@Autowired
private Pagination pagination;
public Page<ProjectUserTime> project(ConcurrentHashMap<String, String> searchInfo, Admin admin, int pageNumber, int pageSize) {
Page<ProjectUserTime> list = projectUserTimeRepositoryImpl.project(searchInfo, admin, pageNumber, pageSize);
return list;
@ -214,4 +218,31 @@ public class HumanCostService {
}
return new BigDecimal(0);
}
public String[] template(List<String> data) {
List<Admin> admins = adminRepository.getAllEnable();
String[] headers = new String[admins.size() + 1];
headers[0] = "项目名称";
for (int i = 1; i < admins.size(); i++) {
headers[i] = admins.get(i - 1).getRealName();
}
Admin admin = InterfaceUtil.getAdmin();
List<Project> projectList = null;
if (admin.getRoleLevel() <= 2 || admin.getRoleLevel() == 4) {
String sql = "select proj.id, proj.name from project proj where proj.status = ? order by proj.id asc";
projectList = pagination.find(sql, Project.class, Project.STATUS_SETTLE);
} else {
String sql = "select proj.id, proj.name from project proj where proj.status = ? and " +
" (proj.creator_id=? OR proj.id in (SELECT pv1.project_id FROM project_visible pv1 WHERE pv1.type=1 AND pv1.tid=? UNION SELECT pv2.project_id FROM project_visible pv2 WHERE pv2.type=2 AND pv2.tid=?)) order by proj.id asc";
//项目可见性根据角色和人员id
int roleId = admin.getRoleId();
Integer adminId = admin.getId();
//自己创建的肯定能看见
projectList = pagination.find(sql, Project.class, Project.STATUS_SETTLE, adminId, roleId, adminId);
}
for (Project project : projectList) {
data.add(project.getName());
}
return headers;
}
}

View File

@ -44,31 +44,13 @@ public class ProjectSettleService {
public void save(Project project, SettleBean settleBean, BudgetSettleBean budgetBean, EstimateSettleBean estimateBean, String time) {
//收入记录
income(project, settleBean, budgetBean, estimateBean, time);
//成本记录
cost(project, settleBean, budgetBean, estimateBean, time);
//管理记录
costManage(project, settleBean, budgetBean, estimateBean, time);
//利润记录
profit(project, settleBean, budgetBean, estimateBean, time);
//资金流量记录
cashFlow(project, settleBean, budgetBean, time);
step(project, settleBean, budgetBean, estimateBean, time);
projectService.updateStatusAndApproveStatus(project.getId(), StatusEnum.SETTLE_ACCOUNTS, ApproveStatusEnum.APPROVAL_UNCOMMIT);
}
public void saveAndApprove(Project project, SettleBean settleBean, BudgetSettleBean budgetBean, EstimateSettleBean estimateBean, String time) throws Exception{
//收入记录
income(project, settleBean, budgetBean, estimateBean, time);
//成本记录
cost(project, settleBean, budgetBean, estimateBean, time);
//管理记录
costManage(project, settleBean, budgetBean, estimateBean, time);
//利润记录
profit(project, settleBean, budgetBean, estimateBean, time);
//资金流量记录
cashFlow(project, settleBean, budgetBean, time);
step(project, settleBean, budgetBean, estimateBean, time);
projectService.updateStatusAndApproveStatus(project.getId(), StatusEnum.SETTLE_ACCOUNTS, ApproveStatusEnum.APPROVAL_PENDING);
@ -77,8 +59,23 @@ public class ProjectSettleService {
}
private void step(Project project, SettleBean settleBean, BudgetSettleBean budgetBean, EstimateSettleBean estimateBean, String time) {
//清除旧纪录
clearSettle(project, time);
//收入记录
income(project, settleBean, budgetBean, estimateBean, time);
//成本记录
cost(project, settleBean, budgetBean, estimateBean, time);
//管理记录
costManage(project, settleBean, budgetBean, estimateBean, time);
//利润记录
profit(project, settleBean, budgetBean, estimateBean, time);
//资金流量记录
cashFlow(project, settleBean, budgetBean, time);
}
public void clearSettle(Project project, String time){
private void clearSettle(Project project, String time){
List<ProjectSettleIncome> incomes = projectSettleIncomeRepository.findAllByProjectIdAndTime(project.getId(), time);
if(CollectionUtil.isNotEmpty(incomes)){
projectSettleIncomeRepository.deleteInBatch(incomes);

View File

@ -11,9 +11,7 @@ import top.jfunc.common.utils.CollectionUtil;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
@ -45,11 +43,20 @@ public class ProjectSummaryService {
@Autowired
private Pagination pagination;
public List<SettleBean> getList(ConcurrentHashMap<String, String> searchInfo, String time) {
//预算金额
Map<String, BigDecimal> budget = new HashMap<>(40);
String sql = "select proj.id, proj.name, proj.approve_status_budget from project_settle_cost psc left join project proj on psc.project_id = proj.id where psc.time = ? group by proj.id order by proj.id asc";
List<Project> projectList = pagination.find(sql, Project.class, time);
public List<SettleBean> getList(ConcurrentHashMap<String, String> searchInfo, String time, Admin admin) {
List<Project> projectList = null;
if (admin.getRoleLevel() <= 2 || admin.getRoleLevel() == 4) {
String sql = "select proj.id, proj.name, proj.approve_status_settle from project_settle_cost psc left join project proj on psc.project_id = proj.id where psc.time = ? group by proj.id order by proj.id asc";
projectList = pagination.find(sql, Project.class, time);
} else {
String sql = "select proj.id, proj.name, proj.approve_status_settle from project_settle_cost psc left join project proj on psc.project_id = proj.id where psc.time = ? and " +
" (proj.creator_id=? OR proj.id in (SELECT pv1.project_id FROM project_visible pv1 WHERE pv1.type=1 AND pv1.tid=? UNION SELECT pv2.project_id FROM project_visible pv2 WHERE pv2.type=2 AND pv2.tid=?)) group by proj.id order by proj.id asc";
//项目可见性根据角色和人员id
int roleId = admin.getRoleId();
Integer adminId = admin.getId();
//自己创建的肯定能看见
projectList = pagination.find(sql, Project.class, time, adminId, roleId, adminId);
}
List<Project> projects = new ArrayList<>();
List<Integer> projectInt = new ArrayList<>();
for (Project project : projectList) {

View File

@ -4,16 +4,19 @@ function calculateSettle() {
calIncomeDeviceSettleTotal();
calIncomeTotal();
calIncomeSettleTotal();
calProfit();
});
$("input[name='incomeEngineer']").change(function () {
calIncomeEngineerSettleTotal();
calIncomeTotal();
calIncomeSettleTotal();
calProfit();
});
$("input[name='incomeService']").change(function () {
calIncomeServiceSettleTotal();
calIncomeTotal();
calIncomeSettleTotal();
calProfit();
});
@ -21,31 +24,37 @@ function calculateSettle() {
calCostPurchaseDeviceSettleTotal();
calCostTotal();
calCostSettleTotal();
calProfit();
});
$("input[name='costPurchaseBuild']").change(function () {
calCostPurchaseBuildSettleTotal();
calCostTotal();
calCostSettleTotal();
calProfit();
});
$("input[name='costPurchaseService']").change(function () {
calCostPurchaseServiceSettleTotal();
calCostTotal();
calCostSettleTotal();
calProfit();
});
$("input[name='costPurchaseOther']").change(function () {
calCostPurchaseOtherSettleTotal();
calCostTotal();
calCostSettleTotal();
calProfit();
});
$("input[name='costProjectManage']").change(function () {
calCostProjectManageSettleTotal();
calCostTotal();
calCostSettleTotal();
calProfit();
});
$("input[name='costOther']").change(function () {
calCostOtherSettleTotal();
calCostTotal();
calCostSettleTotal();
calProfit();
});
@ -53,106 +62,176 @@ function calculateSettle() {
calCostExpropriationSettleTotal();
calCostManageTotal();
calCostManageSettleTotal();
calProfit();
});
$("input[name='costCompanyManage']").change(function () {
calCostCompanyManageSettleTotal();
calCostManageTotal();
calCostManageSettleTotal();
calContributionProfit();
calContributionProfitSettleTotal();
calContributionProfitProfitMargin();
calNetProfit();
calNetProfitSettleTotal();
calNetProfitProfitMargin();
});
$("input[name='costIncomeTax']").change(function () {
calCostIncomeTaxSettleTotal();
calCostManageTotal();
calCostManageSettleTotal();
});
$("input[name='grossProfit']").change(function () {
calGrossProfitSettleTotal();
calGrossProfitProfitMargin();
});
$("input[name='contributionProfit']").change(function () {
calContributionProfitSettleTotal();
calContributionProfitProfitMargin();
});
$("input[name='netProfit']").change(function () {
calNetProfit();
calNetProfitSettleTotal();
calNetProfitProfitMargin();
});
// $("input[name='grossProfit']").change(function () {
// calGrossProfitSettleTotal();
// calGrossProfitProfitMargin();
// });
// $("input[name='contributionProfit']").change(function () {
// calContributionProfitSettleTotal();
// calContributionProfitProfitMargin();
// });
// $("input[name='netProfit']").change(function () {
// calNetProfitSettleTotal();
// calNetProfitProfitMargin();
// });
$("input[name='saleIncomeCash']").change(function () {
calSaleIncomeCashSettle();
calNetCashFlow();
calNetCashFlowSettle();
calNetIncreaseMonetaryFunds();
calNetIncreaseMonetaryFundsSettle();
calCashFlowTotal();
calCashFlowSettleTotal();
});
$("input[name='taxReturn']").change(function () {
calTaxReturnSettle();
calNetCashFlow();
calNetCashFlowSettle();
calNetIncreaseMonetaryFunds();
calNetIncreaseMonetaryFundsSettle();
calCashFlowTotal();
calCashFlowSettleTotal();
});
$("input[name='earnestMoneyIncome']").change(function () {
calEarnestMoneyIncomeSettle();
calNetCashFlow();
calNetCashFlowSettle();
calNetIncreaseMonetaryFunds();
calNetIncreaseMonetaryFundsSettle();
calCashFlowTotal();
calCashFlowSettleTotal();
});
$("input[name='purchaseCost']").change(function () {
calPurchaseCostSettle();
calNetCashFlow();
calNetCashFlowSettle();
calNetIncreaseMonetaryFunds();
calNetIncreaseMonetaryFundsSettle();
calCashFlowTotal();
calCashFlowSettleTotal();
});
$("input[name='taxCost']").change(function () {
calTaxCostSettle();
calNetCashFlow();
calNetCashFlowSettle();
calNetIncreaseMonetaryFunds();
calNetIncreaseMonetaryFundsSettle();
calCashFlowTotal();
calCashFlowSettleTotal();
});
$("input[name='earnestMoneyCost']").change(function () {
calEarnestMoneyCostSettle();
calCashFlowTotal();
calCashFlowSettleTotal();
});
$("input[name='netCashFlow']").change(function () {
calNetCashFlow();
calNetCashFlowSettle();
calNetIncreaseMonetaryFunds();
calNetIncreaseMonetaryFundsSettle();
calCashFlowTotal();
calCashFlowSettleTotal();
});
// $("input[name='netCashFlow']").change(function () {
// calNetCashFlowSettle();
// calNetIncreaseMonetaryFunds();
// calCashFlowTotal();
// calCashFlowSettleTotal();
// });
$("input[name='cashInflowFromInvestingActivities']").change(function () {
calCashInflowFromInvestingActivitiesSettle();
calNetCashFromInvestingActivities();
calNetCashFromInvestingActivitiesSettle();
calNetIncreaseMonetaryFunds();
calNetIncreaseMonetaryFundsSettle();
calCashFlowTotal();
calCashFlowSettleTotal();
});
$("input[name='cashOutflowFromInvestingActivities']").change(function () {
calCashOutflowFromInvestingActivitiesSettle();
calCashFlowTotal();
calCashFlowSettleTotal();
});
$("input[name='netCashFromInvestingActivities']").change(function () {
calNetCashFromInvestingActivities();
calNetCashFromInvestingActivitiesSettle();
calNetIncreaseMonetaryFunds();
calNetIncreaseMonetaryFundsSettle();
calCashFlowTotal();
calCashFlowSettleTotal();
});
// $("input[name='netCashFromInvestingActivities']").change(function () {
// calNetCashFromInvestingActivitiesSettle();
// calNetIncreaseMonetaryFunds();
// calCashFlowTotal();
// calCashFlowSettleTotal();
// });
$("input[name='financingCapitalInflow']").change(function () {
calFinancingCapitalInflowSettle();
calFinancingCapitalCashflow();
calFinancingCapitalCashflowSettle();
calNetIncreaseMonetaryFunds();
calNetIncreaseMonetaryFundsSettle();
calCashFlowTotal();
calCashFlowSettleTotal();
});
$("input[name='financingCapitalOutflow']").change(function () {
calFinancingCapitalOutflowSettle();
calCashFlowTotal();
calCashFlowSettleTotal();
});
$("input[name='financingCapitalCashflow']").change(function () {
calFinancingCapitalCashflow();
calFinancingCapitalCashflowSettle();
calCashFlowTotal();
calCashFlowSettleTotal();
});
$("input[name='netIncreaseMonetaryFunds']").change(function () {
calNetIncreaseMonetaryFunds();
calNetIncreaseMonetaryFundsSettle();
calCashFlowTotal();
calCashFlowSettleTotal();
});
// $("input[name='financingCapitalCashflow']").change(function () {
// calFinancingCapitalCashflowSettle();
// calNetIncreaseMonetaryFunds();
// calCashFlowTotal();
// calCashFlowSettleTotal();
// });
// $("input[name='netIncreaseMonetaryFunds']").change(function () {
// calNetIncreaseMonetaryFundsSettle();
// calCashFlowTotal();
// calCashFlowSettleTotal();
// });
}
/**
* 收入和支出均需调用的利润方法
*/
function calProfit() {
calGrossProfit();
calGrossProfitSettleTotal();
calGrossProfitProfitMargin();
calContributionProfit();
calContributionProfitSettleTotal();
calContributionProfitProfitMargin();
calNetProfit();
calNetProfitSettleTotal();
calNetProfitProfitMargin();
}
/**
* 收入设备类结算总额(不含税)有一项没填就置空
*/
@ -455,6 +534,23 @@ function calCostManageSettleTotal() {
}
}
/**
* 本月项目毛利结算总额有一项没填就置空
*/
function calGrossProfit() {
var incomeTotal = $("input[name='incomeTotal']").val();
var costTotal = $("input[name='costTotal']").val();
var costExpropriation = $("input[name='costExpropriation']").val();
var grossProfit = $("input[name='grossProfit']");
if(incomeTotal && costTotal && costExpropriation){
grossProfit.val(parseFloat(incomeTotal)-parseFloat(costTotal)-parseFloat(costExpropriation));
}else {
grossProfit.val("");
}
}
/**
* 项目毛利结算总额有一项没填就置空
*/
@ -487,6 +583,22 @@ function calGrossProfitProfitMargin() {
}
}
/**
* 本月项目贡献利润有一项没填就置空
*/
function calContributionProfit() {
var grossProfit = $("input[name='grossProfit']").val();
var costCompanyManage = $("input[name='costCompanyManage']").val();
var contributionProfit = $("input[name='contributionProfit']");
if(grossProfit && costCompanyManage){
contributionProfit.val(parseFloat(grossProfit)-parseFloat(costCompanyManage));
}else {
contributionProfit.val("");
}
}
/**
* 项目贡献利润有一项没填就置空
*/
@ -519,6 +631,22 @@ function calContributionProfitProfitMargin() {
}
}
/**
* 本月项目净利润有一项没填就置空
*/
function calNetProfit() {
var contributionProfit = $("input[name='contributionProfit']").val();
var costIncomeTax = $("input[name='costIncomeTax']").val();
var netProfit = $("input[name='netProfit']");
if(contributionProfit && costIncomeTax){
netProfit.val(parseFloat(contributionProfit)-parseFloat(costIncomeTax));
}else {
netProfit.val("");
}
}
/**
* 项目净利润有一项没填就置空
*/
@ -543,7 +671,7 @@ function calNetProfitProfitMargin() {
var incomeSettleTotal = $("input[name='incomeSettleTotal']").val();
var netProfitProfitMargin = $("input[name='netProfitProfitMargin']");
console.log("calNetProfitProfitMargin " + netProfitSettleTotal + " " + incomeSettleTotal);
if(netProfitSettleTotal && incomeSettleTotal){
netProfitProfitMargin.val(100*(parseFloat(netProfitSettleTotal)/parseFloat(incomeSettleTotal)));
}else {
@ -776,6 +904,77 @@ function calNetIncreaseMonetaryFundsSettle() {
}
}
/**
* 本月经营活动产生的现金流量净额有一项没填就置空
*/
function calNetCashFlow() {
var saleIncomeCash = $("input[name='saleIncomeCash']").val();
var taxReturn = $("input[name='taxReturn']").val();
var earnestMoneyIncome = $("input[name='earnestMoneyIncome']").val();
var purchaseCost = $("input[name='purchaseCost']").val();
var taxCost = $("input[name='taxCost']").val();
var earnestMoneyCost = $("input[name='earnestMoneyCost']").val();
var netCashFlow = $("input[name='netCashFlow']");
if(saleIncomeCash && taxReturn && earnestMoneyIncome &&
purchaseCost && taxCost && earnestMoneyCost) {
netCashFlow.val(parseFloat(saleIncomeCash)+parseFloat(taxReturn)+parseFloat(earnestMoneyIncome)-
parseFloat(purchaseCost)-parseFloat(taxCost)-parseFloat(earnestMoneyCost));
}else {
netCashFlow.val("");
}
}
/**
* 本月投资活动产生的现金流量净额有一项没填就置空
*/
function calNetCashFromInvestingActivities() {
var cashInflowFromInvestingActivities = $("input[name='cashInflowFromInvestingActivities']").val();
var cashOutflowFromInvestingActivities = $("input[name='cashOutflowFromInvestingActivities']").val();
var netCashFromInvestingActivities = $("input[name='netCashFromInvestingActivities']");
if(cashInflowFromInvestingActivities && cashOutflowFromInvestingActivities){
netCashFromInvestingActivities.val(parseFloat(cashInflowFromInvestingActivities)-parseFloat(cashOutflowFromInvestingActivities));
}else {
netCashFromInvestingActivities.val("");
}
}
/**
* 本月筹资活动产生的现金流量净额有一项没填就置空
*/
function calFinancingCapitalCashflow() {
var financingCapitalInflow = $("input[name='financingCapitalInflow']").val();
var financingCapitalOutflow = $("input[name='financingCapitalOutflow']").val();
var financingCapitalCashflow = $("input[name='financingCapitalCashflow']");
if(financingCapitalInflow && financingCapitalOutflow){
financingCapitalCashflow.val(parseFloat(financingCapitalInflow)-parseFloat(financingCapitalOutflow));
}else {
financingCapitalCashflow.val("");
}
}
/**
* 本月货币资金净增加额有一项没填就置空
*/
function calNetIncreaseMonetaryFunds() {
var netCashFlow = $("input[name='netCashFlow']").val();
var netCashFromInvestingActivities = $("input[name='netCashFromInvestingActivities']").val();
var financingCapitalCashflow = $("input[name='financingCapitalCashflow']").val();
var netIncreaseMonetaryFunds = $("input[name='netIncreaseMonetaryFunds']");
if(netCashFlow && netCashFromInvestingActivities && financingCapitalCashflow){
netIncreaseMonetaryFunds.val(parseFloat(netCashFlow)+parseFloat(netCashFromInvestingActivities)+parseFloat(financingCapitalCashflow));
}else {
netIncreaseMonetaryFunds.val("");
}
}
/**
* 本月现金流量表总额(不含税)有一项没填就置空
*/

View File

@ -0,0 +1,454 @@
var valid = function() {
return incomeDeviceValid() && incomeEngineerValid() && incomeServiceValid() && costPurchaseDeviceValid() && costPurchaseBuildValid() && costPurchaseServiceValid() && costPurchaseOtherValid() && costProjectManageValid() && costOtherValid() && costExpropriationValid() && costCompanyManageValid()
&& grossProfitValid() && contributionProfitValid() && netProfitValid() && saleIncomeCashValid() && earnestMoneyIncomeValid() && purchaseCostValid() && earnestMoneyCostValid() && financingCapitalInflowValid() && financingCapitalOutflowValid() && financingCapitalCashflowValid();
};
var incomeDeviceValid = function() {
var settle = $("input[name='incomeDeviceSettleTotal']").val();
var month = $("input[name='incomeDevice']").val();
var budget = $("input[name='incomeDeviceBudgetTotal']").val();
if (month == "") {
layui.use('layer', function(){
var layer = layui.layer;
layer.alert("请填入本月收入设备类数据");
});
return false;
}
if (parseFloat(settle) > parseFloat(budget)) {
layui.use('layer', function(){
var layer = layui.layer;
layer.alert("收入设备类结算总额不能高于预算总额");
});
return false;
}
return true;
};
var incomeEngineerValid = function() {
var settle = $("input[name='incomeEngineerSettleTotal']").val();
var month = $("input[name='incomeEngineer']").val();
var budget = $("input[name='incomeEngineerBudgetTotal']").val();
if (month == "") {
layui.use('layer', function(){
var layer = layui.layer;
layer.alert("请填入本月收入工程类数据");
});
return false;
}
if (parseFloat(settle) > parseFloat(budget)) {
layui.use('layer', function(){
var layer = layui.layer;
layer.alert("收入工程类结算总额不能高于预算总额");
});
return false;
}
return true;
};
var incomeServiceValid = function() {
var settle = $("input[name='incomeServiceSettleTotal']").val();
var month = $("input[name='incomeService']").val();
var budget = $("input[name='incomeServiceBudgetTotal']").val();
if (month == "") {
layui.use('layer', function(){
var layer = layui.layer;
layer.alert("请填入本月收入服务类数据");
});
return false;
}
if (parseFloat(settle) > parseFloat(budget)) {
layui.use('layer', function(){
var layer = layui.layer;
layer.alert("收入服务类结算总额不能高于预算总额");
});
return false;
}
return true;
};
var costPurchaseDeviceValid = function() {
var settle = $("input[name='costPurchaseDeviceSettleTotal']").val();
var month = $("input[name='costPurchaseDevice']").val();
var budget = $("input[name='costPurchaseDeviceBudgetTotal']").val();
if (month == "") {
layui.use('layer', function(){
var layer = layui.layer;
layer.alert("请填入本月采购成本设备类数据");
});
return false;
}
if (parseFloat(settle) > parseFloat(budget)) {
layui.use('layer', function(){
var layer = layui.layer;
layer.alert("采购成本设备类结算总额不能高于预算总额");
});
return false;
}
return true;
};
var costPurchaseBuildValid = function() {
var settle = $("input[name='costPurchaseBuildSettleTotal']").val();
var month = $("input[name='costPurchaseBuild']").val();
var budget = $("input[name='costPurchaseBuildBudgetTotal']").val();
if (month == "") {
layui.use('layer', function(){
var layer = layui.layer;
layer.alert("请填入本月采购成本施工类数据");
});
return false;
}
if (parseFloat(settle) > parseFloat(budget)) {
layui.use('layer', function(){
var layer = layui.layer;
layer.alert("采购成本施工类结算总额不能高于预算总额");
});
return false;
}
return true;
};
var costPurchaseServiceValid = function() {
var settle = $("input[name='costPurchaseServiceSettleTotal']").val();
var month = $("input[name='costPurchaseService']").val();
var budget = $("input[name='costPurchaseServiceBudgetTotal']").val();
if (month == "") {
layui.use('layer', function(){
var layer = layui.layer;
layer.alert("请填入本月采购成本服务类数据");
});
return false;
}
if (parseFloat(settle) > parseFloat(budget)) {
layui.use('layer', function(){
var layer = layui.layer;
layer.alert("采购成本服务类结算总额不能高于预算总额");
});
return false;
}
return true;
};
var costPurchaseOtherValid = function() {
var settle = $("input[name='costPurchaseOtherSettleTotal']").val();
var month = $("input[name='costPurchaseOther']").val();
var budget = $("input[name='costPurchaseOtherBudgetTotal']").val();
if (month == "") {
layui.use('layer', function(){
var layer = layui.layer;
layer.alert("请填入本月采购成本其他类数据");
});
return false;
}
if (parseFloat(settle) > parseFloat(budget)) {
layui.use('layer', function(){
var layer = layui.layer;
layer.alert("采购成本其他类结算总额不能高于预算总额");
});
return false;
}
return true;
};
var costProjectManageValid = function() {
var settle = $("input[name='costProjectManageSettleTotal']").val();
var month = $("input[name='costProjectManage']").val();
var salary = $("input[name='salary']").val();
var budget = $("input[name='costProjectManageBudgetTotal']").val();
if (month == "") {
layui.use('layer', function(){
var layer = layui.layer;
layer.alert("请填入本月项目管理成本数据");
});
return false;
}
if (parseFloat(salary) > parseFloat(month)) {
layui.use('layer', function(){
var layer = layui.layer;
layer.alert("本月项目管理成本不能低于人力成本");
});
return false;
}
if (parseFloat(settle) > parseFloat(budget)) {
layui.use('layer', function(){
var layer = layui.layer;
layer.alert("项目管理成本结算总额不能高于预算总额");
});
return false;
}
return true;
};
var costOtherValid = function() {
var settle = $("input[name='costOtherSettleTotal']").val();
var month = $("input[name='costOther']").val();
var budget = $("input[name='costOtherBudgetTotal']").val();
if (month == "") {
layui.use('layer', function(){
var layer = layui.layer;
layer.alert("请填入本月其他成本数据");
});
return false;
}
if (parseFloat(settle) > parseFloat(budget)) {
layui.use('layer', function(){
var layer = layui.layer;
layer.alert("其他成本结算总额不能高于预算总额");
});
return false;
}
return true;
};
var costExpropriationValid = function() {
var settle = $("input[name='costExpropriationSettleTotal']").val();
var month = $("input[name='costExpropriation']").val();
var budget = $("input[name='costExpropriationBudgetTotal']").val();
if (month == "") {
layui.use('layer', function(){
var layer = layui.layer;
layer.alert("请填入本月财务费用数据");
});
return false;
}
if (parseFloat(settle) > parseFloat(budget)) {
layui.use('layer', function(){
var layer = layui.layer;
layer.alert("财务费用结算总额不能高于预算总额");
});
return false;
}
return true;
};
var costCompanyManageValid = function() {
var settle = $("input[name='costCompanyManageSettleTotal']").val();
var month = $("input[name='costCompanyManage']").val();
var budget = $("input[name='costCompanyManageBudgetTotal']").val();
if (month == "") {
layui.use('layer', function(){
var layer = layui.layer;
layer.alert("请填入本月公司管理费用数据");
});
return false;
}
if (parseFloat(settle) > parseFloat(budget)) {
layui.use('layer', function(){
var layer = layui.layer;
layer.alert("公司管理费用结算总额不能高于预算总额");
});
return false;
}
return true;
};
var grossProfitValid = function() {
var settle = $("input[name='grossProfitSettleTotal']").val();
var month = $("input[name='grossProfit']").val();
var budget = $("input[name='grossProfitBudgetTotal']").val();
if (month == "") {
layui.use('layer', function(){
var layer = layui.layer;
layer.alert("请填入本月项目毛利数据");
});
return false;
}
if (parseFloat(settle) > parseFloat(budget)) {
layui.use('layer', function(){
var layer = layui.layer;
layer.alert("项目毛利结算总额不能高于预算总额");
});
return false;
}
return true;
};
var contributionProfitValid = function() {
var settle = $("input[name='contributionProfitSettleTotal']").val();
var month = $("input[name='contributionProfit']").val();
var budget = $("input[name='contributionProfitBudgetTotal']").val();
if (month == "") {
layui.use('layer', function(){
var layer = layui.layer;
layer.alert("请填入本月项目贡献利润数据");
});
return false;
}
if (parseFloat(settle) > parseFloat(budget)) {
layui.use('layer', function(){
var layer = layui.layer;
layer.alert("项目贡献利润结算总额不能高于预算总额");
});
return false;
}
return true;
};
var netProfitValid = function() {
var settle = $("input[name='netProfitSettleTotal']").val();
var month = $("input[name='netProfit']").val();
var budget = $("input[name='netProfitBudgetTotal']").val();
if (month == "") {
layui.use('layer', function(){
var layer = layui.layer;
layer.alert("请填入本月项目净利润数据");
});
return false;
}
if (parseFloat(settle) > parseFloat(budget)) {
layui.use('layer', function(){
var layer = layui.layer;
layer.alert("项目净利润结算总额不能高于预算总额");
});
return false;
}
return true;
};
var saleIncomeCashValid = function() {
var settle = $("input[name='saleIncomeCashSettleTotal']").val();
var month = $("input[name='saleIncomeCash']").val();
var budget = $("input[name='saleIncomeCashBudgetTotal']").val();
if (month == "") {
layui.use('layer', function(){
var layer = layui.layer;
layer.alert("请填入本月销售商品、提供劳务收到的现金数据");
});
return false;
}
if (parseFloat(settle) > parseFloat(budget)) {
layui.use('layer', function(){
var layer = layui.layer;
layer.alert("销售商品、提供劳务收到的现金结算总额不能高于预算总额");
});
return false;
}
return true;
};
var earnestMoneyIncomeValid = function() {
var settle = $("input[name='earnestMoneyIncomeSettleTotal']").val();
var month = $("input[name='earnestMoneyIncome']").val();
var budget = $("input[name='earnestMoneyIncomeBudgetTotal']").val();
if (month == "") {
layui.use('layer', function(){
var layer = layui.layer;
layer.alert("请填入本月收到其他与经营活动有关的现金数据");
});
return false;
}
if (parseFloat(settle) > parseFloat(budget)) {
layui.use('layer', function(){
var layer = layui.layer;
layer.alert("收到其他与经营活动有关的现金结算总额不能高于预算总额");
});
return false;
}
return true;
};
var purchaseCostValid = function() {
var settle = $("input[name='purchaseCostSettleTotal']").val();
var month = $("input[name='purchaseCost']").val();
var budget = $("input[name='purchaseCostBudgetTotal']").val();
if (month == "") {
layui.use('layer', function(){
var layer = layui.layer;
layer.alert("请填入本月购买商品、接受劳务支付的现金数据");
});
return false;
}
if (parseFloat(settle) > parseFloat(budget)) {
layui.use('layer', function(){
var layer = layui.layer;
layer.alert("购买商品、接受劳务支付的现金结算总额不能高于预算总额");
});
return false;
}
return true;
};
var earnestMoneyCostValid = function() {
var settle = $("input[name='earnestMoneyCostSettleTotal']").val();
var month = $("input[name='earnestMoneyCost']").val();
var budget = $("input[name='earnestMoneyCostBudgetTotal']").val();
if (month == "") {
layui.use('layer', function(){
var layer = layui.layer;
layer.alert("请填入本月支付其他与经营活动有关的现金数据");
});
return false;
}
if (parseFloat(settle) > parseFloat(budget)) {
layui.use('layer', function(){
var layer = layui.layer;
layer.alert("支付其他与经营活动有关的现金结算总额不能高于预算总额");
});
return false;
}
return true;
};
var financingCapitalInflowValid = function() {
var settle = $("input[name='financingCapitalInflowSettleTotal']").val();
var month = $("input[name='financingCapitalInflow']").val();
var budget = $("input[name='financingCapitalInflowBudgetTotal']").val();
if (month == "") {
layui.use('layer', function(){
var layer = layui.layer;
layer.alert("请填入本月融资资金流入数据");
});
return false;
}
if (parseFloat(settle) > parseFloat(budget)) {
layui.use('layer', function(){
var layer = layui.layer;
layer.alert("融资资金流入结算总额不能高于预算总额");
});
return false;
}
return true;
};
var financingCapitalOutflowValid = function() {
var settle = $("input[name='financingCapitalOutflowSettleTotal']").val();
var month = $("input[name='financingCapitalOutflow']").val();
var budget = $("input[name='financingCapitalOutflowBudgetTotal']").val();
if (month == "") {
layui.use('layer', function(){
var layer = layui.layer;
layer.alert("请填入本月还款资金流出数据");
});
return false;
}
if (parseFloat(settle) > parseFloat(budget)) {
layui.use('layer', function(){
var layer = layui.layer;
layer.alert("还款资金流出结算总额不能高于预算总额");
});
return false;
}
return true;
};
var financingCapitalCashflowValid = function() {
var settle = $("input[name='financingCapitalCashflowSettleTotal']").val();
var month = $("input[name='financingCapitalCashflow']").val();
var budget = $("input[name='financingCapitalCashflowBudgetTotal']").val();
if (month == "") {
layui.use('layer', function(){
var layer = layui.layer;
layer.alert("请填入本月筹资活动产生的现金流量净额数据");
});
return false;
}
if (parseFloat(settle) > parseFloat(budget)) {
layui.use('layer', function(){
var layer = layui.layer;
layer.alert("筹资活动产生的现金流量净额结算总额不能高于预算总额");
});
return false;
}
return true;
};

View File

@ -231,7 +231,7 @@
<#-- </@shiro.hasPermission>-->
<#-- 项目等于预算状态、预算审核等于通过状态 -->
<#if list.status==5 && list.approveStatusBudget=2 >
<#if (list.status==5 && list.approveStatusBudget=2) || (list.status=10 && list.approveStatusSettle=2) >
<button type="button"
class="am-btn am-btn-default am-btn-xs am-text-secondary"
onclick="location.href='${base}/project/settle/add?id=${list.id}'"><span

View File

@ -34,6 +34,8 @@
<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}" />
<input name="salary" id="salary" type="hidden" value="${Utils.format(salary,'0')}" />
<div class="am-u-sm-10">
<div class="am-form am-form-inline">
<div class="am-form-group am-form-icon">
@ -152,7 +154,9 @@
<td>项目管理成本</td>
<td><input name="costProjectManageEstimateTotal" type="number" value="${Utils.format(estimateBean.costProjectManageTaxExclude,'0')}" readonly required title="项目管理成本概算总额"></td>
<td><input name="costProjectManageBudgetTotal" type="number" value="${Utils.format(budgetBean.costProjectManageTaxExclude,'0')}" readonly required title="项目管理成本预算总额"></td>
<td><input name="costProjectManageFormerSettleTotal" type="number" value="${Utils.format(formerBean.costProjectManageTaxExclude,'0')}" required readonly title="项目管理成本上月结算总额"></td>
<td><input name="costProjectManageFormerSettleTotal" type="number" value="${Utils.format(formerBean.costProjectManageTaxExclude,'0')}" required readonly title="项目管理成本上月结算总额">
<span>人力成本:${Utils.format(salary,'0')} 元</span>
</td>
<td><input type="number" min="0.00" max="99999999.99" step="0.01" name="costProjectManage" required title="项目管理成本本月结算金额"></td>
<td><input type="number" name="costProjectManageSettleTotal" readonly title="项目管理成本结算总额"></td>
</tr>
@ -246,7 +250,7 @@
<td><input name="grossProfitEstimateTotal" type="number" value="${Utils.format(estimateBean.grossProfitTaxExclude,'0')}" required readonly title="项目毛利概算总额"></td>
<td><input name="grossProfitBudgetTotal" type="number" value="${Utils.format(budgetBean.grossProfitTaxExclude,'0')}" required readonly title="项目毛利预算总额"></td>
<td><input name="grossProfitFormerSettleTotal" type="number" value="${Utils.format(formerBean.grossProfit,'0')}" required readonly title="项目毛利上月结算总额"></td>
<td><input type="number" min="0.00" max="99999999.99" step="0.01" name="grossProfit" required title="项目毛利本月结算金额"></td>
<td><input type="number" min="0.00" max="99999999.99" step="0.01" name="grossProfit" readonly required title="项目毛利本月结算金额"></td>
<td><input type="number" name="grossProfitSettleTotal" readonly title="项目毛利结算总额"></td>
<td><input name="grossProfitProfitMargin" type="number" readonly title="项目毛利利润率"></td>
</tr>
@ -255,7 +259,7 @@
<td><input name="contributionProfitEstimateTotal" type="number" value="${Utils.format(estimateBean.contributionProfitTaxExclude,'0')}" required readonly title="项目贡献利润概算总额"></td>
<td><input name="contributionProfitBudgetTotal" type="number" value="${Utils.format(budgetBean.contributionProfitTaxExclude,'0')}" required readonly title="项目贡献利润预算总额"></td>
<td><input name="contributionProfitFormerSettleTotal" type="number" value="${Utils.format(formerBean.contributionProfit,'0')}" required readonly title="项目贡献利润上月结算总额"></td>
<td><input type="number" min="0.00" max="99999999.99" step="0.01" name="contributionProfit" required title="项目贡献利润本月结算金额"></td>
<td><input type="number" min="0.00" max="99999999.99" step="0.01" name="contributionProfit" readonly required title="项目贡献利润本月结算金额"></td>
<td><input type="number" name="contributionProfitSettleTotal" readonly title="项目贡献利润结算总额"></td>
<td><input name="contributionProfitProfitMargin" type="number" readonly title="项目贡献利润利润率"></td>
</tr>
@ -264,7 +268,7 @@
<td><input name="netProfitBudgetTotal" type="number" value="${Utils.format(estimateBean.contributionProfitTaxExclude,'0')}" required readonly title="项目净利润预算总额"></td>
<td><input name="netProfitBudgetTotal" type="number" value="${Utils.format(budgetBean.contributionProfitTaxExclude,'0')}" required readonly title="项目净利润预算总额"></td>
<td><input name="netProfitFormerSettleTotal" type="number" value="${Utils.format(formerBean.netProfit,'0')}" required readonly title="项目净利润上月结算总额"></td>
<td><input type="number" min="0.00" max="99999999.99" step="0.01" name="netProfit" required title="项目净利润本月结算金额"></td>
<td><input type="number" min="0.00" max="99999999.99" step="0.01" name="netProfit" readonly required title="项目净利润本月结算金额"></td>
<td><input type="number" name="netProfitSettleTotal" readonly title="项目净利润结算总额"></td>
<td><input name="netProfitProfitMargin" type="number" readonly title="项目净利润利润率"></td>
</tr>
@ -327,7 +331,7 @@
<td>经营活动产生的现金流量净额</td>
<td><input name="netCashFlowBudget" type="number" value="${Utils.format(cashFlowBean.getNetCashFlow(),'0')}" readonly required title="预算总额"></td>
<td><input name="netCashFlowFormerSettle" type="number" value="${Utils.format(formerBean.netCashFlow,'0')}" required readonly title="上月结算总额"></td>
<td><input type="number" min="0.00" max="99999999.99" step="0.01" name="netCashFlow" required title="本月结算金额"></td>
<td><input type="number" min="0.00" max="99999999.99" step="0.01" name="netCashFlow" readonly required title="本月结算金额"></td>
<td><input name="netCashFlowSettle" type="number" readonly title="结算总额"></td>
</tr>
<tr>
@ -348,7 +352,7 @@
<td>投资活动产生的现金流量净额</td>
<td>/</td>
<td><input name="netCashFromInvestingActivitiesFormerSettle" type="number" value="${Utils.format(formerBean.netCashFromInvestingActivities,'0')}" required readonly title="上月结算总额"></td>
<td><input type="number" min="0.00" max="99999999.99" step="0.01" name="netCashFromInvestingActivities" required title="本月结算金额"></td>
<td><input type="number" min="0.00" max="99999999.99" step="0.01" name="netCashFromInvestingActivities" readonly required title="本月结算金额"></td>
<td><input name="netCashFromInvestingActivitiesSettle" type="number" readonly title="结算总额"></td>
</tr>
<tr>
@ -369,14 +373,14 @@
<td>筹资活动产生的现金流量净额</td>
<td><input name="financingCapitalCashflowBudget" type="number" value="${Utils.format(cashFlowBean.getFinancingCapitalCashflow(),'0')}" readonly required title="预算总额"></td>
<td><input name="financingCapitalCashflowFormerSettle" type="number" value="${Utils.format(formerBean.financingCapitalCashflow,'0')}" required readonly title="上月结算总额"></td>
<td><input type="number" min="0.00" max="99999999.99" step="0.01" name="financingCapitalCashflow" required title="本月结算金额"></td>
<td><input type="number" min="0.00" max="99999999.99" step="0.01" name="financingCapitalCashflow" readonly required title="本月结算金额"></td>
<td><input name="financingCapitalCashflowSettle" type="number" readonly title="结算总额"></td>
</tr>
<tr>
<td>货币资金净增加额</td>
<td><input name="netIncreaseMonetaryFundsBudget" type="number" value="${Utils.format(cashFlowBean.getNetIncreaseMonetaryFunds(),'0')}" readonly required title="预算总额"></td>
<td><input name="netIncreaseMonetaryFundsFormerSettle" type="number" value="${Utils.format(formerBean.netIncreaseMonetaryFunds,'0')}" required readonly title="上月结算总额"></td>
<td><input type="number" min="0.00" max="99999999.99" step="0.01" name="netIncreaseMonetaryFunds" required title="本月结算金额"></td>
<td><input type="number" min="0.00" max="99999999.99" step="0.01" name="netIncreaseMonetaryFunds" readonly required title="本月结算金额"></td>
<td><input name="netIncreaseMonetaryFundsSettle" type="number" readonly title="结算总额"></td>
</tr>
<tr>
@ -407,71 +411,11 @@
<script>
var base = "${base}";
</script>
<#-- <script src="${base}/layui/layui.js"></script>-->
<script src="${base}/layui/layui.js"></script>
<script src="${base}/assets/js/project_common.js"></script>
<script src="${base}/assets/js/project_settle.js"></script>
<script src="${base}/assets/js/project_settle_valid.js"></script>
<script>
$(function () {
/*表单验证begin*/
//自定义规则用法验证元素上加class="js-pattern-sort"
if ($.AMUI && $.AMUI.validator) {
$.AMUI.validator.patterns.sort = /^([0-9]+)$/;
}
$("#tmpForm").validator({
// 域通过验证时回调
onValid: function (validity) {
$(validity.field).closest('.am-form-group').find('.am-alert').hide();
},
// 域验证通过时添加的操作,通过该接口可定义各种验证提示
markValid: function (validity) {
// this is Validator instance
var $field = $(validity.field);
//add by zxl只对有required属性的字段进行验证
if (typeof ($field.attr("required")) != "undefined") {
var options = this.options;
var $parent = $field.closest('.am-form-group');
$field.addClass(options.validClass).removeClass(options.inValidClass);
$parent.addClass('am-form-success').removeClass('am-form-error');
options.onValid.call(this, validity);
}
},
// 验证出错时的回调, validity 对象包含相关信息,格式通 H5 表单元素的 validity 属性
onInValid: function (validity) {
var $field = $(validity.field);
var $group = $field.closest('.am-form-group');
var $alert = $group.find('.am-alert');
// 使用自定义的提示信息 或 插件内置的提示信息
var msg = $field.data('validationMessage') || this.getValidationMessage(validity);
if (!$alert.length) {
$alert = $("<div class='am-alert am-alert-danger'></div>").hide().appendTo($group.find(".input-msg"));
}
console.log("onInValid : " + $field.val());
$alert.html(msg).show();
},
//自定义验证
validate: function (validity) {
var $field = $(validity.field);
var validityIdCard = function () {
var settle = $("#incomeDeviceSettleTotal").val();
var budget = $("#incomeDeviceBudgetTotal").val();
if (settle > budget) {
$myField = $field;
myMsg = "身份证信息不合法!";
validity.valid = false;
}
};
if ($(validity.field).is('#incomeDeviceSettleTotal')) {
validityIdCard();
};
}
});
/*表单验证end*/
});
// layui.use('laydate', function(){
// var laydate = layui.laydate;
//
@ -488,16 +432,28 @@
$(function () {
calculateSettle();
$("#saveSettle").click(function () {
var result = valid();
console.log(result);
if (result) {
console.log("result: " + result);
$("#pmsForm").attr("action", "${base}/project/settle/save");
$("#pmsForm").submit();
} else {
return false;
}
});
$("#saveApprove").click(function () {
var result = valid();
if (result) {
$("#pmsForm").attr("action",base+"/project/settle/saveAndApprove");
$("#pmsForm").submit();
} else {
return false;
}
});
});
</script>

View File

@ -25,7 +25,7 @@
<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/settleAdd">
<form method="post" class="am-form" id="pmsForm">
<!--选项卡tabsbegin-->
<div class="am-tabs am-margin" data-am-tabs>
<ul class="am-tabs-nav am-nav am-nav-tabs">
@ -34,6 +34,7 @@
<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}" />
<input name="salary" id="salary" type="hidden" value="${Utils.format(salary,'0')}" />
<div class="am-u-sm-10">
<div class="am-form am-form-inline">
<div class="am-form-group am-form-icon">
@ -62,7 +63,7 @@
<td><input name="incomeDeviceBudgetTotal" type="number" value="${Utils.format(budgetBean.incomeDeviceTaxExclude,'0')}" required readonly title="设备类预算总额"></td>
<td><input name="incomeDeviceFormerSettleTotal" type="number" value="${Utils.format(formerBean.incomeDeviceTaxExclude,'0')}" required readonly title="设备类上月结算总额"></td>
<td><input type="number" min="0.00" max="99999999.99" step="0.01" name="incomeDevice" value="${Utils.format(monthBean.incomeDevice,'0')}" required title="本月结算金额"></td>
<td><input type="number" name="incomeDeviceSettleTotal" value="${Utils.format(currentBean.incomeDeviceTaxExclude,'0')}" readonly title="设备类结算总额"></td>
<td><input type="number" name="incomeDeviceSettleTotal" value="${Utils.format(currentBean.incomeDeviceTaxExclude,'0')}" readonly title="设备类结算总额" data-validate-async data-validation-message="结算总额不能大于预算总额"></td>
</tr>
<tr>
<td>收入</td>
@ -153,7 +154,8 @@
<td><input name="costProjectManageEstimateTotal" type="number" value="${Utils.format(estimateBean.costProjectManageTaxExclude,'0')}" readonly required title="项目管理成本概算总额"></td>
<td><input name="costProjectManageBudgetTotal" type="number" value="${Utils.format(budgetBean.costProjectManageTaxExclude,'0')}" readonly required title="项目管理成本预算总额"></td>
<td><input name="costProjectManageFormerSettleTotal" type="number" value="${Utils.format(formerBean.costProjectManageTaxExclude,'0')}" required readonly title="项目管理成本上月结算总额"></td>
<td><input type="number" min="0.00" max="99999999.99" step="0.01" name="costProjectManage" value="${Utils.format(monthBean.costProjectManage,'0')}" required title="项目管理成本本月结算金额"></td>
<td><input type="number" min="0.00" max="99999999.99" step="0.01" name="costProjectManage" value="${Utils.format(monthBean.costProjectManage,'0')}" required title="项目管理成本本月结算金额">
<span>人力成本:${Utils.format(salary,'0')} 元</span>
<td><input type="number" name="costProjectManageSettleTotal" value="${Utils.format(currentBean.costProjectManageTaxExclude,'0')}" readonly title="项目管理成本结算总额"></td>
</tr>
<tr>
@ -246,7 +248,7 @@
<td><input name="grossProfitEstimateTotal" type="number" value="${Utils.format(estimateBean.grossProfitTaxExclude,'0')}" required readonly title="项目毛利概算总额"></td>
<td><input name="grossProfitBudgetTotal" type="number" value="${Utils.format(budgetBean.grossProfitTaxExclude,'0')}" required readonly title="项目毛利预算总额"></td>
<td><input name="grossProfitFormerSettleTotal" type="number" value="${Utils.format(formerBean.grossProfit,'0')}" required readonly title="项目毛利上月结算总额"></td>
<td><input type="number" min="0.00" max="99999999.99" step="0.01" name="grossProfit" value="${Utils.format(monthBean.grossProfit,'0')}" required title="项目毛利本月结算金额"></td>
<td><input type="number" min="0.00" max="99999999.99" step="0.01" name="grossProfit" value="${Utils.format(monthBean.grossProfit,'0')}" readonly required title="项目毛利本月结算金额"></td>
<td><input type="number" name="grossProfitSettleTotal" value="${Utils.format(currentBean.grossProfit,'0')}" readonly title="项目毛利结算总额"></td>
<td><input name="grossProfitProfitMargin" type="number" value="${Utils.format(100 * currentBean.grossProfit / currentBean.getIncomeTotalTaxExclude(),'0')}" readonly title="项目毛利利润率"></td>
</tr>
@ -255,7 +257,7 @@
<td><input name="contributionProfitEstimateTotal" type="number" value="${Utils.format(estimateBean.contributionProfitTaxExclude,'0')}" required readonly title="项目贡献利润概算总额"></td>
<td><input name="contributionProfitBudgetTotal" type="number" value="${Utils.format(budgetBean.contributionProfitTaxExclude,'0')}" required readonly title="项目贡献利润预算总额"></td>
<td><input name="contributionProfitFormerSettleTotal" type="number" value="${Utils.format(formerBean.contributionProfit,'0')}" required readonly title="项目贡献利润上月结算总额"></td>
<td><input type="number" min="0.00" max="99999999.99" step="0.01" name="contributionProfit" value="${Utils.format(monthBean.contributionProfit,'0')}" required title="项目贡献利润本月结算金额"></td>
<td><input type="number" min="0.00" max="99999999.99" step="0.01" name="contributionProfit" value="${Utils.format(monthBean.contributionProfit,'0')}" readonly required title="项目贡献利润本月结算金额"></td>
<td><input type="number" name="contributionProfitSettleTotal" value="${Utils.format(currentBean.contributionProfit,'0')}" readonly title="项目贡献利润结算总额"></td>
<td><input name="contributionProfitProfitMargin" type="number" value="${Utils.format(100 * currentBean.contributionProfit / currentBean.getIncomeTotalTaxExclude(),'0')}" readonly title="项目贡献利润利润率"></td>
</tr>
@ -264,7 +266,7 @@
<td>/</td>
<td><input name="netProfitBudgetTotal" type="number" value="${Utils.format(budgetBean.netProfitTaxExclude,'0')}" required readonly title="项目净利润预算总额"></td>
<td><input name="netProfitFormerSettleTotal" type="number" value="${Utils.format(formerBean.netProfit,'0')}" required readonly title="项目净利润上月结算总额"></td>
<td><input type="number" min="0.00" max="99999999.99" step="0.01" name="netProfit" value="${Utils.format(monthBean.netProfit,'0')}" required title="项目净利润本月结算金额"></td>
<td><input type="number" min="0.00" max="99999999.99" step="0.01" name="netProfit" value="${Utils.format(monthBean.netProfit,'0')}" readonly required title="项目净利润本月结算金额"></td>
<td><input type="number" name="netProfitSettleTotal" value="${Utils.format(currentBean.netProfit,'0')}" readonly title="项目净利润结算总额"></td>
<td><input name="netProfitProfitMargin" type="number" value="${Utils.format(100 * currentBean.netProfit / currentBean.getIncomeTotalTaxExclude(),'0')}" readonly title="项目净利润利润率"></td>
</tr>
@ -327,7 +329,7 @@
<td>经营活动产生的现金流量净额</td>
<td><input name="netCashFlowBudget" type="number" value="${Utils.format(cashFlowBean.getNetCashFlow(),'0')}" readonly required title="预算总额"></td>
<td><input name="netCashFlowFormerSettle" type="number" value="${Utils.format(formerBean.netCashFlow,'0')}" required readonly title="上月结算总额"></td>
<td><input type="number" min="0.00" max="99999999.99" step="0.01" name="netCashFlow" value="${Utils.format(monthBean.netCashFlow,'0')}" required title="本月结算金额"></td>
<td><input type="number" min="0.00" max="99999999.99" step="0.01" name="netCashFlow" value="${Utils.format(monthBean.netCashFlow,'0')}" readonly required title="本月结算金额"></td>
<td><input name="netCashFlowSettle" type="number" value="${Utils.format(currentBean.netCashFlow,'0')}" readonly title="结算总额"></td>
</tr>
<tr>
@ -348,7 +350,7 @@
<td>投资活动产生的现金流量净额</td>
<td>/</td>
<td><input name="netCashFromInvestingActivitiesFormerSettle" type="number" value="${Utils.format(formerBean.netCashFromInvestingActivities,'0')}" required readonly title="上月结算总额"></td>
<td><input type="number" min="0.00" max="99999999.99" step="0.01" name="netCashFromInvestingActivities" value="${Utils.format(monthBean.netCashFromInvestingActivities,'0')}" required title="本月结算金额"></td>
<td><input type="number" min="0.00" max="99999999.99" step="0.01" name="netCashFromInvestingActivities" value="${Utils.format(monthBean.netCashFromInvestingActivities,'0')}" readonly required title="本月结算金额"></td>
<td><input name="netCashFromInvestingActivitiesSettle" type="number" value="${Utils.format(currentBean.netCashFromInvestingActivities,'0')}" readonly title="结算总额"></td>
</tr>
<tr>
@ -369,14 +371,14 @@
<td>筹资活动产生的现金流量净额</td>
<td><input name="financingCapitalCashflowBudget" type="number" value="${Utils.format(cashFlowBean.getFinancingCapitalCashflow(),'0')}" readonly required title="预算总额"></td>
<td><input name="financingCapitalCashflowFormerSettle" type="number" value="${Utils.format(formerBean.financingCapitalCashflow,'0')}" required readonly title="上月结算总额"></td>
<td><input type="number" min="0.00" max="99999999.99" step="0.01" name="financingCapitalCashflow" value="${Utils.format(monthBean.financingCapitalCashflow,'0')}" required title="本月结算金额"></td>
<td><input type="number" min="0.00" max="99999999.99" step="0.01" name="financingCapitalCashflow" value="${Utils.format(monthBean.financingCapitalCashflow,'0')}" readonly required title="本月结算金额"></td>
<td><input name="financingCapitalCashflowSettle" type="number" value="${Utils.format(currentBean.financingCapitalCashflow,'0')}" readonly title="结算总额"></td>
</tr>
<tr>
<td>货币资金净增加额</td>
<td><input name="netIncreaseMonetaryFundsBudget" type="number" value="${Utils.format(cashFlowBean.getNetIncreaseMonetaryFunds(),'0')}" readonly required title="预算总额"></td>
<td><input name="netIncreaseMonetaryFundsFormerSettle" type="number" value="${Utils.format(formerBean.netIncreaseMonetaryFunds,'0')}" required readonly title="上月结算总额"></td>
<td><input type="number" min="0.00" max="99999999.99" step="0.01" name="netIncreaseMonetaryFunds" value="${Utils.format(monthBean.netIncreaseMonetaryFunds,'0')}" required title="本月结算金额"></td>
<td><input type="number" min="0.00" max="99999999.99" step="0.01" name="netIncreaseMonetaryFunds" value="${Utils.format(monthBean.netIncreaseMonetaryFunds,'0')}" readonly required title="本月结算金额"></td>
<td><input name="netIncreaseMonetaryFundsSettle" type="number" value="${Utils.format(currentBean.netIncreaseMonetaryFunds,'0')}" readonly title="结算总额"></td>
</tr>
<tr>
@ -407,9 +409,10 @@
<script>
var base = "${base}";
</script>
<#-- <script src="${base}/layui/layui.js"></script>-->
<script src="${base}/layui/layui.js"></script>
<script src="${base}/assets/js/project_common.js"></script>
<script src="${base}/assets/js/project_settle.js"></script>
<script src="${base}/assets/js/project_settle_valid.js"></script>
<script>
// layui.use('laydate', function(){
// var laydate = layui.laydate;
@ -425,16 +428,30 @@
// });
// });
$(function () {
calculateSettle();
$("#saveSettle").click(function () {
var result = valid();
console.log(result);
if (result) {
console.log("result: " + result);
$("#pmsForm").attr("action", "${base}/project/settle/save");
$("#pmsForm").submit();
} else {
return false;
}
});
$("#saveApprove").click(function () {
var result = valid();
if (result) {
$("#pmsForm").attr("action",base+"/project/settle/saveAndApprove");
$("#pmsForm").submit();
} else {
return false;
}
});
});

View File

@ -0,0 +1,44 @@
<#assign base=request.contextPath />
<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="time" autocomplete="off" value="${time!}">
</div>
</div>
</div>
<script src="../assets/js/jquery.ajaxfileupload.js"></script>
<script src="../assets/js/amazeui.switch.js"></script>
<script src="${base}/layui/layui.js"></script>
<script type="text/javascript">
layui.use('laydate', function(){
var laydate = layui.laydate;
laydate.render({
elem: '#time',
type: 'month',
btns: ['confirm'],
trigger: 'click',
ready: function(date){
console.log(date);
}
});
});
</script>