tijian_tieying/web/dccdc/Views/sq2/sqMessage.cshtml
2025-02-20 12:14:39 +08:00

249 lines
11 KiB
Plaintext

@{
ViewBag.Title = "项目经费申请";
}
@model dccdc.Models.xmjfsysqModel
@section scripts{
<script type="text/javascript" src="@Url.Content("~/Scripts/public.js")"></script>
<script type="text/javascript">
$(function () {
$("#layout1").ligerLayout({ leftWidth: 300, topHeight: 220 });
$("#sqsj").ligerDateEditor({ format: "yyyy/MM/dd hh:mm:ss", showTime: true });
//$("#sqsj").ligerGetDateEditorManager().setValue(fun_date(0));
$("#btSelect").click(function () {
liger.get("grid1").set("parms", { key: $("#jfmc").val(), key1: $("#jflb").val() });
liger.get("grid1").reload();
})
$("#jfmc").keydown(function (e) {
var curKey = e.which;
if (curKey == 13) {
liger.get("grid1").set("parms", { key: $("#jfmc").val(), key1: $("#jflb").val() });
liger.get("grid1").reload();
return false;
}
});
$("#grid1").ligerGrid({
height: "100%",
columns: [
{ display: "经费名称", name: "xmmc", align: "left", width: 100 },
{ display: "收入金额", name: "srje", align: "right", width: 60, },
{ display: "花费金额", name: "hfje", align: "right", width: 60, },
{ display: "剩余金额", align: "right", width: 60, render: function (r, i, v) { return (r.srje - r.hfje).toFixed(2) } }
],
url: "@Url.Action("getxmjfbykey")",
rownumber: true,
usePager: false,
onDblClickRow: function (rowdata, rowid, rowobj) {
var rows = liger.get("grid2").getData();
for (var i in rows) {
if (rows[i].id == rowdata.id)
return;
}
//申请金额
if (rowdata.sqje == undefined || rowdata.sqje == 0)
rowdata.sqje = 0;
liger.get("grid2").add(rowdata); //不使用副本 使用引用
//计算
sum();
}
});
$("#grid2").ligerGrid({
height: "100%",
columns: [
{ display: "id", name: "id", align: "left", width: 40 },
{ display: "经费名称", name: "xmmc", align: "left", width: 100 },
{ display: "申请金额", name: "sqje", align: "right", width: 60, type: 'float', editor: { type: 'float' } }
],
url: "@Url.Action("getxmjfbykey")?key=0000000&id=@Request.QueryString["id"]",
rownumber: true,
usePager: false,
enabledEdit: true,
onDblClickRow: function (rowdata, rowid, rowobj) {
liger.get("grid2").remove(rowdata);
//计算
sum();
},
onAfterEdit: function (e) {
//计算
sum();
}
});
})
function sum() {
var rows = liger.get("grid2").getData();
var result = 0;
for (var i in rows) {
result += rows[i].sqje;
}
$("#je").val(result.toFixed(2));
}
function save() {
//liger.get("grid2").endEdit();
//var rows = liger.get("grid2").getData();
//if (rows.length == 0) {
// $.ligerDialog.error("请添加经费项目!")
// return;
//}
//var rowold = liger.get("grid1").getData();
//for (var i in rows) {
// for (var j in rowold) {
// if (rows[i].id == rowold[j].id && rows[i].sqje > (rowold[j].srje - rowold[j].hfje).toFixed(2)) {
// $.ligerDialog.error("申请费用超了!")
// return;
// }
// }
//}
var id = $("#id").val();
var je = $("#je").val();
var bz = $("#bz").val();
var bz1 = $("#bz1").val();
var bz2 = $("#bz2").val();
var bz3 = $("#bz3").val();
var bz4 = $("#bz4").val();
var bz5 = $("#bz5").val();
var bz6 = $("#bz6").val();
if (!je) {
$.ligerDialog.error("请填写详细信息!")
return;
}
var items = "";
//for (var i in rows) {
// items += rows[i].id + "|" + rows[i].xmmc + "|" + rows[i].sqje + ",";
//}
var del = GetQueryString("del");
$.ajax({
url: "@Url.Action("savesq")", type: "post", dataType: "json", data: { id: id, je: je, bz: bz, bz1: bz1, bz2: bz2, bz3: bz3, bz4: bz4, bz5: bz5, bz6: bz6, items: items, del: del },
success: function (d) {
$.ligerDialog.closeWaitting();
if (d.State == "0") {
$.ligerDialog.error(d.Message);
}
else {
if (del) {
if (window.parent.selectedData) {
window.parent.selectedData("xmjf", d.id);
}
}
else {
parent.init();
}
}
},
beforeSend: function () {
$.ligerDialog.waitting("正在进行请稍后……");
}
});
}
//js对象深度克隆
var deepCopy = function (source) {
var result = {};
for (var key in source) {
result[key] = typeof source[key] === 'object' ? deepCopy(source[key]) : source[key];
}
return result;
}
function fun_date(days) {
var date1 = new Date(),
time1 = date1.getFullYear() + "-" + (date1.getMonth() + 1) + "-" + date1.getDate();//time1表示当前时间
var date2 = new Date(date1);
date2.setDate(date1.getDate() + days);
var y = date2.getFullYear();
var m = date2.getMonth() + 1;
m = m < 10 ? '0' + m : m;
var d = date2.getDate();
d = d < 10 ? ('0' + d) : d;
var time2 = y + "-" + m + "-" + d;
return time2;
}
</script>
}
<div class="l-clear"></div>
<div id="layout1">
@*<div position="left">
<table class="t1" style="width:100%">
<tr>
<td class="ltd" width="70px">经费类别</td>
<td class="rtd">@Html.DropDownList("jflb", ViewBag.xmjflbD as SelectList, "----请选择----", new { @class = "l-text" })</td>
<td class="rtd" rowspan="2"><input type="button" id="btSelect" value="查询" class="l-button" style="height:46px" /></td>
</tr>
<tr>
<td class="ltd" width="70px">经费名称</td>
<td class="rtd">@Html.TextBox("jfmc", "", new { @class = "l-text" })</td>
</tr>
</table>
<div id="grid1"></div>
</div>
<div position="center" title="经费明细(双击增删)">
<div id="grid2"></div>
</div>*@
<div position="top">
@Html.HiddenFor(m => m.id)
<table class="t1" style="width:100%">
<tr>
<td class="ltd" width="70px">申请科室</td>
<td class="rtd" width="150px">@Html.TextBoxFor(m => m.ksmc, new { @class = "l-text", @readonly = "readonly" })</td>
<td class="ltd" width="70px">申请单号</td>
<td class="rtd" width="150px">@Html.TextBoxFor(m => m.sqdh, new { @class = "l-text", @readonly = "readonly" })</td>
<td class="ltd" width="70px">申请日期</td>
<td class="rtd" width="150px">@Html.TextBoxFor(m => m.sqsj, new { @class = "l-text", @readonly = "readonly" })</td>
</tr>
<tr>
<td class="ltd" width="70px">申请人</td>
<td class="rtd" width="150px">@Html.TextBoxFor(m => m.sqr, new { @class = "l-text", @readonly = "readonly" })</td>
<td class="ltd" width="70px">申请状态</td>
<td class="rtd" width="150px">@Html.DropDownListFor(m => m.zt, ViewBag.ztD as SelectList, "----请选择----", new { @class = "l-text", @disabled = "disabled" })</td>
<td class="ltd" width="70px">申请金额</td>
<td class="rtd" width="150px">@Html.TextBoxFor(m => m.je, new { @class = "l-text l-text-field-number", @type = "number" })</td>
</tr>
<tr>
<td class="ltd" width="70px">拟申请内容</td>
<td class="rtd" width="150px">@Html.TextAreaFor(m => m.bz, new { @rows = "2" })</td>
<td class="ltd" width="70px">申请依据</td>
<td class="rtd" width="150px">@Html.TextAreaFor(m => m.bz1, new { rows = "2" })</td>
<td class="ltd" width="70px">项目要求</td>
<td class="rtd" width="150px">@Html.TextAreaFor(m => m.bz2, new { rows = "2" })</td>
</tr>
<tr>
<td class="ltd" width="70px">执行科室</td>
<td class="rtd" width="150px">@Html.TextAreaFor(m => m.bz3, new { rows = "1" })</td>
<td class="ltd" width="70px">配合部门</td>
<td class="rtd" width="150px">@Html.TextAreaFor(m => m.bz4, new { rows = "1" })</td>
<td class="ltd" width="70px">执行情况</td>
<td class="rtd" width="150px">@Html.TextAreaFor(m => m.bz5, new { rows = "1" })</td>
</tr>
<tr>
<td class="ltd" width="70px">内容</td>
<td class="rtd" width="150px">@Html.TextAreaFor(m => m.bz6, new { @rows = "2" })</td>
<td class="ltd" width="70px">备注</td>
<td class="rtd" width="150px">@Html.TextArea("aaaaaaaa", new { rows = "2" })</td>
<td class="ltd" width="70px"></td>
<td class="rtd" width="150px"><input id="save" type="@(String.IsNullOrEmpty(Request.QueryString["type"])?"button":Request.QueryString["type"])" value="申请" style="height:50px" class="l-button" onclick="save()" /></td>
</tr>
</table>
</div>
</div>
<div style="display:none;"></div>
<div class="dispReport">
<object classid="clsid:F6A015E2-092A-4006-93DA-4CBDE3AFF4B8" id="window.top.Formium.external.Print" width="300" height="50"></object>
</div>