|
|
|
|
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="GZ_SalaryImport.aspx.cs" Inherits="TradeManage.SysManage.GZ_SalaryImport" %>
|
|
|
|
|
|
|
|
|
|
<!DOCTYPE html>
|
|
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
|
|
|
<head id="Head1" runat="server">
|
|
|
|
|
<title>导入</title>
|
|
|
|
|
<link rel="stylesheet" type="text/css" href="../themes/default/easyui.css" />
|
|
|
|
|
<link rel="stylesheet" type="text/css" href="../themes/icon.css" />
|
|
|
|
|
<link rel="stylesheet" type="text/css" href="../themes/New.css" />
|
|
|
|
|
<link rel="stylesheet" type="text/css" href="../themes/DataGrid.css" />
|
|
|
|
|
<link rel="stylesheet" type="text/css" href="../Scripts/fancybox/jquery.fancybox-1.3.4.css" />
|
|
|
|
|
<script src="../Scripts/MicrosoftAjax.js" type="text/javascript"></script>
|
|
|
|
|
<script src="../Scripts/jquery.min.js" type="text/javascript"></script>
|
|
|
|
|
<script src="../Scripts/jquery.easyui.min.js" type="text/javascript"></script>
|
|
|
|
|
<script src="../Scripts/DataGrid.js" type="text/javascript"></script>
|
|
|
|
|
<script src="../Scripts/DataPager.js" type="text/javascript"></script>
|
|
|
|
|
<script src="../Scripts/Global.js" type="text/javascript"></script>
|
|
|
|
|
<script src="../Scripts/ajaxfileupload.js" type="text/javascript"></script>
|
|
|
|
|
<script src="../Scripts/jquery.bgiframe.min.js" type="text/javascript"></script>
|
|
|
|
|
|
|
|
|
|
<script src="../Scripts/WindowLoad.js" type="text/javascript"></script>
|
|
|
|
|
<script src="../Scripts/fancybox/jquery.fancybox-1.3.4.js" type="text/javascript"></script>
|
|
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
var WindowLoadModel = new WindowLoad();
|
|
|
|
|
var DateTimeNow = new Date();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$(document).ready(function () {
|
|
|
|
|
WindowLoadModel.ApplicationPath = "../";
|
|
|
|
|
WindowLoadModel.ControlID = "WindowLoad";
|
|
|
|
|
WindowLoadModel.Isbgiframe = true;
|
|
|
|
|
WindowLoadModel.Load();
|
|
|
|
|
ajaxInit(WindowLoadModel);
|
|
|
|
|
|
|
|
|
|
BindSYears();
|
|
|
|
|
BindSMonth();
|
|
|
|
|
|
|
|
|
|
// BuildSalaryName();
|
|
|
|
|
|
|
|
|
|
//导入
|
|
|
|
|
$("#cmdImport").click(function () {
|
|
|
|
|
ajaxFileUpload();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//导出
|
|
|
|
|
//$("#cmdExport").click(function () {
|
|
|
|
|
// ExportSalary();
|
|
|
|
|
//});
|
|
|
|
|
|
|
|
|
|
$("#SYear").bind("change", function () {
|
|
|
|
|
BuildSalaryName();
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
$("#SMonth").bind("change", function () {
|
|
|
|
|
BuildSalaryName();
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//绑定年份
|
|
|
|
|
function BindSYears() {
|
|
|
|
|
var years = new Sys.StringBuilder();
|
|
|
|
|
var year = DateTimeNow.getFullYear();
|
|
|
|
|
var i = year;
|
|
|
|
|
for (i=2010; i<2050; i++) {
|
|
|
|
|
if (i === year) {
|
|
|
|
|
years.append("<option value='" + i + "' selected='selected'>" + i + "年</option>");
|
|
|
|
|
} else {
|
|
|
|
|
years.append("<option value='" + i + "'>" + i + "年</option>");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$("#SYear").html(years.toString());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//绑定月份
|
|
|
|
|
function BindSMonth() {
|
|
|
|
|
var months = new Sys.StringBuilder();
|
|
|
|
|
var month = DateTimeNow.getMonth();
|
|
|
|
|
var i = 1;
|
|
|
|
|
months.append("<option value='0'>-选择-</option>");
|
|
|
|
|
for (; i < 13; i++) {
|
|
|
|
|
|
|
|
|
|
months.append("<option value='" + i + "'>" + i + "月</option>");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
$("#SMonth").html(months.toString());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function BuildSalaryName() {
|
|
|
|
|
var syear = $("#SYear").val();
|
|
|
|
|
var smonth = $("#SMonth").val();
|
|
|
|
|
$("#SalaryName").val(syear + "年" + smonth + "月工资单");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//#region 导出
|
|
|
|
|
function ExportSalary() {
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: "FinanceService.asmx/ExportSalary",
|
|
|
|
|
async: false,
|
|
|
|
|
success: function (data) {
|
|
|
|
|
params = { FilePath: data.d, FileName: "工资单模版.xls" };
|
|
|
|
|
window.location = "../GlobalAshx/DownFile.ashx?" + jQuery.param(params);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
|
//#region 导入
|
|
|
|
|
function ajaxFileUpload() {
|
|
|
|
|
if ($("#SMonth").val() == "0") { alert("请选择工资年月"); return; }
|
|
|
|
|
if ($("#SalaryName").val() == "") { alert("请先输入要导入的工资名称"); return; }
|
|
|
|
|
// if ($("#fileToUpload").val() == "") { alert("请选择要导入的文件"); return; }
|
|
|
|
|
var filename = $("#fileToUpload").val();
|
|
|
|
|
if (IsExcel(filename) == false) { alert("请选择excel文件"); return; }
|
|
|
|
|
$.ajaxFileUpload({
|
|
|
|
|
url: '../GlobalAshx/AjaxFileUpdate.ashx?DirectoryName=ServerCookies',
|
|
|
|
|
secureuri: false,
|
|
|
|
|
fileElementId: 'fileToUpload',
|
|
|
|
|
dataType: 'json',
|
|
|
|
|
success: function (data, status) {
|
|
|
|
|
ImportSalary("ServerCookies/" + data.FileName);
|
|
|
|
|
},
|
|
|
|
|
error: function (data, status, e) {
|
|
|
|
|
alert(e);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function ImportSalary(FileName) {
|
|
|
|
|
|
|
|
|
|
WindowLoadModel.Show();
|
|
|
|
|
var param = new Object();
|
|
|
|
|
param.FileName = FileName;
|
|
|
|
|
param.SYear = $("#SYear").val();
|
|
|
|
|
param.SMonth = $("#SMonth").val();
|
|
|
|
|
param.SalaryName = $("#SalaryName").val();
|
|
|
|
|
param.SendSMS = 0;
|
|
|
|
|
//if ($("#chk_tj").attr("checked") == true)
|
|
|
|
|
//{
|
|
|
|
|
// param.Hj = 1;
|
|
|
|
|
//}
|
|
|
|
|
//else
|
|
|
|
|
param.Hj = 0;
|
|
|
|
|
//param.SalaryName = $("#SalaryName").val();
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: "OA_Manage.asmx/ImportSalary",
|
|
|
|
|
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
|
|
|
|
|
success: function (data) {
|
|
|
|
|
WindowLoadModel.Hide();
|
|
|
|
|
if (data.d != "") { $("#div1").html(data.d); if (param.SendSMS == 1) { SendMessage(); }return; }
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
error: function (xhr, status) {
|
|
|
|
|
if (status != "success") alert(xhr.responseText);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//#region 发短信
|
|
|
|
|
function SendMessage() {
|
|
|
|
|
var param = new Object();
|
|
|
|
|
param.SalaryName = $("#SalaryName").val();
|
|
|
|
|
param.year = $("#SYear").val();
|
|
|
|
|
param.month = $("#SMonth").val();
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: "FinanceService.asmx/SendMessage",
|
|
|
|
|
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
|
|
|
|
|
success: function (data) {
|
|
|
|
|
alert(data.d);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
</head>
|
|
|
|
|
<body>
|
|
|
|
|
<form id="form1" runat="server">
|
|
|
|
|
<table border="0" cellspacing="0" cellpadding="3">
|
|
|
|
|
<tr>
|
|
|
|
|
<td style="background-repeat: no-repeat; width: 40px;">
|
|
|
|
|
<div class="title_ico">
|
|
|
|
|
</div>
|
|
|
|
|
</td>
|
|
|
|
|
<td class="title_text">
|
|
|
|
|
工资单导入
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
</table>
|
|
|
|
|
<table border="2" align="center" cellpadding="0" cellspacing="0" style="width: 99%;"
|
|
|
|
|
class="tableAll">
|
|
|
|
|
<tr>
|
|
|
|
|
<td class="f1" width="20%">
|
|
|
|
|
工资年月:
|
|
|
|
|
</td>
|
|
|
|
|
<td >
|
|
|
|
|
<select id="SYear" name="SYear">
|
|
|
|
|
</select>
|
|
|
|
|
<select id="SMonth" name="SMonth">
|
|
|
|
|
</select></td>
|
|
|
|
|
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td class="f1">
|
|
|
|
|
工资名称:</td>
|
|
|
|
|
<td >
|
|
|
|
|
<input type="text" id="SalaryName" class="txtInput" value="" /><span style="color: Red">注:例2014年6月工资,导入根据工资名称判断,同一个名称重复导入会覆盖原来数据</span></td>
|
|
|
|
|
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td colspan="2">
|
|
|
|
|
<input id="fileToUpload" accept="excel/xls" name="fileToUpload" style="margin-left: 5px;"
|
|
|
|
|
type="file" />
|
|
|
|
|
<input id="cmdImport" class="btnClass btnClassImportExcel" type="button" value="导入工资单" />
|
|
|
|
|
<a href="../Scripts/工资导入模板.xls"
|
|
|
|
|
style="cursor: pointer; color: Blue;">工资导入模板下载</a>
|
|
|
|
|
<span style="color: Red">注:请先下载模板,添加完数据再导入,模板第一列必须为姓名,其它列可以任意命名</span>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td class="f1">
|
|
|
|
|
导入结果提示:
|
|
|
|
|
</td>
|
|
|
|
|
<td>
|
|
|
|
|
<div id="div1" style="height: 270px; width: 100%; color: red; padding: 10px; line-height: 24px;">
|
|
|
|
|
</div>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr style="display:block">
|
|
|
|
|
<%-- <td colspan="2" style="text-align: left;">
|
|
|
|
|
<input id="SendSMS" type="checkbox" value="1" /> 导入工资单时发送短信通知教师
|
|
|
|
|
</td>--%>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td colspan="2" style="text-align: center;">
|
|
|
|
|
<input id="cmdReturn" class="btnClass btnClassFind" type="button" value="工资查询" onclick="javascript: window.location.href = 'GZ_ShowAll.aspx'" />
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
</table>
|
|
|
|
|
</form>
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|