2021-11-03 09:53:27 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* 一个收入详情的字段
|
|
|
|
|
|
*/
|
2021-12-09 11:49:42 +00:00
|
|
|
|
//INCOME_DETAIL_ARR=["type","name","unit","amount","price","taxRate","totalTaxInclude","totalTaxExclude"];
|
|
|
|
|
|
INCOME_DETAIL={
|
|
|
|
|
|
"type":[true,"类别"],
|
|
|
|
|
|
"name":[true,"名称"],
|
|
|
|
|
|
"unit":[true,"单位"],
|
|
|
|
|
|
"amount":[true,"数量"],
|
|
|
|
|
|
"price":[true,"单价"],
|
|
|
|
|
|
"taxRate":[true,"税率"],
|
|
|
|
|
|
"totalTaxInclude":[true,"含税总金额"],
|
|
|
|
|
|
"totalTaxExclude":[true,"不含税金额"]
|
|
|
|
|
|
};
|
2021-11-03 09:53:27 +00:00
|
|
|
|
|
2021-11-03 10:02:44 +00:00
|
|
|
|
$(function () {
|
|
|
|
|
|
$("#income-detail").click(function () {
|
|
|
|
|
|
$('#my-prompt-income-detail').modal({
|
|
|
|
|
|
relatedTarget: this,
|
2021-12-08 08:35:49 +00:00
|
|
|
|
closeOnConfirm:false,
|
2021-11-03 10:02:44 +00:00
|
|
|
|
onConfirm: function(e) {
|
|
|
|
|
|
//不能使用e.data,因为无法获取动态添加的
|
|
|
|
|
|
var data = collectData("am-modal-prompt-input-income");
|
2021-12-09 11:49:42 +00:00
|
|
|
|
//data = prepareAjaxData(data, INCOME_DETAIL_ARR, $("#id").val(),false);
|
|
|
|
|
|
data = prepareAjaxDataVerify(data, INCOME_DETAIL, $("#id").val());
|
|
|
|
|
|
if(data.details){
|
|
|
|
|
|
postAjax(base+"/project/budgetEditSaveIncomeDetail", data, updateIncomeData);
|
|
|
|
|
|
}
|
2021-11-03 10:02:44 +00:00
|
|
|
|
},
|
|
|
|
|
|
onCancel: function(e) {
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
});
|
|
|
|
|
|
$("#incomeAddBtn").click(function () {
|
|
|
|
|
|
appendTrIncome();
|
|
|
|
|
|
});
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-11-03 09:53:27 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* 更新页面收入的数据【累加】
|
|
|
|
|
|
*/
|
2021-11-08 06:41:33 +00:00
|
|
|
|
function updateIncomeData(data,returnData) {
|
|
|
|
|
|
var incomeDetails = data.details;
|
2021-11-03 09:53:27 +00:00
|
|
|
|
var deviceTaxInclude = 0;
|
|
|
|
|
|
var deviceTaxExclude = 0;
|
|
|
|
|
|
var engineerTaxInclude = 0;
|
|
|
|
|
|
var engineerTaxExclude = 0;
|
|
|
|
|
|
var serviceTaxInclude = 0;
|
|
|
|
|
|
var serviceTaxExclude = 0;
|
|
|
|
|
|
incomeDetails.forEach(function (t, number, ts) {
|
|
|
|
|
|
if(t["type"] == "1"){
|
|
|
|
|
|
//设备类
|
2021-11-05 09:01:26 +00:00
|
|
|
|
deviceTaxInclude += f2(t["totalTaxInclude"]);
|
|
|
|
|
|
deviceTaxExclude += f2(t["totalTaxExclude"]);
|
2021-11-03 09:53:27 +00:00
|
|
|
|
}else if(t["type"] == "2"){
|
|
|
|
|
|
//工程类
|
2021-11-05 09:01:26 +00:00
|
|
|
|
engineerTaxInclude += f2(t["totalTaxInclude"]);
|
|
|
|
|
|
engineerTaxExclude += f2(t["totalTaxExclude"]);
|
2021-11-03 09:53:27 +00:00
|
|
|
|
}else if(t["type"] == "3"){
|
|
|
|
|
|
//服务类
|
2021-11-05 09:01:26 +00:00
|
|
|
|
serviceTaxInclude += f2(t["totalTaxInclude"]);
|
|
|
|
|
|
serviceTaxExclude += f2(t["totalTaxExclude"]);
|
2021-11-03 09:53:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
});
|
2021-11-06 13:49:44 +00:00
|
|
|
|
$("input[name='incomeDeviceTaxInclude']").val(f2(deviceTaxInclude));
|
|
|
|
|
|
$("input[name='incomeDeviceTaxExclude']").val(f2(deviceTaxExclude));
|
|
|
|
|
|
$("input[name='incomeEngineerTaxInclude']").val(f2(engineerTaxInclude));
|
|
|
|
|
|
$("input[name='incomeEngineerTaxExclude']").val(f2(engineerTaxExclude));
|
|
|
|
|
|
$("input[name='incomeServiceTaxInclude']").val(f2(serviceTaxInclude));
|
|
|
|
|
|
$("input[name='incomeServiceTaxExclude']").val(f2(serviceTaxExclude));
|
2021-11-03 09:53:27 +00:00
|
|
|
|
|
2021-11-06 06:45:57 +00:00
|
|
|
|
$("input[name='incomeTotalTaxInclude']").val(f2(deviceTaxInclude+engineerTaxInclude+serviceTaxInclude));
|
|
|
|
|
|
$("input[name='incomeTotalTaxExclude']").val(f2(deviceTaxExclude+engineerTaxExclude+serviceTaxExclude));
|
|
|
|
|
|
|
2021-11-30 06:23:20 +00:00
|
|
|
|
|
2021-12-06 08:48:05 +00:00
|
|
|
|
$(".input-total-title-sale-income-budget-plan").val($("input[name='incomeTotalTaxInclude']").val());
|
|
|
|
|
|
$(".input-total-title-total-income-budget-plan").val(f2($("input[name='incomeTotalTaxInclude']").val())
|
2021-11-30 06:23:20 +00:00
|
|
|
|
+f2($(".input-total-title-earnest-money-income-budget-plan").val()));
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-11-06 06:45:57 +00:00
|
|
|
|
updateProjectContributionProfitRate();
|
2021-12-01 09:08:52 +00:00
|
|
|
|
|
2021-12-09 12:09:45 +00:00
|
|
|
|
layuiAlert("保存成功");
|
2021-12-08 08:47:19 +00:00
|
|
|
|
$('#my-prompt-income-detail').modal('close');
|
2021-11-03 09:53:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 收入明细增加一行
|
|
|
|
|
|
*/
|
|
|
|
|
|
function appendTrIncome() {
|
|
|
|
|
|
var template = '<tr>\n' +
|
|
|
|
|
|
' <td>\n' +
|
2021-12-01 10:58:47 +00:00
|
|
|
|
' <select style="width: 80px;float: left;" class="am-modal-prompt-input am-modal-prompt-input-income">\n' +
|
2021-11-03 09:53:27 +00:00
|
|
|
|
' <option value="1">设备类</option>\n' +
|
|
|
|
|
|
' <option value="2">工程类</option>\n' +
|
|
|
|
|
|
' <option value="3">服务类</option>\n' +
|
|
|
|
|
|
' </select>\n' +
|
|
|
|
|
|
' </td>\n' +
|
|
|
|
|
|
' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-income"></td>\n' +
|
|
|
|
|
|
' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-income"></td>\n' +
|
2021-12-09 05:11:12 +00:00
|
|
|
|
' <td><input type="number" min="0" max="99999999" step="1" maxlength="8" class="am-modal-prompt-input am-modal-prompt-input-income input-changeable-amount"></td>\n' +
|
|
|
|
|
|
' <td><input type="number" min="0.00" max="9999999999.99" step="0.01" maxlength="13" class="am-modal-prompt-input am-modal-prompt-input-income input-changeable-price"></td>\n' +
|
|
|
|
|
|
' <td><input type="number" min="0.00" max="99.99" step="0.01" maxlength="5" class="am-modal-prompt-input am-modal-prompt-input-income input-changeable-tax-rate"></td>\n' +
|
2021-11-03 09:53:27 +00:00
|
|
|
|
' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-income input-changeable-total-tax-include" readonly></td>\n' +
|
|
|
|
|
|
' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-income input-changeable-total-tax-exclude" readonly></td>\n' +
|
2021-11-04 02:32:16 +00:00
|
|
|
|
' <td><button type="button" class="am-btn am-btn-warning am-btn-xs am-round am-modal-line-delete"><span class="am-icon-minus"></span></button></td>\n' +
|
2021-11-03 09:53:27 +00:00
|
|
|
|
' </tr>';
|
|
|
|
|
|
$("#incomeTable").append(template);
|
|
|
|
|
|
//重新绑定删除事件和input修改事件
|
|
|
|
|
|
bindDeleteBtn();
|
|
|
|
|
|
bindChangeableInput();
|
2021-11-24 12:22:07 +00:00
|
|
|
|
//绑定数字输入框保留两位小数
|
|
|
|
|
|
bindNumberInput();
|
2021-11-03 09:53:27 +00:00
|
|
|
|
}
|