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

192 lines
7.6 KiB
Plaintext

@{
ViewBag.Title = "sqjkMessage";
}
@model dccdc.Models.sqqtbxModel
@section scripts{
<script type="text/javascript" src="@Url.Content("~/Scripts/public.js")"></script>
<script type="text/javascript">
$(function () {
$("#layout1").ligerLayout({ leftWidth: 300, topHeight: 130 });
$("#sqsj").ligerDateEditor({ format: "yyyy/MM/dd hh:mm:ss", showTime: true });
//$("#sqsj").ligerGetDateEditorManager().setValue(fun_date(0));
$("#dydh").focus(function () {
openf2 = $.ligerDialog.open({
title: "选择申请单(单击选中确定)",
url: "@Url.Action("choosqtbxfyzcView")",
width: 700,
height: 300
});
})
$("#grid2").ligerGrid({
height: "100%",
columns: [
{ display: "双击删除", name: "", align: "left", width: 60 },
//{ display: "经办人", name: "title", align: "left", width: 80, type: 'string', editor: { type: 'string' } },
{ display: "业务内容", name: "content", align: "left", width: 600, type: 'string', editor: { type: 'string' } },
{ display: "金额", name: "je", align: "right", width: 60, type: 'float', editor: { type: 'float' } }
],
url: "@Url.Action("getsqqtbxmx")?key=0000000&id=@Request.QueryString["id"]",
rownumber: true,
usePager: false,
enabledEdit: true,
toolbar: {
items: [
{ text: '增加', click: edit, icon: 'add' }
]
},
onDblClickRow: function (rowdata, rowid, rowobj) {
liger.get("grid2").remove(rowdata);
//计算
sum();
},
onAfterEdit: function (e) {
//计算
sum();
}
});
})
function edit(item) {
if (item.text === "增加") {
var rowdata = {};
rowdata.title = "";
rowdata.content = "";
rowdata.sl = 1;
rowdata.je = 0;
liger.get("grid2").add(rowdata);
}
}
function sum() {
var rows = liger.get("grid2").getData();
var result = 0;
for (var i in rows) {
result += parseFloat(rows[i].je);
}
$("#je").val(result.toFixed(2));
}
function save() {
liger.get("grid2").endEdit();
var rows = liger.get("grid2").getData();
if (rows.length == 0) {
$.ligerDialog.error("请添加明细!")
return;
}
for (var i in rows) {
if (rows[i].content == "") {
$.ligerDialog.error("明细内容必填!")
return;
}
}
var id = $("#id").val();
var je = $("#je").val();
var bz = $("#bz").val();
var fydh = $("#fydh").val();
var fydh2 = $("#fydh2").val();
var dydh = $("#dydh").val();
if (!je) {
$.ligerDialog.error("请填写详细信息!")
return;
}
if (je > sqje) {
$.ligerDialog.error("金额不能大于申请金额!")
return;
}
var items = "";
for (var i in rows) {
items += rows[i].title + "|" + rows[i].content + "|" + rows[i].sl + "|" + rows[i].je + ",";
}
$.ajax({
url: "@Url.Action("savesqqtbx")", type: "post", dataType: "json", data: { id: id, je: je, bz: bz, fydh: fydh, fydh2: fydh2, dydh: dydh, items: items },
success: function (d) {
$.ligerDialog.closeWaitting();
if (d.State == "0") {
$.ligerDialog.error("操作失败!");
}
else {
$.ligerDialog.success("操作成功!");
parent.init();
}
},
beforeSend: function () {
$.ligerDialog.waitting("正在进行请稍后……");
}
});
}
//弹出框选中
var sqje = 0;
function selectedQTBXFYZC(rowdata) {
$("#dydh").val(rowdata.id);
//项目经费赋值
$("#fydh").val(rowdata.fydh);
$("#je").val(rowdata.je);
sqje = rowdata.je;
openf2.close();
}
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="center" title="明细">
<div id="grid2"></div>
</div>
<div position="top">
@Html.HiddenFor(m => m.id)
@Html.HiddenFor(m => m.fydh)
@Html.HiddenFor(m => m.fydh2)
<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.sqr, 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.sqdh, 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.TextBoxFor(m => m.dydh, new { @class = "l-text", @readonly = "readonly" })</td>
<td class="ltd" width="70px">报销内容</td>
<td class="rtd" width="150px">@Html.TextAreaFor(m => m.bz, new { cols = "19", rows = "2" })</td>
<td class="ltd" width="70px"></td>
<td class="rtd" width="150px"><input type="@Request.QueryString["type"]" value="申请" style="height:50px" class="l-button" onclick="save()" /></td>
</tr>
</table>
</div>
</div>