zhangsiqi
4 months ago
9 changed files with 341 additions and 242 deletions
@ -1,127 +1,202 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" > |
|||
<head> |
|||
<th:block th:include="include :: header('新增公司成本')" /> |
|||
<th:block th:include="include :: header('修改公司成本')" /> |
|||
</head> |
|||
<body class="white-bg"> |
|||
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> |
|||
<form class="form-horizontal m" id="form-compantCost-add"> |
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label">公司成本ID:</label> |
|||
<div class="col-sm-8"> |
|||
<input name="ctcId" class="form-control" type="text"> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> |
|||
<form class="form-horizontal m" id="form-companyCost-add"> |
|||
<div class="container"> |
|||
<h2><strong>公司成本</strong></h2> |
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label">年份:</label> |
|||
<div class="col-sm-8"> |
|||
<input name="year" class="form-control" type="text"> |
|||
<input id="cost_add_year" name="costYear" class="form-control" type="number"> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label">月份:</label> |
|||
<div class="col-sm-8"> |
|||
<input name="month" class="form-control" type="text"> |
|||
<select id="cost_add_month" name="costMonth" class="form-control"> |
|||
<option value=1>1</option> |
|||
<option value=2>2</option> |
|||
<option value=3>3</option> |
|||
<option value=4>4</option> |
|||
<option value=5>5</option> |
|||
<option value=6>6</option> |
|||
<option value=7>7</option> |
|||
<option value=8>8</option> |
|||
<option value=9>9</option> |
|||
<option value=10>10</option> |
|||
<option value=11>11</option> |
|||
<option value=12>12</option> |
|||
</select> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label">备注:</label> |
|||
<div class="col-sm-8"> |
|||
<textarea name="remark" class="form-control"></textarea> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
</div> |
|||
|
|||
<div class="container"> |
|||
<h2><strong>经营成本</strong></h2> |
|||
<div class="form-group" hidden="hidden"> |
|||
<label class="col-sm-3 control-label">经营成本:</label> |
|||
<div class="col-sm-8"> |
|||
<input name="operatingCosts" class="form-control" type="text"> |
|||
<input id="operatingCosts" name="operatingCosts" class="form-control" type="number"> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<div class="form-group" > |
|||
<label class="col-sm-3 control-label">工资费用:</label> |
|||
<div class="col-sm-8"> |
|||
<input name="salaryExpenses" class="form-control" type="text"> |
|||
<input name="salaryExpenses" class="form-control" type="number"> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label">厂租费用:</label> |
|||
<div class="col-sm-8"> |
|||
<input name="factoryRentalFees" class="form-control" type="text"> |
|||
<input name="factoryRentalFees" class="form-control" type="number"> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label">税金费用:</label> |
|||
<div class="col-sm-8"> |
|||
<input name="taxExpenses" class="form-control" type="text"> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label">税金费用:</label> |
|||
<div class="col-sm-8"> |
|||
<input name="taxExpenses" class="form-control" type="number"> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label">工厂电费:</label> |
|||
<div class="col-sm-8"> |
|||
<input name="factoryElectricityFees" class="form-control" type="text"> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label">工厂电费:</label> |
|||
<div class="col-sm-8"> |
|||
<input name="factoryElectricityFees" class="form-control" type="number"> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
|
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label">其他费用:</label> |
|||
<div class="col-sm-8"> |
|||
<input name="ohterExpenses" class="form-control" type="text"> |
|||
<input name="ohterExpenses" class="form-control" type="number"> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
</div> |
|||
<div class="container"> |
|||
<h2><strong>业务成本</strong></h2> |
|||
<div class="form-group" hidden="hidden"> |
|||
<label class="col-sm-3 control-label">业务成本:</label> |
|||
<div class="col-sm-8"> |
|||
<input name="businessCost" class="form-control" type="text"> |
|||
<input id="businessCost" name="businessCost" class="form-control" type="number"> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label">运输费用:</label> |
|||
<div class="col-sm-8"> |
|||
<input name="transportationCosts" class="form-control" type="text"> |
|||
<input name="transportationCosts" class="form-control" type="number"> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label">推广费用:</label> |
|||
<div class="col-sm-8"> |
|||
<input name="promotionExpenses" class="form-control" type="text"> |
|||
<input name="promotionExpenses" class="form-control" type="number"> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label">包装费用:</label> |
|||
<div class="col-sm-8"> |
|||
<input name="packagingCost" class="form-control" type="text"> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label">包装费用:</label> |
|||
<div class="col-sm-8"> |
|||
<input name="packagingCost" class="form-control" type="number"> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label">业务费用:</label> |
|||
<div class="col-sm-8"> |
|||
<input name="businessExpenses" class="form-control" type="text"> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label">业务费用:</label> |
|||
<div class="col-sm-8"> |
|||
<input name="businessExpenses" class="form-control" type="number"> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label">售后费用:</label> |
|||
<div class="col-sm-8"> |
|||
<input name="afterSalesExpenses" class="form-control" type="text"> |
|||
<input name="afterSalesExpenses" class="form-control" type="number"> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label">业务提成:</label> |
|||
<div class="col-sm-8"> |
|||
<input name="businessCommission" class="form-control" type="text"> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label">备注:</label> |
|||
<div class="col-sm-8"> |
|||
<input name="remark" class="form-control" type="text"> |
|||
</div> |
|||
</div> |
|||
</form> |
|||
</div> |
|||
<th:block th:include="include :: footer" /> |
|||
<script th:inline="javascript"> |
|||
var prefix = ctx + "compantCost/compantCost" |
|||
$("#form-compantCost-add").validate({ |
|||
focusCleanup: true |
|||
}); |
|||
|
|||
function submitHandler() { |
|||
if ($.validate.form()) { |
|||
$.operate.save(prefix + "/add", $('#form-compantCost-add').serialize()); |
|||
} |
|||
<input name="businessCommission" class="form-control" type="number"> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</form> |
|||
</div> |
|||
<th:block th:include="include :: footer" /> |
|||
<script th:inline="javascript"> |
|||
var prefix = ctx + "financial/companyCost"; |
|||
// 获取当前年份 |
|||
let currentYear = new Date().getFullYear(); |
|||
// 计算当前世纪 |
|||
let currentCentury = Math.floor((currentYear - 1) / 100) + 1; |
|||
// 计算当前世纪中最大的年份 |
|||
let maxYearInCurrentCentury = currentCentury * 100; |
|||
$.validator.addMethod('validYear', function(value, element) { |
|||
return isValidYear(value); |
|||
}, '请输入1900至2100之间的四位数年份') |
|||
function isValidYear(year) { |
|||
// 检查年份是否在合理范围内 |
|||
return year >= 1900 && year <= maxYearInCurrentCentury; |
|||
} |
|||
$("#form-companyCost-add").validate({ |
|||
onkeyup: false, |
|||
rules:{ |
|||
costYear:{ |
|||
isInteger: true, |
|||
validYear: true, |
|||
remote: { |
|||
url: prefix + "/checkCompanyCostByYearMonth", |
|||
type: "post", |
|||
dataType: "json", |
|||
data: { |
|||
"costMonth": $.common.trim($("#cost_add_month").val()) |
|||
}, |
|||
dataFilter: function(data, type) { |
|||
return $.validate.unique(data); |
|||
} |
|||
} |
|||
}, |
|||
}, |
|||
messages: { |
|||
costYear: { |
|||
required: "请输入年份", |
|||
validYear: "请输入1900至2100之间的四位数年份", |
|||
remote: "该年月已存在" |
|||
}, |
|||
}, |
|||
focusCleanup: true |
|||
}); |
|||
//经营成本的经营成本内容的总和计算 |
|||
$("#form-companyCost-add").on('keyup', 'input', function () { |
|||
let salaryExpenses = parseFloat($("input[name='salaryExpenses']").val()) || 0; |
|||
let factoryRentalFees = parseFloat($("input[name='factoryRentalFees']").val()) || 0; |
|||
let taxExpenses = parseFloat($("input[name='taxExpenses']").val()) || 0; |
|||
let factoryElectricityFees = parseFloat($("input[name='factoryElectricityFees']").val()) || 0; |
|||
let ohterExpenses = parseFloat($("input[name='ohterExpenses']").val()) || 0; |
|||
$("#operatingCosts").val(salaryExpenses + factoryRentalFees + taxExpenses + factoryElectricityFees + ohterExpenses); |
|||
}); |
|||
//业务成本的业务成本的总和计算 |
|||
$("#form-companyCost-add").on('keyup', 'input', function () { |
|||
let transportationCosts = parseFloat($("input[name='transportationCosts']").val()) || 0; |
|||
let promotionExpenses = parseFloat($("input[name='promotionExpenses']").val()) || 0; |
|||
let packagingCost = parseFloat($("input[name='packagingCost']").val()) || 0; |
|||
let businessExpenses = parseFloat($("input[name='businessExpenses']").val()) || 0; |
|||
let afterSalesExpenses = parseFloat($("input[name='afterSalesExpenses']").val()) || 0; |
|||
let businessCommission = parseFloat($("input[name='businessCommission']").val()) || 0; |
|||
$("#businessCost").val(transportationCosts + promotionExpenses + packagingCost + businessExpenses + afterSalesExpenses + businessCommission); |
|||
}); |
|||
function submitHandler() { |
|||
if ($.validate.form()) { |
|||
$.operate.save(prefix + "/add", $('#form-companyCost-add').serialize()); |
|||
} |
|||
</script> |
|||
} |
|||
|
|||
</script> |
|||
</body> |
|||
</html> |
Loading…
Reference in new issue