421 lines
18 KiB
Plaintext
421 lines
18 KiB
Plaintext
|
|
@{
|
|
ViewBag.Title = "sqccbxMessage";
|
|
}
|
|
|
|
@model dccdc.Models.sqccbxModel
|
|
@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));
|
|
|
|
$("#fyly").change(function () {
|
|
var select = $("#fyly").val();
|
|
|
|
$("#fydh").val("");
|
|
$("#fydh2").val("");
|
|
var url = "";
|
|
switch (select) {
|
|
case "项目经费": url = "@Url.Action("choosexmjfView", "jingfei")"; break;
|
|
case "三重一大": url = "@Url.Action("chooseszydView", "jingfei")"; break;
|
|
}
|
|
if (url == "")
|
|
return;
|
|
$.ligerDialog.success("暂不开放!");
|
|
return;
|
|
openf2 = $.ligerDialog.open({
|
|
title: "选择申请单",
|
|
url: url,
|
|
width: 500,
|
|
height: 400
|
|
});
|
|
})
|
|
$("#dydh").focus(function () {
|
|
openf2 = $.ligerDialog.open({
|
|
title: "选择申请单(单击选中确定)",
|
|
url: "@Url.Action("choosccsqView")?type=ccbx",
|
|
width: 700,
|
|
height: 400
|
|
});
|
|
})
|
|
|
|
//var kemuD = @Html.Raw(ViewBag.kemuD);
|
|
var jtgjD = @Html.Raw(ViewBag.jtgjD);
|
|
$("#grid2").ligerGrid({
|
|
height: "100%",
|
|
columns: [
|
|
{ display: "双击删除", name: "", align: "left", width: 60 },
|
|
{ display: "开始时间", name: "begint", align: "left", width: 86, type: 'date', format: 'yyyy-MM-dd'
|
|
//, editor: { type: 'date' }
|
|
},
|
|
{ display: "结束时间", name: "endt", align: "left", width: 86, type: 'date', format: 'yyyy-MM-dd'
|
|
//, editor: { type: 'date' }
|
|
},
|
|
{ display: "起点", name: "begind", align: "left", width: 100, type: 'string' },
|
|
{ display: "终点", name: "endd", align: "left", width: 100, type: 'string' },
|
|
{
|
|
display: "交通工具", name: "gongju", align: "left", width: 70, type: 'string',
|
|
editor: { type: 'select', data: jtgjD, valueField: 'title', textField: 'title' }
|
|
},
|
|
{ display: "张数", name: "count", align: "right", width: 60, type: 'float', editor: { type: 'float' } },
|
|
{ display: "金额", name: "je", align: "right", width: 60, type: 'float', editor: { type: 'float' } },
|
|
{ display: "包含餐补", name: "havecb", align: "left", width: 60, type: 'string',
|
|
render: function (r, i, v) {
|
|
if (v) {
|
|
return "包含";
|
|
}
|
|
else{
|
|
return "不包含";
|
|
}
|
|
}
|
|
},
|
|
{
|
|
display: "项目", name: "xiangmu", align: "left", width: 90, type: 'string'
|
|
//,editor: { type: 'select', data: kemuD, valueField: 'title', textField: 'title' }
|
|
},
|
|
{ display: "人数", name: "rs", align: "right", width: 60, type: 'float'
|
|
//, editor: { type: 'float' }
|
|
},
|
|
{ display: "天数", name: "ts", align: "right", width: 60, type: 'float'
|
|
//, editor: { type: 'float' }
|
|
},
|
|
{ display: "标准", name: "bz", align: "right", width: 60, type: 'float'
|
|
//, editor: { type: 'float' }
|
|
},
|
|
{ display: "金额", name: "je2", align: "right", width: 60, type: 'float'
|
|
//, editor: { type: 'float' }
|
|
},
|
|
{
|
|
display: "其他", name: "qt", align: "left", width: 90, type: 'string'
|
|
//, editor: { type: 'select', data: kemuD, valueField: 'title', textField: 'title' }
|
|
},
|
|
{ display: "金额", name: "je3", align: "right", width: 60, type: 'float'
|
|
//, editor: { type: 'float' }
|
|
},
|
|
],
|
|
url: "@Url.Action("getsqccbxMx")?key=0000000&id=@Request.QueryString["id"]",
|
|
rownumber: true,
|
|
usePager: false,
|
|
enabledEdit: true,
|
|
toolbar: {
|
|
items: [
|
|
//{ text: '增加', click: edit, icon: 'add' },
|
|
//{ line: true },
|
|
{ text: '增加车票', click: function(){ message(1,'增加车票')}, icon: 'add' },
|
|
{ line: true },
|
|
{ text: '增加其他', click: function(){ message(2,'增加其他')}, 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.begint = "";
|
|
rowdata.endt = "";
|
|
rowdata.begind = "";
|
|
rowdata.endd = "";
|
|
rowdata.havecb = false;
|
|
rowdata.gongju = "";
|
|
rowdata.count = 0;
|
|
rowdata.je = 0;
|
|
rowdata.xiangmu = "";
|
|
rowdata.rs = 0;
|
|
rowdata.ry = "";
|
|
rowdata.ts = 0;
|
|
rowdata.bz = 0;
|
|
rowdata.bz2 = 0;
|
|
rowdata.je2 = 0;
|
|
rowdata.qt = "";
|
|
rowdata.je3 = 0;
|
|
liger.get("grid2").add(rowdata);
|
|
sum();
|
|
}
|
|
}
|
|
function message(type,title) {
|
|
var url = "@Url.Action("sqccbxMessage2")?type=" + type;
|
|
openf2 = $.ligerDialog.open({
|
|
title: title,
|
|
url: url,
|
|
width: 550,
|
|
height: 380
|
|
});
|
|
}
|
|
//弹出框选中
|
|
var je3zs=0; //住宿总额
|
|
function selectedData(type, rowdata) {
|
|
if(type=="0"){
|
|
openf2.close();
|
|
return
|
|
}
|
|
|
|
var rowdata2 = {};
|
|
rowdata2.begint = "";
|
|
rowdata2.endt = "";
|
|
rowdata2.begind = "";
|
|
rowdata2.endd = "";
|
|
rowdata2.havecb = false;
|
|
rowdata2.gongju = "";
|
|
rowdata2.count = 0;
|
|
rowdata2.je = 0;
|
|
rowdata2.xiangmu = "";
|
|
rowdata2.rs = 0;
|
|
rowdata2.ry = "";
|
|
rowdata2.ts = 0;
|
|
rowdata2.bz = 0;
|
|
rowdata2.bz2 = 0;
|
|
rowdata2.je2 = 0;
|
|
rowdata2.qt = "";
|
|
rowdata2.je3 = 0;
|
|
|
|
var rows= liger.get("grid2").getData();
|
|
var have=false;
|
|
if (type == "1"){
|
|
for(var i in rows){
|
|
if(!rows[i].begind && !rows[i].endd && !rows[i].gongju){
|
|
liger.get("grid2").updateCell("begint", rowdata.begint, i);
|
|
liger.get("grid2").updateCell("endt", rowdata.endt, i);
|
|
liger.get("grid2").updateCell("begind", rowdata.begind, i);
|
|
liger.get("grid2").updateCell("endd", rowdata.endd, i);
|
|
liger.get("grid2").updateCell("havecb", rowdata.havecb, i);
|
|
liger.get("grid2").updateCell("gongju", rowdata.gongju, i);
|
|
liger.get("grid2").updateCell("count", rowdata.count, i);
|
|
liger.get("grid2").updateCell("je", rowdata.je, i);
|
|
|
|
liger.get("grid2").updateCell("xiangmu", rowdata.xiangmu, i);
|
|
liger.get("grid2").updateCell("rs", rowdata.rs, i);
|
|
liger.get("grid2").updateCell("ry", rowdata.ry, i);
|
|
liger.get("grid2").updateCell("ts", rowdata.ts, i);
|
|
liger.get("grid2").updateCell("bz", rowdata.bz, i);
|
|
liger.get("grid2").updateCell("bz2", rowdata.bz2, i);
|
|
liger.get("grid2").updateCell("je2", rowdata.je2, i);
|
|
have=true;
|
|
break;
|
|
}
|
|
}
|
|
if(!have){
|
|
rowdata2.begint = rowdata.begint;
|
|
rowdata2.endt = rowdata.endt;
|
|
rowdata2.begind = rowdata.begind;
|
|
rowdata2.endd = rowdata.endd;
|
|
rowdata2.havecb = rowdata.havecb;
|
|
rowdata2.gongju = rowdata.gongju;
|
|
rowdata2.count = rowdata.count;
|
|
rowdata2.je = rowdata.je;
|
|
|
|
rowdata2.xiangmu = rowdata.xiangmu;
|
|
rowdata2.rs = rowdata.rs;
|
|
rowdata2.ry = rowdata.ry;
|
|
rowdata2.ts = rowdata.ts;
|
|
rowdata2.bz = rowdata.bz;
|
|
rowdata2.bz2 = rowdata.bz2;
|
|
rowdata2.je2 = rowdata.je2;
|
|
|
|
//增加时 自带交通费
|
|
if(rowdata2.endd.indexOf("山东省")>=0){
|
|
rowdata2.qt = "省内交通费";
|
|
rowdata2.je3 = 60;
|
|
}
|
|
else{
|
|
rowdata2.qt = "省外交通费";
|
|
rowdata2.je3 = 80;
|
|
}
|
|
liger.get("grid2").add(rowdata2);
|
|
}
|
|
|
|
//计算天数与餐补总额 (包含餐费与不包含)
|
|
je3zs=0;
|
|
rows= liger.get("grid2").getData();
|
|
for(var i in rows){
|
|
if(i==rows.length-1)
|
|
break;
|
|
var time1= new Date(dateFormat(rows[i].endt));
|
|
var time2= new Date(dateFormat(rows[parseInt(i)+1].endt));
|
|
var ts=parseInt(time2 - time1) / 1000 / 60 / 60 / 24;
|
|
liger.get("grid2").updateCell("ts", ts, i);
|
|
if(rows[i].havecb)
|
|
liger.get("grid2").updateCell("je2", rows[i].rs*ts*rows[i].bz, i); //ts 要用刚刚计算的
|
|
je3zs += rows[i].rs*ts*rows[i].bz2;
|
|
}
|
|
|
|
}
|
|
if (type == "2") {
|
|
//住宿最大判断
|
|
if(rowdata.qt.indexOf("住宿")>=0 && rowdata.je3>je3zs){
|
|
$.ligerDialog.error("住宿费最大为:"+je3zs);
|
|
return;
|
|
}
|
|
|
|
for(var i in rows){
|
|
if(!rows[i].qt){
|
|
liger.get("grid2").updateCell("qt", rowdata.qt, i);
|
|
liger.get("grid2").updateCell("je3", rowdata.je3, i);
|
|
have=true;
|
|
break;
|
|
}
|
|
}
|
|
if(!have){
|
|
rowdata2.qt = rowdata.qt;
|
|
rowdata2.je3 = rowdata.je3;
|
|
liger.get("grid2").add(rowdata2);
|
|
}
|
|
}
|
|
sum();
|
|
|
|
openf2.close();
|
|
}
|
|
|
|
|
|
function sum() {
|
|
var rows = liger.get("grid2").getData();
|
|
var result = 0;
|
|
for (var i in rows) {
|
|
result += parseFloat(rows[i].je) + parseFloat(rows[i].je2) + parseFloat(rows[i].je3);
|
|
}
|
|
$("#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].title == "") {
|
|
$.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;
|
|
}
|
|
|
|
var items = "";
|
|
for (var i in rows) {
|
|
items += dateFormat(rows[i].begint) + "|" + dateFormat(rows[i].endt) + "|" + rows[i].begind + "|" + rows[i].endd + "|" + rows[i].havecb + "|" + rows[i].gongju + "|" + rows[i].count + "|" + rows[i].je + "|" + rows[i].xiangmu + "|" + rows[i].rs+ "|" + rows[i].ry + "|" + rows[i].ts + "|" + rows[i].bz + "|" + rows[i].bz2 + "|" + rows[i].je2 + "|" + rows[i].qt + "|" + rows[i].je3 + ",";
|
|
}
|
|
$.ajax({
|
|
url: "@Url.Action("savesqccbx")", type: "post", dataType: "json", data: { id: id, je: je, fyly: "", fydh: fydh, fydh2: fydh2, dydh: dydh, bz: bz, items: items },
|
|
success: function (d) {
|
|
$.ligerDialog.closeWaitting();
|
|
if (d.State == "0") {
|
|
$.ligerDialog.error("操作失败!");
|
|
}
|
|
else {
|
|
$.ligerDialog.success("操作成功!");
|
|
parent.init();
|
|
}
|
|
},
|
|
beforeSend: function () {
|
|
$.ligerDialog.waitting("正在进行请稍后……");
|
|
}
|
|
});
|
|
}
|
|
|
|
//弹出框选中
|
|
function selectedCCSQ(rowdata) {
|
|
$("#dydh").val(rowdata.id);
|
|
//项目经费赋值
|
|
$("#fydh").val(rowdata.fydh);
|
|
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;
|
|
}
|
|
|
|
function dateFormat(olddate) {
|
|
console.log(olddate);
|
|
var date = new Date();
|
|
if (olddate) {
|
|
//Date(1532880000000)
|
|
if (olddate.toString().indexOf("/Date(") >= 0){
|
|
date = new Date(parseInt(olddate.replace("/Date(", "").replace(")/", ""), 10));
|
|
var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
|
|
var currentDate = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
|
|
return date.getFullYear() + "-" + month + "-" + currentDate;
|
|
}
|
|
|
|
date = new Date(olddate);
|
|
}
|
|
return date_value = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate() + ' ' + date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds();
|
|
//yyyy-MM-dd hh:mm:ss
|
|
}
|
|
|
|
</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.DropDownListFor(m => m.fyly, ViewBag.fylyD as SelectList, "----请选择----", new { @class = "l-text" })</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", @readonly = "readonly" })</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 = "18", 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>
|
|
|
|
|