重构五张财务单据的js
This commit is contained in:
@@ -13,6 +13,13 @@
|
||||
var accountHeadID = 0;
|
||||
var orgAccountHead = ""; //保存编辑前的名称
|
||||
var editIndex = undefined;
|
||||
var listTitle = ""; //单据标题
|
||||
var payTypeTitle = "";//收入 支出
|
||||
var organUrl = ""; //组织数据接口地址
|
||||
var itemType = true; //隐藏当前列
|
||||
var moneyType = true; //隐藏当前列
|
||||
var inOrOut = ""; //链接类型为收入或者支出
|
||||
getType();
|
||||
initSystemData_person(); //经手人数据
|
||||
initSelectInfo_person(); //经手人信息
|
||||
initSystemData_account(); //账户数据
|
||||
@@ -24,7 +31,52 @@
|
||||
bindEvent();//绑定操作事件
|
||||
$("#searchBtn").click();
|
||||
});
|
||||
|
||||
//根据单据名称获取类型
|
||||
function getType(){
|
||||
listTitle = $("#tablePanel").prev().text();
|
||||
var supUrl = path + "/supplier/findBySelect_sup.action"; //供应商接口
|
||||
var cusUrl = path + "/supplier/findBySelect_cus.action"; //客户接口
|
||||
if(listTitle === "收入单列表"){
|
||||
listType = "收入";
|
||||
itemType = false; //显示当前列
|
||||
moneyType = true; //隐藏当前列
|
||||
payTypeTitle = "收入项目";
|
||||
inOrOut = "in";
|
||||
organUrl = supUrl;
|
||||
}
|
||||
else if(listTitle === "支出单列表"){
|
||||
listType = "支出";
|
||||
itemType = false; //显示当前列
|
||||
moneyType = true; //隐藏当前列
|
||||
payTypeTitle = "支出项目";
|
||||
inOrOut = "out";
|
||||
organUrl = cusUrl;
|
||||
}
|
||||
else if(listTitle === "收款单列表"){
|
||||
listType = "收款";
|
||||
itemType = true; //隐藏当前列
|
||||
moneyType = false; //显示当前列
|
||||
payTypeTitle = "无标题";
|
||||
inOrOut = "";
|
||||
organUrl = supUrl;
|
||||
}
|
||||
else if(listTitle === "付款单列表"){
|
||||
listType = "付款";
|
||||
itemType = true; //隐藏当前列
|
||||
moneyType = false; //显示当前列
|
||||
payTypeTitle = "无标题";
|
||||
inOrOut = "";
|
||||
organUrl = cusUrl;
|
||||
}
|
||||
else if(listTitle === "转账单列表"){
|
||||
listType = "转账";
|
||||
itemType = true; //隐藏当前列
|
||||
moneyType = false; //显示当前列
|
||||
payTypeTitle = "无标题";
|
||||
inOrOut = "";
|
||||
organUrl = supUrl;
|
||||
}
|
||||
}
|
||||
//获取账户信息
|
||||
function initSystemData_account(){
|
||||
$.ajax({
|
||||
@@ -51,7 +103,7 @@
|
||||
if(accountList !=null)
|
||||
{
|
||||
options = "";
|
||||
for(var i = 0 ;i < accountList.length;i++)
|
||||
for(var i = 0 ;i < accountList.length; i++)
|
||||
{
|
||||
var account = accountList[i];
|
||||
options += '<option value="' + account.id + '">' + account.name + '</option>';
|
||||
@@ -63,7 +115,7 @@
|
||||
//初始化单位信息
|
||||
function initSupplier(){
|
||||
$('#OrganId').combobox({
|
||||
url: path + "/supplier/findBySelect_sup.action",
|
||||
url: organUrl,
|
||||
valueField:'id',
|
||||
textField:'supplier'
|
||||
});
|
||||
@@ -218,7 +270,7 @@
|
||||
pageList: [50,100,150],
|
||||
columns:[[
|
||||
{ field: 'Id',width:35,align:"center",checkbox:true},
|
||||
{ title: '收入项目',field: 'InOutItemId',width:230,
|
||||
{ title: payTypeTitle,field: 'InOutItemId',width:230,hidden:itemType,
|
||||
formatter:function(value,row,index){
|
||||
return row.InOutItemName;
|
||||
},
|
||||
@@ -228,7 +280,21 @@
|
||||
valueField:'Id',
|
||||
textField:'InOutItemName',
|
||||
method:'get',
|
||||
url: path + "/inOutItem/findBySelect.action?type=in"
|
||||
url: path + "/inOutItem/findBySelect.action?type=" + inOrOut
|
||||
}
|
||||
}
|
||||
},
|
||||
{ title: '账户名称',field: 'AccountId',width:230,hidden:moneyType,
|
||||
formatter:function(value,row,index){
|
||||
return row.AccountName;
|
||||
},
|
||||
editor:{
|
||||
type:'combobox',
|
||||
options:{
|
||||
valueField:'Id',
|
||||
textField:'AccountName',
|
||||
method:'get',
|
||||
url: path + "/account/findBySelect.action"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -277,7 +343,7 @@
|
||||
function initTableData_account_show(){
|
||||
$('#accountDataShow').datagrid({
|
||||
height:300,
|
||||
rownumbers: false,
|
||||
rownumbers: true,
|
||||
//动画效果
|
||||
animate:false,
|
||||
//选中单行
|
||||
@@ -296,8 +362,8 @@
|
||||
pageSize: 50,
|
||||
pageList: [50,100,150],
|
||||
columns:[[
|
||||
{ field: 'Id',width:35,align:"center",checkbox:true},
|
||||
{ title: '收入项目',field: 'InOutItemName',width:230},
|
||||
{ title: payTypeTitle, field: 'InOutItemName', width:230, hidden:itemType},
|
||||
{ title: '账户名称', field: 'AccountName', width:230, hidden:moneyType},
|
||||
{ title: '金额',field: 'EachAmount',width:50},
|
||||
{ title: '备注',field: 'Remark',width:150}
|
||||
]],
|
||||
@@ -434,7 +500,8 @@
|
||||
function addAccountHead(){
|
||||
$("#clientIp").val(clientIp);
|
||||
$('#accountHeadFM').form('clear');
|
||||
$('#accountHeadDlg').dialog('open').dialog('setTitle','<img src="' + path + '/js/easyui-1.3.5/themes/icons/edit_add.png"/> 增加财务信息');
|
||||
var addTitle = listTitle.replace("列表","信息");
|
||||
$('#accountHeadDlg').dialog('open').dialog('setTitle','<img src="' + path + '/js/easyui-1.3.5/themes/icons/edit_add.png"/> 增加' + addTitle);
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
$("#BillNo").val("").focus();
|
||||
|
||||
@@ -455,13 +522,14 @@
|
||||
$("#AccountId").val(accountHeadInfo[4]);
|
||||
$('#OrganId').combobox('setValue', accountHeadInfo[6]);
|
||||
$("#HandsPersonId").val(accountHeadInfo[8]);
|
||||
$("#ChangeAmount").val(accountHeadInfo[10]);
|
||||
$('#accountHeadDlg').dialog('open').dialog('setTitle','<img src="' + path + '/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑财务信息');
|
||||
$("#ChangeAmount").val(accountHeadInfo[10]);
|
||||
var editTitle = listTitle.replace("列表","信息");
|
||||
$('#accountHeadDlg').dialog('open').dialog('setTitle','<img src="' + path + '/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑' + editTitle);
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
accountHeadID = accountHeadInfo[0];
|
||||
|
||||
initTableData_account(); //明细列表
|
||||
reject(); //撤销下、刷新材料列表
|
||||
reject(); //撤销下、刷新列表
|
||||
url = path + '/accountHead/update.action?accountHeadID=' + accountHeadInfo[0];
|
||||
}
|
||||
|
||||
@@ -475,7 +543,8 @@
|
||||
$('#OrganIdShow').text(accountHeadInfo[7]);
|
||||
$("#HandsPersonIdShow").text(accountHeadInfo[9]);
|
||||
$("#ChangeAmountShow").text(accountHeadInfo[10]);
|
||||
$('#accountHeadDlgShow').dialog('open').dialog('setTitle','<img src="' + path + '/js/easyui-1.3.5/themes/icons/list.png"/> 查看财务信息');
|
||||
var showTitle = listTitle.replace("列表","信息");
|
||||
$('#accountHeadDlgShow').dialog('open').dialog('setTitle','<img src="' + path + '/js/easyui-1.3.5/themes/icons/list.png"/> 查看' + showTitle);
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
|
||||
accountHeadID = accountHeadInfo[0];
|
||||
@@ -520,18 +589,27 @@
|
||||
return;
|
||||
else
|
||||
{
|
||||
var OrganId = null;
|
||||
var ChangeAmount = $.trim($("#ChangeAmount").val());
|
||||
if(listType !=="转账"){
|
||||
OrganId = $('#OrganId').combobox('getValue');
|
||||
}
|
||||
if(listType === "支出"){
|
||||
//支出为负数
|
||||
ChangeAmount = 0 - ChangeAmount;
|
||||
}
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: url,
|
||||
dataType: "json",
|
||||
async : false,
|
||||
data: ({
|
||||
Type: "收入",
|
||||
Type: listType,
|
||||
BillNo : $.trim($("#BillNo").val()),
|
||||
BillTime : $.trim($("#BillTime").val()),
|
||||
AccountId: $.trim($("#AccountId").val()),
|
||||
ChangeAmount: $.trim($("#ChangeAmount").val()),
|
||||
OrganId: $('#OrganId').combobox('getValue'),
|
||||
ChangeAmount: ChangeAmount, //付款/收款/优惠/实付
|
||||
OrganId: OrganId,
|
||||
HandsPersonId: $.trim($("#HandsPersonId").val()),
|
||||
Remark: $.trim($("#Remark").val()),
|
||||
clientIp: clientIp
|
||||
@@ -601,7 +679,7 @@
|
||||
url: path + "/accountHead/findBy.action",
|
||||
dataType: "json",
|
||||
data: ({
|
||||
Type:"收入",
|
||||
Type: listType,
|
||||
BillNo:$.trim($("#searchBillNo").val()),
|
||||
BeginTime:$("#searchBeginTime").val(),
|
||||
EndTime:$("#searchEndTime").val(),
|
||||
@@ -621,12 +699,21 @@
|
||||
});
|
||||
}
|
||||
//结束编辑
|
||||
function endEditing() {
|
||||
function endEditing() {
|
||||
var edField = "";
|
||||
if(!itemType){
|
||||
edField = "InOutItemId";
|
||||
edName = "InOutItemName";
|
||||
}
|
||||
else {
|
||||
edField = "AccountId";
|
||||
edName = "AccountName";
|
||||
}
|
||||
if (editIndex == undefined) { return true }
|
||||
if ($('#accountData').datagrid('validateRow', editIndex)) {
|
||||
var ed = $('#accountData').datagrid('getEditor', {index:editIndex,field:'InOutItemId'});
|
||||
var InOutItemName = $(ed.target).combobox('getText');
|
||||
$('#accountData').datagrid('getRows')[editIndex]['InOutItemName'] = InOutItemName;
|
||||
var ed = $('#accountData').datagrid('getEditor', {index: editIndex, field: edField});
|
||||
var textName = $(ed.target).combobox('getText');
|
||||
$('#accountData').datagrid('getRows')[editIndex][edName] = textName;
|
||||
$('#accountData').datagrid('endEdit', editIndex);
|
||||
editIndex = undefined;
|
||||
return true;
|
||||
@@ -671,9 +758,16 @@
|
||||
var row = $('#accountData').datagrid('getRows');
|
||||
var totalRowNum = "";
|
||||
for (var i = 0; i < row.length; i++) {
|
||||
if (row[i].InOutItemId == "") {
|
||||
totalRowNum += (i + 1) + "、";
|
||||
}
|
||||
if(!itemType){
|
||||
if (row[i].InOutItemId == "") {
|
||||
totalRowNum += (i + 1) + "、";
|
||||
}
|
||||
}
|
||||
else{
|
||||
if (row[i].AccountId == "") {
|
||||
totalRowNum += (i + 1) + "、";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (totalRowNum != "") {
|
||||
var totalRowNum = totalRowNum.substring(0, totalRowNum.length - 1);
|
||||
|
||||
@@ -456,7 +456,7 @@
|
||||
function initTableData_material_show(TotalPrice){
|
||||
$('#materialDataShow').datagrid({
|
||||
height:300,
|
||||
rownumbers: false,
|
||||
rownumbers: true,
|
||||
//动画效果
|
||||
animate:false,
|
||||
//选中单行
|
||||
@@ -471,7 +471,6 @@
|
||||
striped : true,
|
||||
showFooter: true,
|
||||
//loadFilter: pagerFilter,
|
||||
rownumbers:true,
|
||||
onClickRow: onClickRow,
|
||||
pageSize: 50,
|
||||
pageList: [50,100,150],
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
|
||||
<%
|
||||
String path = request.getContextPath();
|
||||
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
|
||||
String clientIp = Tools.getCurrentUserIP();
|
||||
%>
|
||||
<!DOCTYPE html>
|
||||
@@ -12,15 +11,21 @@
|
||||
<meta charset="utf-8">
|
||||
<!-- 指定以IE8的方式来渲染 -->
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8"/>
|
||||
<link rel="shortcut icon" href="<%=path%>/images/favicon.ico" type="image/x-icon" />
|
||||
<script type="text/javascript" src="<%=path %>/js/jquery-1.8.0.min.js"></script>
|
||||
<link rel="shortcut icon" href="<%=path%>/images/favicon.ico" type="image/x-icon" />
|
||||
<link rel="stylesheet" type="text/css" href="<%=path %>/js/easyui-1.3.5/themes/default/easyui.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="<%=path %>/js/easyui-1.3.5/themes/icon.css"/>
|
||||
<link type="text/css" rel="stylesheet" href="<%=path %>/css/common.css" />
|
||||
<script type="text/javascript" src="<%=path %>/js/easyui-1.3.5/jquery.easyui.min.js"></script>
|
||||
<script type="text/javascript" src="<%=path %>/js/easyui-1.3.5/locale/easyui-lang-zh_CN.js"></script>
|
||||
<script type="text/javascript" src="<%=path %>/js/My97DatePicker/WdatePicker.js"></script>
|
||||
<script type="text/javascript" src="<%=path %>/js/common/common.js"></script>
|
||||
<script src="<%=path %>/js/jquery-1.8.0.min.js"></script>
|
||||
<script src="<%=path %>/js/easyui-1.3.5/jquery.easyui.min.js"></script>
|
||||
<script src="<%=path %>/js/easyui-1.3.5/locale/easyui-lang-zh_CN.js"></script>
|
||||
<script src="<%=path %>/js/My97DatePicker/WdatePicker.js"></script>
|
||||
<script src="<%=path %>/js/common/common.js"></script>
|
||||
<script src="<%=path %>/js/pages/financial/financial_base.js"></script>
|
||||
<script>
|
||||
var kid = ${sessionScope.user.id};
|
||||
var path = "<%=path%>";
|
||||
var clientIp = "<%=clientIp%>";
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- 查询 -->
|
||||
@@ -148,774 +153,5 @@
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
var accountList = null;
|
||||
var accountID = null;
|
||||
var supplierList = null;
|
||||
var supplierID = null;
|
||||
var personList = null;
|
||||
var personID = null;
|
||||
var ProjectSearch=null;
|
||||
var kid=${sessionScope.user.id};
|
||||
var accountHeadMaxId=null; //获取最大的Id
|
||||
var accepId=null; //保存的主表id
|
||||
//初始化界面
|
||||
$(function()
|
||||
{
|
||||
initSystemData_person(); //经手人数据
|
||||
initSelectInfo_person(); //经手人信息
|
||||
initSystemData_account(); //账户数据
|
||||
initSelectInfo_account(); //账户信息
|
||||
initTableData();
|
||||
ininPager();
|
||||
initForm();
|
||||
$("#searchBtn").click();
|
||||
});
|
||||
|
||||
//获取账户信息
|
||||
function initSystemData_account()
|
||||
{
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: "<%=path%>/account/getAccount.action",
|
||||
//设置为同步
|
||||
async:false,
|
||||
dataType: "json",
|
||||
success: function (systemInfo)
|
||||
{
|
||||
accountList = systemInfo.showModel.map.accountList;
|
||||
var msgTip = systemInfo.showModel.msgTip;
|
||||
if(msgTip == "exceptoin")
|
||||
{
|
||||
$.messager.alert('提示','查找账户信息异常,请与管理员联系!','error');
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
//获取账户信息
|
||||
function initSelectInfo_account()
|
||||
{
|
||||
var options = "";
|
||||
if(accountList !=null)
|
||||
{
|
||||
options = "";
|
||||
for(var i = 0 ;i < accountList.length;i ++)
|
||||
{
|
||||
var account = accountList[i];
|
||||
options += '<option value="' + account.id + '">' + account.name + '</option>';
|
||||
}
|
||||
$("#AccountId").empty().append(options);
|
||||
}
|
||||
}
|
||||
|
||||
//获取财务员
|
||||
function initSystemData_person()
|
||||
{
|
||||
var type = "财务员";
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: "<%=path%>/person/getPersonByType.action",
|
||||
data: {
|
||||
Type: type
|
||||
},
|
||||
//设置为同步
|
||||
async:false,
|
||||
dataType: "json",
|
||||
success: function (systemInfo)
|
||||
{
|
||||
personList = systemInfo.showModel.map.personList;
|
||||
var msgTip = systemInfo.showModel.msgTip;
|
||||
if(msgTip == "exceptoin")
|
||||
{
|
||||
$.messager.alert('提示','查找系统基础信息异常,请与管理员联系!','error');
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
//获取财务员
|
||||
function initSelectInfo_person()
|
||||
{
|
||||
var options = "";
|
||||
|
||||
if(personList !=null)
|
||||
{
|
||||
for(var i = 0 ;i < personList.length;i ++)
|
||||
{
|
||||
var person = personList[i];
|
||||
if(0 == i)
|
||||
{
|
||||
personID = person.id;
|
||||
}
|
||||
if(person.type=="财务员")
|
||||
{
|
||||
options += '<option value="' + person.id + '">' + person.name + '</option>';
|
||||
}
|
||||
}
|
||||
$("#HandsPersonId").empty().append(options);
|
||||
}
|
||||
}
|
||||
|
||||
//防止表单提交重复
|
||||
function initForm()
|
||||
{
|
||||
$('#accountHeadFM').form({
|
||||
onSubmit: function(){
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//初始化表格数据
|
||||
function initTableData()
|
||||
{
|
||||
$('#tableData').datagrid({
|
||||
//width:700,
|
||||
height:heightInfo,
|
||||
rownumbers: false,
|
||||
//动画效果
|
||||
animate:false,
|
||||
//选中单行
|
||||
singleSelect : true,
|
||||
collapsible:false,
|
||||
selectOnCheck:false,
|
||||
//fitColumns:true,
|
||||
//单击行是否选中
|
||||
//checkOnSelect : false,
|
||||
//url:'<%=path %>/accountHead/findBy.action?pageSize=' + initPageSize,
|
||||
pagination: true,
|
||||
//交替出现背景
|
||||
striped : true,
|
||||
//loadFilter: pagerFilter,
|
||||
pageSize: 5,
|
||||
pageList: initPageNum,
|
||||
columns:[[
|
||||
{ field: 'Id',width:35,align:"center",checkbox:true},
|
||||
{ title: '单据编号',field: 'BillNo',width:100},
|
||||
{ title: '单据时间 ',field: 'BillTime',width:100},
|
||||
{ title: '备注',field: 'Remark',width:100},
|
||||
{ title: '操作',field: 'op',align:"center",width:180,formatter:function(value,rec)
|
||||
{
|
||||
var str = '';
|
||||
var rowInfo = rec.Id + 'AaBb' + rec.BillNo+ 'AaBb' + rec.BillTime+ 'AaBb' + rec.Remark
|
||||
+ 'AaBb' + rec.AccountId+ 'AaBb' + rec.AccountName + 'AaBb' + rec.OrganId + 'AaBb' + rec.OrganName
|
||||
+ 'AaBb' + rec.HandsPersonId + 'AaBb' + rec.HandsPersonName + 'AaBb' + rec.ChangeAmount;
|
||||
if(1 == value)
|
||||
{
|
||||
str += '<img src="<%=path%>/js/easyui-1.3.5/themes/icons/list.png" style="cursor: pointer;" onclick="showAccountHead(\'' + rowInfo + '\');"/> <a onclick="showAccountHead(\'' + rowInfo + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">查看</a> ';
|
||||
str += '<img src="<%=path%>/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editAccountHead(\'' + rowInfo + '\');"/> <a onclick="editAccountHead(\'' + rowInfo + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">编辑</a> ';
|
||||
str += '<img src="<%=path%>/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteAccountHead('+ rec.Id +');"/> <a onclick="deleteAccountHead('+ rec.Id +');" style="text-decoration:none;color:black;" href="javascript:void(0)">删除</a>';
|
||||
}
|
||||
return str;
|
||||
}
|
||||
}
|
||||
]],
|
||||
toolbar:[
|
||||
{
|
||||
id:'addAccountHead',
|
||||
text:'增加',
|
||||
iconCls:'icon-add',
|
||||
handler:function()
|
||||
{
|
||||
addAccountHead();
|
||||
}
|
||||
},
|
||||
{
|
||||
id:'deleteAccountHead',
|
||||
text:'删除',
|
||||
iconCls:'icon-remove',
|
||||
handler:function()
|
||||
{
|
||||
batDeleteAccountHead();
|
||||
}
|
||||
}
|
||||
],
|
||||
onLoadError:function()
|
||||
{
|
||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//初始化表格数据-明细列表-编辑状态
|
||||
function initTableData_account()
|
||||
{
|
||||
$('#accountData').datagrid({
|
||||
height:300,
|
||||
rownumbers: false,
|
||||
//动画效果
|
||||
animate:false,
|
||||
//选中单行
|
||||
singleSelect : true,
|
||||
collapsible:false,
|
||||
selectOnCheck:false,
|
||||
//fitColumns:true,
|
||||
//单击行是否选中
|
||||
//checkOnSelect : false,
|
||||
url:'<%=path %>/accountItem/findBy.action?HeaderId=' + accountHeadID,
|
||||
pagination: true,
|
||||
//交替出现背景
|
||||
striped : true,
|
||||
//loadFilter: pagerFilter,
|
||||
onClickRow: onClickRow,
|
||||
pageSize: 50,
|
||||
pageList: [50,100,150],
|
||||
columns:[[
|
||||
{ field: 'Id',width:35,align:"center",checkbox:true},
|
||||
{ title: '账户名称',field: 'AccountId',width:230,
|
||||
formatter:function(value,row,index){
|
||||
return row.AccountName;
|
||||
},
|
||||
editor:{
|
||||
type:'combobox',
|
||||
options:{
|
||||
valueField:'Id',
|
||||
textField:'AccountName',
|
||||
method:'get',
|
||||
url: "<%=path%>/account/findBySelect.action"
|
||||
}
|
||||
}
|
||||
},
|
||||
{ title: '金额',field: 'EachAmount',editor:'validatebox',width:50},
|
||||
{ title: '备注',field: 'Remark',editor:'validatebox',width:150}
|
||||
]],
|
||||
toolbar:[
|
||||
{
|
||||
id:'append',
|
||||
text:'新增',
|
||||
iconCls:'icon-add',
|
||||
handler:function()
|
||||
{
|
||||
append(); //新增
|
||||
}
|
||||
},
|
||||
{
|
||||
id:'delete',
|
||||
text:'删除',
|
||||
iconCls:'icon-remove',
|
||||
handler:function()
|
||||
{
|
||||
removeit(); //删除
|
||||
}
|
||||
},
|
||||
{
|
||||
id:'reject',
|
||||
text:'撤销',
|
||||
iconCls:'icon-undo',
|
||||
handler:function()
|
||||
{
|
||||
reject(); //撤销
|
||||
}
|
||||
}
|
||||
],
|
||||
onLoadError:function()
|
||||
{
|
||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//初始化表格数据-明细列表-查看状态
|
||||
function initTableData_account_show()
|
||||
{
|
||||
$('#accountDataShow').datagrid({
|
||||
height:300,
|
||||
rownumbers: false,
|
||||
//动画效果
|
||||
animate:false,
|
||||
//选中单行
|
||||
singleSelect : true,
|
||||
collapsible:false,
|
||||
selectOnCheck:false,
|
||||
//fitColumns:true,
|
||||
//单击行是否选中
|
||||
//checkOnSelect : false,
|
||||
url:'<%=path %>/accountItem/findBy.action?HeaderId=' + accountHeadID,
|
||||
pagination: true,
|
||||
//交替出现背景
|
||||
striped : true,
|
||||
//loadFilter: pagerFilter,
|
||||
onClickRow: onClickRow,
|
||||
pageSize: 50,
|
||||
pageList: [50,100,150],
|
||||
columns:[[
|
||||
{ field: 'Id',width:35,align:"center",checkbox:true},
|
||||
{ title: '账户名称',field: 'AccountName',width:230},
|
||||
{ title: '金额',field: 'EachAmount',width:50},
|
||||
{ title: '备注',field: 'Remark',width:150}
|
||||
]],
|
||||
onLoadError:function()
|
||||
{
|
||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//初始化键盘enter事件
|
||||
$(document).keydown(function(event)
|
||||
{
|
||||
//兼容 IE和firefox 事件
|
||||
var e = window.event || event;
|
||||
var k = e.keyCode||e.which||e.charCode;
|
||||
//兼容 IE,firefox 兼容
|
||||
var obj = e.srcElement ? e.srcElement : e.target;
|
||||
//绑定键盘事件为 id是指定的输入框才可以触发键盘事件 13键盘事件 ---遗留问题 enter键效验 对话框会关闭问题
|
||||
if(k == "13"&&(obj.id=="BillNo"||obj.id=="BillTime"))
|
||||
{
|
||||
$("#saveAccountHead").click();
|
||||
}
|
||||
//搜索按钮添加快捷键
|
||||
if(k == "13"&&(obj.id=="searchBillNo"))
|
||||
{
|
||||
$("#searchBtn").click();
|
||||
}
|
||||
});
|
||||
//分页信息处理
|
||||
function ininPager()
|
||||
{
|
||||
try
|
||||
{
|
||||
var opts = $("#tableData").datagrid('options');
|
||||
var pager = $("#tableData").datagrid('getPager');
|
||||
pager.pagination({
|
||||
onSelectPage:function(pageNum, pageSize)
|
||||
{
|
||||
opts.pageNumber = pageNum;
|
||||
opts.pageSize = pageSize;
|
||||
pager.pagination('refresh',
|
||||
{
|
||||
pageNumber:pageNum,
|
||||
pageSize:pageSize
|
||||
});
|
||||
showAccountHeadDetails(pageNum,pageSize);
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
$.messager.alert('异常处理提示',"分页信息异常 : " + e.name + ": " + e.message,'error');
|
||||
}
|
||||
}
|
||||
|
||||
//删除财务信息
|
||||
function deleteAccountHead(accountHeadID)
|
||||
{
|
||||
$.messager.confirm('删除确认','确定要删除此财务信息吗?',function(r)
|
||||
{
|
||||
if (r)
|
||||
{
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: "<%=path %>/accountHead/delete.action",
|
||||
dataType: "json",
|
||||
data: ({
|
||||
accountHeadID : accountHeadID,
|
||||
clientIp:'<%=clientIp %>'
|
||||
}),
|
||||
success: function (tipInfo)
|
||||
{
|
||||
var msg = tipInfo.showModel.msgTip;
|
||||
if(msg == '成功')
|
||||
{
|
||||
//加载完以后重新初始化
|
||||
$("#searchBtn").click();
|
||||
}
|
||||
else
|
||||
$.messager.alert('删除提示','删除财务信息失败,请稍后再试!','error');
|
||||
},
|
||||
//此处添加错误处理
|
||||
error:function()
|
||||
{
|
||||
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//批量删除财务信息
|
||||
function batDeleteAccountHead()
|
||||
{
|
||||
var row = $('#tableData').datagrid('getChecked');
|
||||
if(row.length == 0)
|
||||
{
|
||||
$.messager.alert('删除提示','没有记录被选中!','info');
|
||||
return;
|
||||
}
|
||||
if(row.length > 0)
|
||||
{
|
||||
$.messager.confirm('删除确认','确定要删除选中的' + row.length + '条财务信息吗?',function(r)
|
||||
{
|
||||
if (r)
|
||||
{
|
||||
var ids = "";
|
||||
for(var i = 0;i < row.length; i ++)
|
||||
{
|
||||
if(i == row.length-1)
|
||||
{
|
||||
ids += row[i].Id;
|
||||
break;
|
||||
}
|
||||
//alert(row[i].id);
|
||||
ids += row[i].Id + ",";
|
||||
}
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: "<%=path %>/accountHead/batchDelete.action",
|
||||
dataType: "json",
|
||||
async : false,
|
||||
data: ({
|
||||
accountHeadIDs : ids,
|
||||
clientIp:'<%=clientIp %>'
|
||||
}),
|
||||
success: function (tipInfo)
|
||||
{
|
||||
var msg = tipInfo.showModel.msgTip;
|
||||
if(msg == '成功')
|
||||
{
|
||||
//加载完以后重新初始化
|
||||
$("#searchBtn").click();
|
||||
$(":checkbox").attr("checked",false);
|
||||
}
|
||||
else
|
||||
$.messager.alert('删除提示','删除财务信息失败,请稍后再试!','error');
|
||||
},
|
||||
//此处添加错误处理
|
||||
error:function()
|
||||
{
|
||||
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//增加
|
||||
var url;
|
||||
var accountHeadID = 0;
|
||||
//保存编辑前的名称
|
||||
var orgAccountHead = "";
|
||||
|
||||
function addAccountHead()
|
||||
{
|
||||
$("#clientIp").val('<%=clientIp %>');
|
||||
$('#accountHeadFM').form('clear');
|
||||
$('#accountHeadDlg').dialog('open').dialog('setTitle','<img src="<%=path%>/js/easyui-1.3.5/themes/icons/edit_add.png"/> 增加财务信息');
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
$("#BillNo").val("").focus();
|
||||
|
||||
orgAccountHead = "";
|
||||
accountHeadID = 0;
|
||||
initTableData_account(); //明细列表
|
||||
reject(); //撤销下、刷新材料列表
|
||||
url = '<%=path %>/accountHead/create.action';
|
||||
}
|
||||
|
||||
//保存信息
|
||||
$("#saveAccountHead").unbind().bind({
|
||||
click:function()
|
||||
{
|
||||
if(!$('#accountHeadFM').form('validate'))
|
||||
return;
|
||||
else
|
||||
{
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: url,
|
||||
dataType: "json",
|
||||
async : false,
|
||||
data: ({
|
||||
Type: "转账",
|
||||
BillNo : $.trim($("#BillNo").val()),
|
||||
BillTime : $.trim($("#BillTime").val()),
|
||||
AccountId: $.trim($("#AccountId").val()),
|
||||
ChangeAmount: $.trim($("#ChangeAmount").val()),
|
||||
//OrganId: $('#OrganId').combobox('getValue'),
|
||||
HandsPersonId: $.trim($("#HandsPersonId").val()),
|
||||
Remark: $.trim($("#Remark").val()),
|
||||
clientIp:'<%=clientIp %>'
|
||||
}),
|
||||
success: function (tipInfo)
|
||||
{
|
||||
if(tipInfo)
|
||||
{
|
||||
//保存明细记录
|
||||
if(accountHeadID ==0)
|
||||
{
|
||||
getMaxId(); //查找最大的Id
|
||||
accept(accountHeadMaxId); //新增
|
||||
}
|
||||
else
|
||||
{
|
||||
accept(accountHeadID); //修改
|
||||
}
|
||||
|
||||
|
||||
$('#accountHeadDlg').dialog('close');
|
||||
var opts = $("#tableData").datagrid('options');
|
||||
showAccountHeadDetails(opts.pageNumber,opts.pageSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
$.messager.show({
|
||||
title: '错误提示',
|
||||
msg: '保存信息失败,请稍后重试!'
|
||||
});
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error:function()
|
||||
{
|
||||
$.messager.alert('提示','保存信息异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//编辑信息
|
||||
function editAccountHead(accountHeadTotalInfo)
|
||||
{
|
||||
var accountHeadInfo = accountHeadTotalInfo.split("AaBb");
|
||||
$("#clientIp").val('<%=clientIp %>');
|
||||
$("#BillNo").val(accountHeadInfo[1]);
|
||||
$("#BillTime").val(accountHeadInfo[2]);
|
||||
$("#Remark").val(accountHeadInfo[3]);
|
||||
$("#AccountId").val(accountHeadInfo[4]);
|
||||
$('#OrganId').combobox('setValue', accountHeadInfo[6]);
|
||||
$("#HandsPersonId").val(accountHeadInfo[8]);
|
||||
$("#ChangeAmount").val(accountHeadInfo[10]);
|
||||
$('#accountHeadDlg').dialog('open').dialog('setTitle','<img src="<%=path%>/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑财务信息');
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
accountHeadID = accountHeadInfo[0];
|
||||
|
||||
initTableData_account(); //明细列表
|
||||
reject(); //撤销下、刷新材料列表
|
||||
url = '<%=path %>/accountHead/update.action?accountHeadID=' + accountHeadInfo[0];
|
||||
}
|
||||
|
||||
//查看信息
|
||||
function showAccountHead(accountHeadTotalInfo)
|
||||
{
|
||||
var accountHeadInfo = accountHeadTotalInfo.split("AaBb");
|
||||
$("#BillNoShow").text(accountHeadInfo[1]);
|
||||
$("#BillTimeShow").text(accountHeadInfo[2]);
|
||||
$("#RemarkShow").text(accountHeadInfo[3]);
|
||||
$("#AccountIdShow").text(accountHeadInfo[5]);
|
||||
$('#OrganIdShow').text(accountHeadInfo[7]);
|
||||
$("#HandsPersonIdShow").text(accountHeadInfo[9]);
|
||||
$("#ChangeAmountShow").text(accountHeadInfo[10]);
|
||||
$('#accountHeadDlgShow').dialog('open').dialog('setTitle','<img src="<%=path%>/js/easyui-1.3.5/themes/icons/list.png"/> 查看财务信息');
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
|
||||
accountHeadID = accountHeadInfo[0];
|
||||
initTableData_account_show(); //明细列表-查看状态
|
||||
}
|
||||
|
||||
//搜索处理
|
||||
$("#searchBtn").unbind().bind({
|
||||
click:function()
|
||||
{
|
||||
showAccountHeadDetails(1,initPageSize);
|
||||
var opts = $("#tableData").datagrid('options');
|
||||
var pager = $("#tableData").datagrid('getPager');
|
||||
opts.pageNumber = 1;
|
||||
opts.pageSize = initPageSize;
|
||||
pager.pagination('refresh',
|
||||
{
|
||||
pageNumber:1,
|
||||
pageSize:initPageSize
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
function showAccountHeadDetails(pageNo,pageSize)
|
||||
{
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: "<%=path %>/accountHead/findBy.action",
|
||||
dataType: "json",
|
||||
data: ({
|
||||
Type:"转账",
|
||||
BillNo:$.trim($("#searchBillNo").val()),
|
||||
BeginTime:$("#searchBeginTime").val(),
|
||||
EndTime:$("#searchEndTime").val(),
|
||||
pageNo:pageNo,
|
||||
pageSize:pageSize
|
||||
}),
|
||||
success: function (data)
|
||||
{
|
||||
$("#tableData").datagrid('loadData',data);
|
||||
},
|
||||
//此处添加错误处理
|
||||
error:function()
|
||||
{
|
||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
//重置按钮
|
||||
$("#searchResetBtn").unbind().bind({
|
||||
click:function(){
|
||||
$("#searchBillNo").val("");
|
||||
$("#searchBeginTime").val("");
|
||||
$("#searchEndTime").val("");
|
||||
//加载完以后重新初始化
|
||||
$("#searchBtn").click();
|
||||
}
|
||||
});
|
||||
|
||||
//结束编辑
|
||||
var editIndex = undefined;
|
||||
function endEditing() {
|
||||
if (editIndex == undefined) { return true }
|
||||
if ($('#accountData').datagrid('validateRow', editIndex)) {
|
||||
var ed = $('#accountData').datagrid('getEditor', {index:editIndex,field:'AccountId'});
|
||||
var AccountName = $(ed.target).combobox('getText');
|
||||
$('#accountData').datagrid('getRows')[editIndex]['AccountName'] = AccountName;
|
||||
$('#accountData').datagrid('endEdit', editIndex);
|
||||
editIndex = undefined;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//单击
|
||||
function onClickRow(index) {
|
||||
if (editIndex != index) {
|
||||
if (endEditing()) {
|
||||
$('#accountData').datagrid('selectRow', index)
|
||||
.datagrid('beginEdit', index);
|
||||
editIndex = index;
|
||||
} else {
|
||||
$('#accountData').datagrid('selectRow', editIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
//新增
|
||||
function append()
|
||||
{
|
||||
if (endEditing()) {
|
||||
$('#accountData').datagrid('appendRow', {});
|
||||
editIndex = $('#accountData').datagrid('getRows').length - 1;
|
||||
$('#accountData').datagrid('selectRow', editIndex).datagrid('beginEdit', editIndex);
|
||||
}
|
||||
}
|
||||
//删除
|
||||
function removeit() {
|
||||
if (editIndex == undefined) { return }
|
||||
$('#accountData').datagrid('cancelEdit', editIndex)
|
||||
.datagrid('deleteRow', editIndex);
|
||||
editIndex = undefined;
|
||||
}
|
||||
//撤销
|
||||
function reject() {
|
||||
$('#accountData').datagrid('rejectChanges');
|
||||
editIndex = undefined;
|
||||
}
|
||||
//判断
|
||||
function CheckData() {
|
||||
var row = $('#accountData').datagrid('getRows');
|
||||
var totalRowNum = "";
|
||||
for (var i = 0; i < row.length; i++) {
|
||||
if (row[i].AccountId == "") {
|
||||
totalRowNum += (i + 1) + "、";
|
||||
}
|
||||
}
|
||||
if (totalRowNum != "") {
|
||||
var totalRowNum = totalRowNum.substring(0, totalRowNum.length - 1);
|
||||
$.messager.alert('提示',"第" + totalRowNum + "行数据填写不完整!",'info');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
//保存
|
||||
function accept(accepId) {
|
||||
append();
|
||||
removeit();
|
||||
if ($("#accountData").datagrid('getChanges').length) {
|
||||
if (!CheckData())
|
||||
return false;
|
||||
var inserted = $("#accountData").datagrid('getChanges', "inserted");
|
||||
var deleted = $("#accountData").datagrid('getChanges', "deleted");
|
||||
var updated = $("#accountData").datagrid('getChanges', "updated");
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "<%=path%>/accountItem/saveDetials.action",
|
||||
data: {
|
||||
Inserted: JSON.stringify(inserted),
|
||||
Deleted: JSON.stringify(deleted),
|
||||
Updated: JSON.stringify(updated),
|
||||
HeaderId:accepId,
|
||||
clientIp:'<%=clientIp %>'
|
||||
},
|
||||
success: function (tipInfo)
|
||||
{
|
||||
if (tipInfo) {
|
||||
$.messager.alert('提示','保存成功!','info');
|
||||
}
|
||||
else
|
||||
$.messager.alert('提示','保存失败!','error');
|
||||
|
||||
},
|
||||
error: function (XmlHttpRequest, textStatus, errorThrown)
|
||||
{
|
||||
$.messager.alert('提示',XmlHttpRequest.responseText,'error');
|
||||
}
|
||||
});
|
||||
}
|
||||
if (endEditing()) {
|
||||
$('#accountData').datagrid('acceptChanges');
|
||||
}
|
||||
}
|
||||
//获取MaxId
|
||||
function getMaxId()
|
||||
{
|
||||
var accountHeadMax=null;
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: "<%=path%>/accountHead/getMaxId.action",
|
||||
//设置为同步
|
||||
async:false,
|
||||
dataType: "json",
|
||||
success: function (systemInfo)
|
||||
{
|
||||
if(systemInfo)
|
||||
{
|
||||
accountHeadMax = systemInfo.showModel.map.accountHeadMax;
|
||||
var msgTip = systemInfo.showModel.msgTip;
|
||||
if(msgTip == "exceptoin")
|
||||
{
|
||||
$.messager.alert('提示','查找最大的Id异常,请与管理员联系!','error');
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
accountHeadMax=null;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if(accountHeadMax !=null)
|
||||
{
|
||||
if(accountHeadMax.length>0)
|
||||
{
|
||||
accountHeadMaxId=accountHeadMax[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
|
||||
<%
|
||||
String path = request.getContextPath();
|
||||
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
|
||||
String clientIp = Tools.getCurrentUserIP();
|
||||
%>
|
||||
<!DOCTYPE html>
|
||||
@@ -12,15 +11,21 @@
|
||||
<meta charset="utf-8">
|
||||
<!-- 指定以IE8的方式来渲染 -->
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8"/>
|
||||
<link rel="shortcut icon" href="<%=path%>/images/favicon.ico" type="image/x-icon" />
|
||||
<script type="text/javascript" src="<%=path %>/js/jquery-1.8.0.min.js"></script>
|
||||
<link rel="shortcut icon" href="<%=path%>/images/favicon.ico" type="image/x-icon" />
|
||||
<link rel="stylesheet" type="text/css" href="<%=path %>/js/easyui-1.3.5/themes/default/easyui.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="<%=path %>/js/easyui-1.3.5/themes/icon.css"/>
|
||||
<link type="text/css" rel="stylesheet" href="<%=path %>/css/common.css" />
|
||||
<script type="text/javascript" src="<%=path %>/js/easyui-1.3.5/jquery.easyui.min.js"></script>
|
||||
<script type="text/javascript" src="<%=path %>/js/easyui-1.3.5/locale/easyui-lang-zh_CN.js"></script>
|
||||
<script type="text/javascript" src="<%=path %>/js/My97DatePicker/WdatePicker.js"></script>
|
||||
<script type="text/javascript" src="<%=path %>/js/common/common.js"></script>
|
||||
<script src="<%=path %>/js/jquery-1.8.0.min.js"></script>
|
||||
<script src="<%=path %>/js/easyui-1.3.5/jquery.easyui.min.js"></script>
|
||||
<script src="<%=path %>/js/easyui-1.3.5/locale/easyui-lang-zh_CN.js"></script>
|
||||
<script src="<%=path %>/js/My97DatePicker/WdatePicker.js"></script>
|
||||
<script src="<%=path %>/js/common/common.js"></script>
|
||||
<script src="<%=path %>/js/pages/financial/financial_base.js"></script>
|
||||
<script>
|
||||
var kid = ${sessionScope.user.id};
|
||||
var path = "<%=path%>";
|
||||
var clientIp = "<%=clientIp%>";
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- 查询 -->
|
||||
@@ -152,785 +157,5 @@
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
var accountList = null;
|
||||
var accountID = null;
|
||||
var supplierList = null;
|
||||
var supplierID = null;
|
||||
var personList = null;
|
||||
var personID = null;
|
||||
var ProjectSearch=null;
|
||||
var kid=${sessionScope.user.id};
|
||||
var accountHeadMaxId=null; //获取最大的Id
|
||||
var accepId=null; //保存的主表id
|
||||
//初始化界面
|
||||
$(function()
|
||||
{
|
||||
initSystemData_person(); //经手人数据
|
||||
initSelectInfo_person(); //经手人信息
|
||||
initSystemData_account(); //账户数据
|
||||
initSelectInfo_account(); //账户信息
|
||||
initSupplier(); //供应商
|
||||
initTableData();
|
||||
ininPager();
|
||||
initForm();
|
||||
$("#searchBtn").click();
|
||||
});
|
||||
|
||||
//获取账户信息
|
||||
function initSystemData_account()
|
||||
{
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: "<%=path%>/account/getAccount.action",
|
||||
//设置为同步
|
||||
async:false,
|
||||
dataType: "json",
|
||||
success: function (systemInfo)
|
||||
{
|
||||
accountList = systemInfo.showModel.map.accountList;
|
||||
var msgTip = systemInfo.showModel.msgTip;
|
||||
if(msgTip == "exceptoin")
|
||||
{
|
||||
$.messager.alert('提示','查找账户信息异常,请与管理员联系!','error');
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
//获取账户信息
|
||||
function initSelectInfo_account()
|
||||
{
|
||||
var options = "";
|
||||
if(accountList !=null)
|
||||
{
|
||||
options = "";
|
||||
for(var i = 0 ;i < accountList.length;i ++)
|
||||
{
|
||||
var account = accountList[i];
|
||||
options += '<option value="' + account.id + '">' + account.name + '</option>';
|
||||
}
|
||||
$("#AccountId").empty().append(options);
|
||||
}
|
||||
}
|
||||
|
||||
//初始化单位信息
|
||||
function initSupplier()
|
||||
{
|
||||
$('#OrganId').combobox({
|
||||
url: "<%=path%>/supplier/findBySelect_sup.action",
|
||||
valueField:'id',
|
||||
textField:'supplier'
|
||||
});
|
||||
}
|
||||
|
||||
//获取财务员
|
||||
function initSystemData_person()
|
||||
{
|
||||
var type = "财务员";
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: "<%=path%>/person/getPersonByType.action",
|
||||
data: {
|
||||
Type: type
|
||||
},
|
||||
//设置为同步
|
||||
async:false,
|
||||
dataType: "json",
|
||||
success: function (systemInfo)
|
||||
{
|
||||
personList = systemInfo.showModel.map.personList;
|
||||
var msgTip = systemInfo.showModel.msgTip;
|
||||
if(msgTip == "exceptoin")
|
||||
{
|
||||
$.messager.alert('提示','查找系统基础信息异常,请与管理员联系!','error');
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
//获取财务员
|
||||
function initSelectInfo_person()
|
||||
{
|
||||
var options = "";
|
||||
|
||||
if(personList !=null)
|
||||
{
|
||||
for(var i = 0 ;i < personList.length;i ++)
|
||||
{
|
||||
var person = personList[i];
|
||||
if(0 == i)
|
||||
{
|
||||
personID = person.id;
|
||||
}
|
||||
if(person.type=="财务员")
|
||||
{
|
||||
options += '<option value="' + person.id + '">' + person.name + '</option>';
|
||||
}
|
||||
}
|
||||
$("#HandsPersonId").empty().append(options);
|
||||
}
|
||||
}
|
||||
|
||||
//防止表单提交重复
|
||||
function initForm()
|
||||
{
|
||||
$('#accountHeadFM').form({
|
||||
onSubmit: function(){
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//初始化表格数据
|
||||
function initTableData()
|
||||
{
|
||||
$('#tableData').datagrid({
|
||||
//width:700,
|
||||
height:heightInfo,
|
||||
rownumbers: false,
|
||||
//动画效果
|
||||
animate:false,
|
||||
//选中单行
|
||||
singleSelect : true,
|
||||
collapsible:false,
|
||||
selectOnCheck:false,
|
||||
//fitColumns:true,
|
||||
//单击行是否选中
|
||||
//checkOnSelect : false,
|
||||
//url:'<%=path %>/accountHead/findBy.action?pageSize=' + initPageSize,
|
||||
pagination: true,
|
||||
//交替出现背景
|
||||
striped : true,
|
||||
//loadFilter: pagerFilter,
|
||||
pageSize: 5,
|
||||
pageList: initPageNum,
|
||||
columns:[[
|
||||
{ field: 'Id',width:35,align:"center",checkbox:true},
|
||||
{ title: '单据编号',field: 'BillNo',width:100},
|
||||
{ title: '单据时间 ',field: 'BillTime',width:100},
|
||||
{ title: '备注',field: 'Remark',width:100},
|
||||
{ title: '操作',field: 'op',align:"center",width:180,formatter:function(value,rec)
|
||||
{
|
||||
var str = '';
|
||||
var rowInfo = rec.Id + 'AaBb' + rec.BillNo+ 'AaBb' + rec.BillTime+ 'AaBb' + rec.Remark
|
||||
+ 'AaBb' + rec.AccountId+ 'AaBb' + rec.AccountName + 'AaBb' + rec.OrganId + 'AaBb' + rec.OrganName
|
||||
+ 'AaBb' + rec.HandsPersonId + 'AaBb' + rec.HandsPersonName + 'AaBb' + rec.ChangeAmount;
|
||||
if(1 == value)
|
||||
{
|
||||
str += '<img src="<%=path%>/js/easyui-1.3.5/themes/icons/list.png" style="cursor: pointer;" onclick="showAccountHead(\'' + rowInfo + '\');"/> <a onclick="showAccountHead(\'' + rowInfo + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">查看</a> ';
|
||||
str += '<img src="<%=path%>/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editAccountHead(\'' + rowInfo + '\');"/> <a onclick="editAccountHead(\'' + rowInfo + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">编辑</a> ';
|
||||
str += '<img src="<%=path%>/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteAccountHead('+ rec.Id +');"/> <a onclick="deleteAccountHead('+ rec.Id +');" style="text-decoration:none;color:black;" href="javascript:void(0)">删除</a>';
|
||||
}
|
||||
return str;
|
||||
}
|
||||
}
|
||||
]],
|
||||
toolbar:[
|
||||
{
|
||||
id:'addAccountHead',
|
||||
text:'增加',
|
||||
iconCls:'icon-add',
|
||||
handler:function()
|
||||
{
|
||||
addAccountHead();
|
||||
}
|
||||
},
|
||||
{
|
||||
id:'deleteAccountHead',
|
||||
text:'删除',
|
||||
iconCls:'icon-remove',
|
||||
handler:function()
|
||||
{
|
||||
batDeleteAccountHead();
|
||||
}
|
||||
}
|
||||
],
|
||||
onLoadError:function()
|
||||
{
|
||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//初始化表格数据-明细列表-编辑状态
|
||||
function initTableData_account()
|
||||
{
|
||||
$('#accountData').datagrid({
|
||||
height:300,
|
||||
rownumbers: false,
|
||||
//动画效果
|
||||
animate:false,
|
||||
//选中单行
|
||||
singleSelect : true,
|
||||
collapsible:false,
|
||||
selectOnCheck:false,
|
||||
//fitColumns:true,
|
||||
//单击行是否选中
|
||||
//checkOnSelect : false,
|
||||
url:'<%=path %>/accountItem/findBy.action?HeaderId=' + accountHeadID,
|
||||
pagination: true,
|
||||
//交替出现背景
|
||||
striped : true,
|
||||
//loadFilter: pagerFilter,
|
||||
onClickRow: onClickRow,
|
||||
pageSize: 50,
|
||||
pageList: [50,100,150],
|
||||
columns:[[
|
||||
{ field: 'Id',width:35,align:"center",checkbox:true},
|
||||
{ title: '支出项目',field: 'InOutItemId',width:230,
|
||||
formatter:function(value,row,index){
|
||||
return row.InOutItemName;
|
||||
},
|
||||
editor:{
|
||||
type:'combobox',
|
||||
options:{
|
||||
valueField:'Id',
|
||||
textField:'InOutItemName',
|
||||
method:'get',
|
||||
url: "<%=path%>/inOutItem/findBySelect.action?type=out"
|
||||
}
|
||||
}
|
||||
},
|
||||
{ title: '金额',field: 'EachAmount',editor:'validatebox',width:50},
|
||||
{ title: '备注',field: 'Remark',editor:'validatebox',width:150}
|
||||
]],
|
||||
toolbar:[
|
||||
{
|
||||
id:'append',
|
||||
text:'新增',
|
||||
iconCls:'icon-add',
|
||||
handler:function()
|
||||
{
|
||||
append(); //新增
|
||||
}
|
||||
},
|
||||
{
|
||||
id:'delete',
|
||||
text:'删除',
|
||||
iconCls:'icon-remove',
|
||||
handler:function()
|
||||
{
|
||||
removeit(); //删除
|
||||
}
|
||||
},
|
||||
{
|
||||
id:'reject',
|
||||
text:'撤销',
|
||||
iconCls:'icon-undo',
|
||||
handler:function()
|
||||
{
|
||||
reject(); //撤销
|
||||
}
|
||||
}
|
||||
],
|
||||
onLoadError:function()
|
||||
{
|
||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//初始化表格数据-明细列表-查看状态
|
||||
function initTableData_account_show()
|
||||
{
|
||||
$('#accountDataShow').datagrid({
|
||||
height:300,
|
||||
rownumbers: false,
|
||||
//动画效果
|
||||
animate:false,
|
||||
//选中单行
|
||||
singleSelect : true,
|
||||
collapsible:false,
|
||||
selectOnCheck:false,
|
||||
//fitColumns:true,
|
||||
//单击行是否选中
|
||||
//checkOnSelect : false,
|
||||
url:'<%=path %>/accountItem/findBy.action?HeaderId=' + accountHeadID,
|
||||
pagination: true,
|
||||
//交替出现背景
|
||||
striped : true,
|
||||
//loadFilter: pagerFilter,
|
||||
onClickRow: onClickRow,
|
||||
pageSize: 50,
|
||||
pageList: [50,100,150],
|
||||
columns:[[
|
||||
{ field: 'Id',width:35,align:"center",checkbox:true},
|
||||
{ title: '收入项目',field: 'InOutItemName',width:230},
|
||||
{ title: '金额',field: 'EachAmount',width:50},
|
||||
{ title: '备注',field: 'Remark',width:150}
|
||||
]],
|
||||
onLoadError:function()
|
||||
{
|
||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//初始化键盘enter事件
|
||||
$(document).keydown(function(event)
|
||||
{
|
||||
//兼容 IE和firefox 事件
|
||||
var e = window.event || event;
|
||||
var k = e.keyCode||e.which||e.charCode;
|
||||
//兼容 IE,firefox 兼容
|
||||
var obj = e.srcElement ? e.srcElement : e.target;
|
||||
//绑定键盘事件为 id是指定的输入框才可以触发键盘事件 13键盘事件 ---遗留问题 enter键效验 对话框会关闭问题
|
||||
if(k == "13"&&(obj.id=="BillNo"||obj.id=="BillTime"))
|
||||
{
|
||||
$("#saveAccountHead").click();
|
||||
}
|
||||
//搜索按钮添加快捷键
|
||||
if(k == "13"&&(obj.id=="searchBillNo"))
|
||||
{
|
||||
$("#searchBtn").click();
|
||||
}
|
||||
});
|
||||
//分页信息处理
|
||||
function ininPager()
|
||||
{
|
||||
try
|
||||
{
|
||||
var opts = $("#tableData").datagrid('options');
|
||||
var pager = $("#tableData").datagrid('getPager');
|
||||
pager.pagination({
|
||||
onSelectPage:function(pageNum, pageSize)
|
||||
{
|
||||
opts.pageNumber = pageNum;
|
||||
opts.pageSize = pageSize;
|
||||
pager.pagination('refresh',
|
||||
{
|
||||
pageNumber:pageNum,
|
||||
pageSize:pageSize
|
||||
});
|
||||
showAccountHeadDetails(pageNum,pageSize);
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
$.messager.alert('异常处理提示',"分页信息异常 : " + e.name + ": " + e.message,'error');
|
||||
}
|
||||
}
|
||||
|
||||
//删除财务信息
|
||||
function deleteAccountHead(accountHeadID)
|
||||
{
|
||||
$.messager.confirm('删除确认','确定要删除此财务信息吗?',function(r)
|
||||
{
|
||||
if (r)
|
||||
{
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: "<%=path %>/accountHead/delete.action",
|
||||
dataType: "json",
|
||||
data: ({
|
||||
accountHeadID : accountHeadID,
|
||||
clientIp:'<%=clientIp %>'
|
||||
}),
|
||||
success: function (tipInfo)
|
||||
{
|
||||
var msg = tipInfo.showModel.msgTip;
|
||||
if(msg == '成功')
|
||||
{
|
||||
//加载完以后重新初始化
|
||||
$("#searchBtn").click();
|
||||
}
|
||||
else
|
||||
$.messager.alert('删除提示','删除财务信息失败,请稍后再试!','error');
|
||||
},
|
||||
//此处添加错误处理
|
||||
error:function()
|
||||
{
|
||||
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//批量删除财务信息
|
||||
function batDeleteAccountHead()
|
||||
{
|
||||
var row = $('#tableData').datagrid('getChecked');
|
||||
if(row.length == 0)
|
||||
{
|
||||
$.messager.alert('删除提示','没有记录被选中!','info');
|
||||
return;
|
||||
}
|
||||
if(row.length > 0)
|
||||
{
|
||||
$.messager.confirm('删除确认','确定要删除选中的' + row.length + '条财务信息吗?',function(r)
|
||||
{
|
||||
if (r)
|
||||
{
|
||||
var ids = "";
|
||||
for(var i = 0;i < row.length; i ++)
|
||||
{
|
||||
if(i == row.length-1)
|
||||
{
|
||||
ids += row[i].Id;
|
||||
break;
|
||||
}
|
||||
//alert(row[i].id);
|
||||
ids += row[i].Id + ",";
|
||||
}
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: "<%=path %>/accountHead/batchDelete.action",
|
||||
dataType: "json",
|
||||
async : false,
|
||||
data: ({
|
||||
accountHeadIDs : ids,
|
||||
clientIp:'<%=clientIp %>'
|
||||
}),
|
||||
success: function (tipInfo)
|
||||
{
|
||||
var msg = tipInfo.showModel.msgTip;
|
||||
if(msg == '成功')
|
||||
{
|
||||
//加载完以后重新初始化
|
||||
$("#searchBtn").click();
|
||||
$(":checkbox").attr("checked",false);
|
||||
}
|
||||
else
|
||||
$.messager.alert('删除提示','删除财务信息失败,请稍后再试!','error');
|
||||
},
|
||||
//此处添加错误处理
|
||||
error:function()
|
||||
{
|
||||
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//增加
|
||||
var url;
|
||||
var accountHeadID = 0;
|
||||
//保存编辑前的名称
|
||||
var orgAccountHead = "";
|
||||
|
||||
function addAccountHead()
|
||||
{
|
||||
$("#clientIp").val('<%=clientIp %>');
|
||||
$('#accountHeadFM').form('clear');
|
||||
$('#accountHeadDlg').dialog('open').dialog('setTitle','<img src="<%=path%>/js/easyui-1.3.5/themes/icons/edit_add.png"/> 增加财务信息');
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
$("#BillNo").val("").focus();
|
||||
|
||||
orgAccountHead = "";
|
||||
accountHeadID = 0;
|
||||
initTableData_account(); //明细列表
|
||||
reject(); //撤销下、刷新材料列表
|
||||
url = '<%=path %>/accountHead/create.action';
|
||||
}
|
||||
|
||||
//保存信息
|
||||
$("#saveAccountHead").unbind().bind({
|
||||
click:function()
|
||||
{
|
||||
if(!$('#accountHeadFM').form('validate'))
|
||||
return;
|
||||
else
|
||||
{
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: url,
|
||||
dataType: "json",
|
||||
async : false,
|
||||
data: ({
|
||||
Type: "支出",
|
||||
BillNo : $.trim($("#BillNo").val()),
|
||||
BillTime : $.trim($("#BillTime").val()),
|
||||
AccountId: $.trim($("#AccountId").val()),
|
||||
ChangeAmount: $.trim($("#ChangeAmount").val()),
|
||||
OrganId: $('#OrganId').combobox('getValue'),
|
||||
HandsPersonId: $.trim($("#HandsPersonId").val()),
|
||||
Remark: $.trim($("#Remark").val()),
|
||||
clientIp:'<%=clientIp %>'
|
||||
}),
|
||||
success: function (tipInfo)
|
||||
{
|
||||
if(tipInfo)
|
||||
{
|
||||
//保存明细记录
|
||||
if(accountHeadID ==0)
|
||||
{
|
||||
getMaxId(); //查找最大的Id
|
||||
accept(accountHeadMaxId); //新增
|
||||
}
|
||||
else
|
||||
{
|
||||
accept(accountHeadID); //修改
|
||||
}
|
||||
|
||||
|
||||
$('#accountHeadDlg').dialog('close');
|
||||
var opts = $("#tableData").datagrid('options');
|
||||
showAccountHeadDetails(opts.pageNumber,opts.pageSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
$.messager.show({
|
||||
title: '错误提示',
|
||||
msg: '保存信息失败,请稍后重试!'
|
||||
});
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error:function()
|
||||
{
|
||||
$.messager.alert('提示','保存信息异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//编辑信息
|
||||
function editAccountHead(accountHeadTotalInfo)
|
||||
{
|
||||
var accountHeadInfo = accountHeadTotalInfo.split("AaBb");
|
||||
$("#clientIp").val('<%=clientIp %>');
|
||||
$("#BillNo").val(accountHeadInfo[1]);
|
||||
$("#BillTime").val(accountHeadInfo[2]);
|
||||
$("#Remark").val(accountHeadInfo[3]);
|
||||
$("#AccountId").val(accountHeadInfo[4]);
|
||||
$('#OrganId').combobox('setValue', accountHeadInfo[6]);
|
||||
$("#HandsPersonId").val(accountHeadInfo[8]);
|
||||
$("#ChangeAmount").val(accountHeadInfo[10]);
|
||||
$('#accountHeadDlg').dialog('open').dialog('setTitle','<img src="<%=path%>/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑财务信息');
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
accountHeadID = accountHeadInfo[0];
|
||||
|
||||
initTableData_account(); //明细列表
|
||||
reject(); //撤销下、刷新材料列表
|
||||
url = '<%=path %>/accountHead/update.action?accountHeadID=' + accountHeadInfo[0];
|
||||
}
|
||||
|
||||
//查看信息
|
||||
function showAccountHead(accountHeadTotalInfo)
|
||||
{
|
||||
var accountHeadInfo = accountHeadTotalInfo.split("AaBb");
|
||||
$("#BillNoShow").text(accountHeadInfo[1]);
|
||||
$("#BillTimeShow").text(accountHeadInfo[2]);
|
||||
$("#RemarkShow").text(accountHeadInfo[3]);
|
||||
$("#AccountIdShow").text(accountHeadInfo[5]);
|
||||
$('#OrganIdShow').text(accountHeadInfo[7]);
|
||||
$("#HandsPersonIdShow").text(accountHeadInfo[9]);
|
||||
$("#ChangeAmountShow").text(accountHeadInfo[10]);
|
||||
$('#accountHeadDlgShow').dialog('open').dialog('setTitle','<img src="<%=path%>/js/easyui-1.3.5/themes/icons/list.png"/> 查看财务信息');
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
|
||||
accountHeadID = accountHeadInfo[0];
|
||||
initTableData_account_show(); //明细列表-查看状态
|
||||
}
|
||||
|
||||
//搜索处理
|
||||
$("#searchBtn").unbind().bind({
|
||||
click:function()
|
||||
{
|
||||
showAccountHeadDetails(1,initPageSize);
|
||||
var opts = $("#tableData").datagrid('options');
|
||||
var pager = $("#tableData").datagrid('getPager');
|
||||
opts.pageNumber = 1;
|
||||
opts.pageSize = initPageSize;
|
||||
pager.pagination('refresh',
|
||||
{
|
||||
pageNumber:1,
|
||||
pageSize:initPageSize
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
function showAccountHeadDetails(pageNo,pageSize)
|
||||
{
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: "<%=path %>/accountHead/findBy.action",
|
||||
dataType: "json",
|
||||
data: ({
|
||||
Type:"支出",
|
||||
BillNo:$.trim($("#searchBillNo").val()),
|
||||
BeginTime:$("#searchBeginTime").val(),
|
||||
EndTime:$("#searchEndTime").val(),
|
||||
pageNo:pageNo,
|
||||
pageSize:pageSize
|
||||
}),
|
||||
success: function (data)
|
||||
{
|
||||
$("#tableData").datagrid('loadData',data);
|
||||
},
|
||||
//此处添加错误处理
|
||||
error:function()
|
||||
{
|
||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
//重置按钮
|
||||
$("#searchResetBtn").unbind().bind({
|
||||
click:function(){
|
||||
$("#searchBillNo").val("");
|
||||
$("#searchBeginTime").val("");
|
||||
$("#searchEndTime").val("");
|
||||
//加载完以后重新初始化
|
||||
$("#searchBtn").click();
|
||||
}
|
||||
});
|
||||
|
||||
//结束编辑
|
||||
var editIndex = undefined;
|
||||
function endEditing() {
|
||||
if (editIndex == undefined) { return true }
|
||||
if ($('#accountData').datagrid('validateRow', editIndex)) {
|
||||
var ed = $('#accountData').datagrid('getEditor', {index:editIndex,field:'InOutItemId'});
|
||||
var InOutItemName = $(ed.target).combobox('getText');
|
||||
$('#accountData').datagrid('getRows')[editIndex]['InOutItemName'] = InOutItemName;
|
||||
$('#accountData').datagrid('endEdit', editIndex);
|
||||
editIndex = undefined;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//单击
|
||||
function onClickRow(index) {
|
||||
if (editIndex != index) {
|
||||
if (endEditing()) {
|
||||
$('#accountData').datagrid('selectRow', index)
|
||||
.datagrid('beginEdit', index);
|
||||
editIndex = index;
|
||||
} else {
|
||||
$('#accountData').datagrid('selectRow', editIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
//新增
|
||||
function append()
|
||||
{
|
||||
if (endEditing()) {
|
||||
$('#accountData').datagrid('appendRow', {});
|
||||
editIndex = $('#accountData').datagrid('getRows').length - 1;
|
||||
$('#accountData').datagrid('selectRow', editIndex).datagrid('beginEdit', editIndex);
|
||||
}
|
||||
}
|
||||
//删除
|
||||
function removeit() {
|
||||
if (editIndex == undefined) { return }
|
||||
$('#accountData').datagrid('cancelEdit', editIndex)
|
||||
.datagrid('deleteRow', editIndex);
|
||||
editIndex = undefined;
|
||||
}
|
||||
//撤销
|
||||
function reject() {
|
||||
$('#accountData').datagrid('rejectChanges');
|
||||
editIndex = undefined;
|
||||
}
|
||||
//判断
|
||||
function CheckData() {
|
||||
var row = $('#accountData').datagrid('getRows');
|
||||
var totalRowNum = "";
|
||||
for (var i = 0; i < row.length; i++) {
|
||||
if (row[i].InOutItemId == "") {
|
||||
totalRowNum += (i + 1) + "、";
|
||||
}
|
||||
}
|
||||
if (totalRowNum != "") {
|
||||
var totalRowNum = totalRowNum.substring(0, totalRowNum.length - 1);
|
||||
$.messager.alert('提示',"第" + totalRowNum + "行数据填写不完整!",'info');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
//保存
|
||||
function accept(accepId) {
|
||||
append();
|
||||
removeit();
|
||||
if ($("#accountData").datagrid('getChanges').length) {
|
||||
if (!CheckData())
|
||||
return false;
|
||||
var inserted = $("#accountData").datagrid('getChanges', "inserted");
|
||||
var deleted = $("#accountData").datagrid('getChanges', "deleted");
|
||||
var updated = $("#accountData").datagrid('getChanges', "updated");
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "<%=path%>/accountItem/saveDetials.action",
|
||||
data: {
|
||||
Inserted: JSON.stringify(inserted),
|
||||
Deleted: JSON.stringify(deleted),
|
||||
Updated: JSON.stringify(updated),
|
||||
HeaderId:accepId,
|
||||
clientIp:'<%=clientIp %>'
|
||||
},
|
||||
success: function (tipInfo)
|
||||
{
|
||||
if (tipInfo) {
|
||||
$.messager.alert('提示','保存成功!','info');
|
||||
}
|
||||
else
|
||||
$.messager.alert('提示','保存失败!','error');
|
||||
|
||||
},
|
||||
error: function (XmlHttpRequest, textStatus, errorThrown)
|
||||
{
|
||||
$.messager.alert('提示',XmlHttpRequest.responseText,'error');
|
||||
}
|
||||
});
|
||||
}
|
||||
if (endEditing()) {
|
||||
$('#accountData').datagrid('acceptChanges');
|
||||
}
|
||||
}
|
||||
//获取MaxId
|
||||
function getMaxId()
|
||||
{
|
||||
var accountHeadMax=null;
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: "<%=path%>/accountHead/getMaxId.action",
|
||||
//设置为同步
|
||||
async:false,
|
||||
dataType: "json",
|
||||
success: function (systemInfo)
|
||||
{
|
||||
if(systemInfo)
|
||||
{
|
||||
accountHeadMax = systemInfo.showModel.map.accountHeadMax;
|
||||
var msgTip = systemInfo.showModel.msgTip;
|
||||
if(msgTip == "exceptoin")
|
||||
{
|
||||
$.messager.alert('提示','查找最大的Id异常,请与管理员联系!','error');
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
accountHeadMax=null;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if(accountHeadMax !=null)
|
||||
{
|
||||
if(accountHeadMax.length>0)
|
||||
{
|
||||
accountHeadMaxId=accountHeadMax[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
|
||||
<%
|
||||
String path = request.getContextPath();
|
||||
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
|
||||
String clientIp = Tools.getCurrentUserIP();
|
||||
%>
|
||||
<!DOCTYPE html>
|
||||
@@ -12,15 +11,21 @@
|
||||
<meta charset="utf-8">
|
||||
<!-- 指定以IE8的方式来渲染 -->
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8"/>
|
||||
<link rel="shortcut icon" href="<%=path%>/images/favicon.ico" type="image/x-icon" />
|
||||
<script type="text/javascript" src="<%=path %>/js/jquery-1.8.0.min.js"></script>
|
||||
<link rel="shortcut icon" href="<%=path%>/images/favicon.ico" type="image/x-icon" />
|
||||
<link rel="stylesheet" type="text/css" href="<%=path %>/js/easyui-1.3.5/themes/default/easyui.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="<%=path %>/js/easyui-1.3.5/themes/icon.css"/>
|
||||
<link type="text/css" rel="stylesheet" href="<%=path %>/css/common.css" />
|
||||
<script type="text/javascript" src="<%=path %>/js/easyui-1.3.5/jquery.easyui.min.js"></script>
|
||||
<script type="text/javascript" src="<%=path %>/js/easyui-1.3.5/locale/easyui-lang-zh_CN.js"></script>
|
||||
<script type="text/javascript" src="<%=path %>/js/My97DatePicker/WdatePicker.js"></script>
|
||||
<script type="text/javascript" src="<%=path %>/js/common/common.js"></script>
|
||||
<script src="<%=path %>/js/jquery-1.8.0.min.js"></script>
|
||||
<script src="<%=path %>/js/easyui-1.3.5/jquery.easyui.min.js"></script>
|
||||
<script src="<%=path %>/js/easyui-1.3.5/locale/easyui-lang-zh_CN.js"></script>
|
||||
<script src="<%=path %>/js/My97DatePicker/WdatePicker.js"></script>
|
||||
<script src="<%=path %>/js/common/common.js"></script>
|
||||
<script src="<%=path %>/js/pages/financial/financial_base.js"></script>
|
||||
<script>
|
||||
var kid = ${sessionScope.user.id};
|
||||
var path = "<%=path%>";
|
||||
var clientIp = "<%=clientIp%>";
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- 查询 -->
|
||||
@@ -148,785 +153,5 @@
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
var accountList = null;
|
||||
var accountID = null;
|
||||
var supplierList = null;
|
||||
var supplierID = null;
|
||||
var personList = null;
|
||||
var personID = null;
|
||||
var ProjectSearch=null;
|
||||
var kid=${sessionScope.user.id};
|
||||
var accountHeadMaxId=null; //获取最大的Id
|
||||
var accepId=null; //保存的主表id
|
||||
//初始化界面
|
||||
$(function()
|
||||
{
|
||||
initSystemData_person(); //经手人数据
|
||||
initSelectInfo_person(); //经手人信息
|
||||
initSystemData_account(); //账户数据
|
||||
initSelectInfo_account(); //账户信息
|
||||
initSupplier(); //供应商
|
||||
initTableData();
|
||||
ininPager();
|
||||
initForm();
|
||||
$("#searchBtn").click();
|
||||
});
|
||||
|
||||
//获取账户信息
|
||||
function initSystemData_account()
|
||||
{
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: "<%=path%>/account/getAccount.action",
|
||||
//设置为同步
|
||||
async:false,
|
||||
dataType: "json",
|
||||
success: function (systemInfo)
|
||||
{
|
||||
accountList = systemInfo.showModel.map.accountList;
|
||||
var msgTip = systemInfo.showModel.msgTip;
|
||||
if(msgTip == "exceptoin")
|
||||
{
|
||||
$.messager.alert('提示','查找账户信息异常,请与管理员联系!','error');
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
//获取账户信息
|
||||
function initSelectInfo_account()
|
||||
{
|
||||
var options = "";
|
||||
if(accountList !=null)
|
||||
{
|
||||
options = "";
|
||||
for(var i = 0 ;i < accountList.length;i ++)
|
||||
{
|
||||
var account = accountList[i];
|
||||
options += '<option value="' + account.id + '">' + account.name + '</option>';
|
||||
}
|
||||
$("#AccountId").empty().append(options);
|
||||
}
|
||||
}
|
||||
|
||||
//初始化单位信息
|
||||
function initSupplier()
|
||||
{
|
||||
$('#OrganId').combobox({
|
||||
url: "<%=path%>/supplier/findBySelect_sup.action",
|
||||
valueField:'id',
|
||||
textField:'supplier'
|
||||
});
|
||||
}
|
||||
|
||||
//获取财务员
|
||||
function initSystemData_person()
|
||||
{
|
||||
var type = "财务员";
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: "<%=path%>/person/getPersonByType.action",
|
||||
data: {
|
||||
Type: type
|
||||
},
|
||||
//设置为同步
|
||||
async:false,
|
||||
dataType: "json",
|
||||
success: function (systemInfo)
|
||||
{
|
||||
personList = systemInfo.showModel.map.personList;
|
||||
var msgTip = systemInfo.showModel.msgTip;
|
||||
if(msgTip == "exceptoin")
|
||||
{
|
||||
$.messager.alert('提示','查找系统基础信息异常,请与管理员联系!','error');
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
//获取财务员
|
||||
function initSelectInfo_person()
|
||||
{
|
||||
var options = "";
|
||||
|
||||
if(personList !=null)
|
||||
{
|
||||
for(var i = 0 ;i < personList.length;i ++)
|
||||
{
|
||||
var person = personList[i];
|
||||
if(0 == i)
|
||||
{
|
||||
personID = person.id;
|
||||
}
|
||||
if(person.type=="财务员")
|
||||
{
|
||||
options += '<option value="' + person.id + '">' + person.name + '</option>';
|
||||
}
|
||||
}
|
||||
$("#HandsPersonId").empty().append(options);
|
||||
}
|
||||
}
|
||||
|
||||
//防止表单提交重复
|
||||
function initForm()
|
||||
{
|
||||
$('#accountHeadFM').form({
|
||||
onSubmit: function(){
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//初始化表格数据
|
||||
function initTableData()
|
||||
{
|
||||
$('#tableData').datagrid({
|
||||
//width:700,
|
||||
height:heightInfo,
|
||||
rownumbers: false,
|
||||
//动画效果
|
||||
animate:false,
|
||||
//选中单行
|
||||
singleSelect : true,
|
||||
collapsible:false,
|
||||
selectOnCheck:false,
|
||||
//fitColumns:true,
|
||||
//单击行是否选中
|
||||
//checkOnSelect : false,
|
||||
//url:'<%=path %>/accountHead/findBy.action?pageSize=' + initPageSize,
|
||||
pagination: true,
|
||||
//交替出现背景
|
||||
striped : true,
|
||||
//loadFilter: pagerFilter,
|
||||
pageSize: 5,
|
||||
pageList: initPageNum,
|
||||
columns:[[
|
||||
{ field: 'Id',width:35,align:"center",checkbox:true},
|
||||
{ title: '单据编号',field: 'BillNo',width:100},
|
||||
{ title: '单据时间 ',field: 'BillTime',width:100},
|
||||
{ title: '备注',field: 'Remark',width:100},
|
||||
{ title: '操作',field: 'op',align:"center",width:180,formatter:function(value,rec)
|
||||
{
|
||||
var str = '';
|
||||
var rowInfo = rec.Id + 'AaBb' + rec.BillNo+ 'AaBb' + rec.BillTime+ 'AaBb' + rec.Remark
|
||||
+ 'AaBb' + rec.AccountId+ 'AaBb' + rec.AccountName + 'AaBb' + rec.OrganId + 'AaBb' + rec.OrganName
|
||||
+ 'AaBb' + rec.HandsPersonId + 'AaBb' + rec.HandsPersonName + 'AaBb' + rec.ChangeAmount;
|
||||
if(1 == value)
|
||||
{
|
||||
str += '<img src="<%=path%>/js/easyui-1.3.5/themes/icons/list.png" style="cursor: pointer;" onclick="showAccountHead(\'' + rowInfo + '\');"/> <a onclick="showAccountHead(\'' + rowInfo + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">查看</a> ';
|
||||
str += '<img src="<%=path%>/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editAccountHead(\'' + rowInfo + '\');"/> <a onclick="editAccountHead(\'' + rowInfo + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">编辑</a> ';
|
||||
str += '<img src="<%=path%>/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteAccountHead('+ rec.Id +');"/> <a onclick="deleteAccountHead('+ rec.Id +');" style="text-decoration:none;color:black;" href="javascript:void(0)">删除</a>';
|
||||
}
|
||||
return str;
|
||||
}
|
||||
}
|
||||
]],
|
||||
toolbar:[
|
||||
{
|
||||
id:'addAccountHead',
|
||||
text:'增加',
|
||||
iconCls:'icon-add',
|
||||
handler:function()
|
||||
{
|
||||
addAccountHead();
|
||||
}
|
||||
},
|
||||
{
|
||||
id:'deleteAccountHead',
|
||||
text:'删除',
|
||||
iconCls:'icon-remove',
|
||||
handler:function()
|
||||
{
|
||||
batDeleteAccountHead();
|
||||
}
|
||||
}
|
||||
],
|
||||
onLoadError:function()
|
||||
{
|
||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//初始化表格数据-明细列表-编辑状态
|
||||
function initTableData_account()
|
||||
{
|
||||
$('#accountData').datagrid({
|
||||
height:300,
|
||||
rownumbers: false,
|
||||
//动画效果
|
||||
animate:false,
|
||||
//选中单行
|
||||
singleSelect : true,
|
||||
collapsible:false,
|
||||
selectOnCheck:false,
|
||||
//fitColumns:true,
|
||||
//单击行是否选中
|
||||
//checkOnSelect : false,
|
||||
url:'<%=path %>/accountItem/findBy.action?HeaderId=' + accountHeadID,
|
||||
pagination: true,
|
||||
//交替出现背景
|
||||
striped : true,
|
||||
//loadFilter: pagerFilter,
|
||||
onClickRow: onClickRow,
|
||||
pageSize: 50,
|
||||
pageList: [50,100,150],
|
||||
columns:[[
|
||||
{ field: 'Id',width:35,align:"center",checkbox:true},
|
||||
{ title: '账户名称',field: 'AccountId',width:230,
|
||||
formatter:function(value,row,index){
|
||||
return row.AccountName;
|
||||
},
|
||||
editor:{
|
||||
type:'combobox',
|
||||
options:{
|
||||
valueField:'Id',
|
||||
textField:'AccountName',
|
||||
method:'get',
|
||||
url: "<%=path%>/account/findBySelect.action"
|
||||
}
|
||||
}
|
||||
},
|
||||
{ title: '金额',field: 'EachAmount',editor:'validatebox',width:50},
|
||||
{ title: '备注',field: 'Remark',editor:'validatebox',width:150}
|
||||
]],
|
||||
toolbar:[
|
||||
{
|
||||
id:'append',
|
||||
text:'新增',
|
||||
iconCls:'icon-add',
|
||||
handler:function()
|
||||
{
|
||||
append(); //新增
|
||||
}
|
||||
},
|
||||
{
|
||||
id:'delete',
|
||||
text:'删除',
|
||||
iconCls:'icon-remove',
|
||||
handler:function()
|
||||
{
|
||||
removeit(); //删除
|
||||
}
|
||||
},
|
||||
{
|
||||
id:'reject',
|
||||
text:'撤销',
|
||||
iconCls:'icon-undo',
|
||||
handler:function()
|
||||
{
|
||||
reject(); //撤销
|
||||
}
|
||||
}
|
||||
],
|
||||
onLoadError:function()
|
||||
{
|
||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//初始化表格数据-明细列表-查看状态
|
||||
function initTableData_account_show()
|
||||
{
|
||||
$('#accountDataShow').datagrid({
|
||||
height:300,
|
||||
rownumbers: false,
|
||||
//动画效果
|
||||
animate:false,
|
||||
//选中单行
|
||||
singleSelect : true,
|
||||
collapsible:false,
|
||||
selectOnCheck:false,
|
||||
//fitColumns:true,
|
||||
//单击行是否选中
|
||||
//checkOnSelect : false,
|
||||
url:'<%=path %>/accountItem/findBy.action?HeaderId=' + accountHeadID,
|
||||
pagination: true,
|
||||
//交替出现背景
|
||||
striped : true,
|
||||
//loadFilter: pagerFilter,
|
||||
onClickRow: onClickRow,
|
||||
pageSize: 50,
|
||||
pageList: [50,100,150],
|
||||
columns:[[
|
||||
{ field: 'Id',width:35,align:"center",checkbox:true},
|
||||
{ title: '账户名称',field: 'AccountName',width:230},
|
||||
{ title: '金额',field: 'EachAmount',width:50},
|
||||
{ title: '备注',field: 'Remark',width:150}
|
||||
]],
|
||||
onLoadError:function()
|
||||
{
|
||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//初始化键盘enter事件
|
||||
$(document).keydown(function(event)
|
||||
{
|
||||
//兼容 IE和firefox 事件
|
||||
var e = window.event || event;
|
||||
var k = e.keyCode||e.which||e.charCode;
|
||||
//兼容 IE,firefox 兼容
|
||||
var obj = e.srcElement ? e.srcElement : e.target;
|
||||
//绑定键盘事件为 id是指定的输入框才可以触发键盘事件 13键盘事件 ---遗留问题 enter键效验 对话框会关闭问题
|
||||
if(k == "13"&&(obj.id=="BillNo"||obj.id=="BillTime"))
|
||||
{
|
||||
$("#saveAccountHead").click();
|
||||
}
|
||||
//搜索按钮添加快捷键
|
||||
if(k == "13"&&(obj.id=="searchBillNo"))
|
||||
{
|
||||
$("#searchBtn").click();
|
||||
}
|
||||
});
|
||||
//分页信息处理
|
||||
function ininPager()
|
||||
{
|
||||
try
|
||||
{
|
||||
var opts = $("#tableData").datagrid('options');
|
||||
var pager = $("#tableData").datagrid('getPager');
|
||||
pager.pagination({
|
||||
onSelectPage:function(pageNum, pageSize)
|
||||
{
|
||||
opts.pageNumber = pageNum;
|
||||
opts.pageSize = pageSize;
|
||||
pager.pagination('refresh',
|
||||
{
|
||||
pageNumber:pageNum,
|
||||
pageSize:pageSize
|
||||
});
|
||||
showAccountHeadDetails(pageNum,pageSize);
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
$.messager.alert('异常处理提示',"分页信息异常 : " + e.name + ": " + e.message,'error');
|
||||
}
|
||||
}
|
||||
|
||||
//删除财务信息
|
||||
function deleteAccountHead(accountHeadID)
|
||||
{
|
||||
$.messager.confirm('删除确认','确定要删除此财务信息吗?',function(r)
|
||||
{
|
||||
if (r)
|
||||
{
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: "<%=path %>/accountHead/delete.action",
|
||||
dataType: "json",
|
||||
data: ({
|
||||
accountHeadID : accountHeadID,
|
||||
clientIp:'<%=clientIp %>'
|
||||
}),
|
||||
success: function (tipInfo)
|
||||
{
|
||||
var msg = tipInfo.showModel.msgTip;
|
||||
if(msg == '成功')
|
||||
{
|
||||
//加载完以后重新初始化
|
||||
$("#searchBtn").click();
|
||||
}
|
||||
else
|
||||
$.messager.alert('删除提示','删除财务信息失败,请稍后再试!','error');
|
||||
},
|
||||
//此处添加错误处理
|
||||
error:function()
|
||||
{
|
||||
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//批量删除财务信息
|
||||
function batDeleteAccountHead()
|
||||
{
|
||||
var row = $('#tableData').datagrid('getChecked');
|
||||
if(row.length == 0)
|
||||
{
|
||||
$.messager.alert('删除提示','没有记录被选中!','info');
|
||||
return;
|
||||
}
|
||||
if(row.length > 0)
|
||||
{
|
||||
$.messager.confirm('删除确认','确定要删除选中的' + row.length + '条财务信息吗?',function(r)
|
||||
{
|
||||
if (r)
|
||||
{
|
||||
var ids = "";
|
||||
for(var i = 0;i < row.length; i ++)
|
||||
{
|
||||
if(i == row.length-1)
|
||||
{
|
||||
ids += row[i].Id;
|
||||
break;
|
||||
}
|
||||
//alert(row[i].id);
|
||||
ids += row[i].Id + ",";
|
||||
}
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: "<%=path %>/accountHead/batchDelete.action",
|
||||
dataType: "json",
|
||||
async : false,
|
||||
data: ({
|
||||
accountHeadIDs : ids,
|
||||
clientIp:'<%=clientIp %>'
|
||||
}),
|
||||
success: function (tipInfo)
|
||||
{
|
||||
var msg = tipInfo.showModel.msgTip;
|
||||
if(msg == '成功')
|
||||
{
|
||||
//加载完以后重新初始化
|
||||
$("#searchBtn").click();
|
||||
$(":checkbox").attr("checked",false);
|
||||
}
|
||||
else
|
||||
$.messager.alert('删除提示','删除财务信息失败,请稍后再试!','error');
|
||||
},
|
||||
//此处添加错误处理
|
||||
error:function()
|
||||
{
|
||||
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//增加
|
||||
var url;
|
||||
var accountHeadID = 0;
|
||||
//保存编辑前的名称
|
||||
var orgAccountHead = "";
|
||||
|
||||
function addAccountHead()
|
||||
{
|
||||
$("#clientIp").val('<%=clientIp %>');
|
||||
$('#accountHeadFM').form('clear');
|
||||
$('#accountHeadDlg').dialog('open').dialog('setTitle','<img src="<%=path%>/js/easyui-1.3.5/themes/icons/edit_add.png"/> 增加财务信息');
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
$("#BillNo").val("").focus();
|
||||
|
||||
orgAccountHead = "";
|
||||
accountHeadID = 0;
|
||||
initTableData_account(); //明细列表
|
||||
reject(); //撤销下、刷新材料列表
|
||||
url = '<%=path %>/accountHead/create.action';
|
||||
}
|
||||
|
||||
//保存信息
|
||||
$("#saveAccountHead").unbind().bind({
|
||||
click:function()
|
||||
{
|
||||
if(!$('#accountHeadFM').form('validate'))
|
||||
return;
|
||||
else
|
||||
{
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: url,
|
||||
dataType: "json",
|
||||
async : false,
|
||||
data: ({
|
||||
Type: "收款",
|
||||
BillNo : $.trim($("#BillNo").val()),
|
||||
BillTime : $.trim($("#BillTime").val()),
|
||||
AccountId: $.trim($("#AccountId").val()),
|
||||
ChangeAmount: $.trim($("#ChangeAmount").val()),
|
||||
OrganId: $('#OrganId').combobox('getValue'),
|
||||
HandsPersonId: $.trim($("#HandsPersonId").val()),
|
||||
Remark: $.trim($("#Remark").val()),
|
||||
clientIp:'<%=clientIp %>'
|
||||
}),
|
||||
success: function (tipInfo)
|
||||
{
|
||||
if(tipInfo)
|
||||
{
|
||||
//保存明细记录
|
||||
if(accountHeadID ==0)
|
||||
{
|
||||
getMaxId(); //查找最大的Id
|
||||
accept(accountHeadMaxId); //新增
|
||||
}
|
||||
else
|
||||
{
|
||||
accept(accountHeadID); //修改
|
||||
}
|
||||
|
||||
|
||||
$('#accountHeadDlg').dialog('close');
|
||||
var opts = $("#tableData").datagrid('options');
|
||||
showAccountHeadDetails(opts.pageNumber,opts.pageSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
$.messager.show({
|
||||
title: '错误提示',
|
||||
msg: '保存信息失败,请稍后重试!'
|
||||
});
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error:function()
|
||||
{
|
||||
$.messager.alert('提示','保存信息异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//编辑信息
|
||||
function editAccountHead(accountHeadTotalInfo)
|
||||
{
|
||||
var accountHeadInfo = accountHeadTotalInfo.split("AaBb");
|
||||
$("#clientIp").val('<%=clientIp %>');
|
||||
$("#BillNo").val(accountHeadInfo[1]);
|
||||
$("#BillTime").val(accountHeadInfo[2]);
|
||||
$("#Remark").val(accountHeadInfo[3]);
|
||||
$("#AccountId").val(accountHeadInfo[4]);
|
||||
$('#OrganId').combobox('setValue', accountHeadInfo[6]);
|
||||
$("#HandsPersonId").val(accountHeadInfo[8]);
|
||||
$("#ChangeAmount").val(accountHeadInfo[10]);
|
||||
$('#accountHeadDlg').dialog('open').dialog('setTitle','<img src="<%=path%>/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑财务信息');
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
accountHeadID = accountHeadInfo[0];
|
||||
|
||||
initTableData_account(); //明细列表
|
||||
reject(); //撤销下、刷新材料列表
|
||||
url = '<%=path %>/accountHead/update.action?accountHeadID=' + accountHeadInfo[0];
|
||||
}
|
||||
|
||||
//查看信息
|
||||
function showAccountHead(accountHeadTotalInfo)
|
||||
{
|
||||
var accountHeadInfo = accountHeadTotalInfo.split("AaBb");
|
||||
$("#BillNoShow").text(accountHeadInfo[1]);
|
||||
$("#BillTimeShow").text(accountHeadInfo[2]);
|
||||
$("#RemarkShow").text(accountHeadInfo[3]);
|
||||
$("#AccountIdShow").text(accountHeadInfo[5]);
|
||||
$('#OrganIdShow').text(accountHeadInfo[7]);
|
||||
$("#HandsPersonIdShow").text(accountHeadInfo[9]);
|
||||
$("#ChangeAmountShow").text(accountHeadInfo[10]);
|
||||
$('#accountHeadDlgShow').dialog('open').dialog('setTitle','<img src="<%=path%>/js/easyui-1.3.5/themes/icons/list.png"/> 查看财务信息');
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
|
||||
accountHeadID = accountHeadInfo[0];
|
||||
initTableData_account_show(); //明细列表-查看状态
|
||||
}
|
||||
|
||||
//搜索处理
|
||||
$("#searchBtn").unbind().bind({
|
||||
click:function()
|
||||
{
|
||||
showAccountHeadDetails(1,initPageSize);
|
||||
var opts = $("#tableData").datagrid('options');
|
||||
var pager = $("#tableData").datagrid('getPager');
|
||||
opts.pageNumber = 1;
|
||||
opts.pageSize = initPageSize;
|
||||
pager.pagination('refresh',
|
||||
{
|
||||
pageNumber:1,
|
||||
pageSize:initPageSize
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
function showAccountHeadDetails(pageNo,pageSize)
|
||||
{
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: "<%=path %>/accountHead/findBy.action",
|
||||
dataType: "json",
|
||||
data: ({
|
||||
Type:"收款",
|
||||
BillNo:$.trim($("#searchBillNo").val()),
|
||||
BeginTime:$("#searchBeginTime").val(),
|
||||
EndTime:$("#searchEndTime").val(),
|
||||
pageNo:pageNo,
|
||||
pageSize:pageSize
|
||||
}),
|
||||
success: function (data)
|
||||
{
|
||||
$("#tableData").datagrid('loadData',data);
|
||||
},
|
||||
//此处添加错误处理
|
||||
error:function()
|
||||
{
|
||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
//重置按钮
|
||||
$("#searchResetBtn").unbind().bind({
|
||||
click:function(){
|
||||
$("#searchBillNo").val("");
|
||||
$("#searchBeginTime").val("");
|
||||
$("#searchEndTime").val("");
|
||||
//加载完以后重新初始化
|
||||
$("#searchBtn").click();
|
||||
}
|
||||
});
|
||||
|
||||
//结束编辑
|
||||
var editIndex = undefined;
|
||||
function endEditing() {
|
||||
if (editIndex == undefined) { return true }
|
||||
if ($('#accountData').datagrid('validateRow', editIndex)) {
|
||||
var ed = $('#accountData').datagrid('getEditor', {index:editIndex,field:'AccountId'});
|
||||
var AccountName = $(ed.target).combobox('getText');
|
||||
$('#accountData').datagrid('getRows')[editIndex]['AccountName'] = AccountName;
|
||||
$('#accountData').datagrid('endEdit', editIndex);
|
||||
editIndex = undefined;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//单击
|
||||
function onClickRow(index) {
|
||||
if (editIndex != index) {
|
||||
if (endEditing()) {
|
||||
$('#accountData').datagrid('selectRow', index)
|
||||
.datagrid('beginEdit', index);
|
||||
editIndex = index;
|
||||
} else {
|
||||
$('#accountData').datagrid('selectRow', editIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
//新增
|
||||
function append()
|
||||
{
|
||||
if (endEditing()) {
|
||||
$('#accountData').datagrid('appendRow', {});
|
||||
editIndex = $('#accountData').datagrid('getRows').length - 1;
|
||||
$('#accountData').datagrid('selectRow', editIndex).datagrid('beginEdit', editIndex);
|
||||
}
|
||||
}
|
||||
//删除
|
||||
function removeit() {
|
||||
if (editIndex == undefined) { return }
|
||||
$('#accountData').datagrid('cancelEdit', editIndex)
|
||||
.datagrid('deleteRow', editIndex);
|
||||
editIndex = undefined;
|
||||
}
|
||||
//撤销
|
||||
function reject() {
|
||||
$('#accountData').datagrid('rejectChanges');
|
||||
editIndex = undefined;
|
||||
}
|
||||
//判断
|
||||
function CheckData() {
|
||||
var row = $('#accountData').datagrid('getRows');
|
||||
var totalRowNum = "";
|
||||
for (var i = 0; i < row.length; i++) {
|
||||
if (row[i].AccountId == "") {
|
||||
totalRowNum += (i + 1) + "、";
|
||||
}
|
||||
}
|
||||
if (totalRowNum != "") {
|
||||
var totalRowNum = totalRowNum.substring(0, totalRowNum.length - 1);
|
||||
$.messager.alert('提示',"第" + totalRowNum + "行数据填写不完整!",'info');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
//保存
|
||||
function accept(accepId) {
|
||||
append();
|
||||
removeit();
|
||||
if ($("#accountData").datagrid('getChanges').length) {
|
||||
if (!CheckData())
|
||||
return false;
|
||||
var inserted = $("#accountData").datagrid('getChanges', "inserted");
|
||||
var deleted = $("#accountData").datagrid('getChanges', "deleted");
|
||||
var updated = $("#accountData").datagrid('getChanges', "updated");
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "<%=path%>/accountItem/saveDetials.action",
|
||||
data: {
|
||||
Inserted: JSON.stringify(inserted),
|
||||
Deleted: JSON.stringify(deleted),
|
||||
Updated: JSON.stringify(updated),
|
||||
HeaderId:accepId,
|
||||
clientIp:'<%=clientIp %>'
|
||||
},
|
||||
success: function (tipInfo)
|
||||
{
|
||||
if (tipInfo) {
|
||||
$.messager.alert('提示','保存成功!','info');
|
||||
}
|
||||
else
|
||||
$.messager.alert('提示','保存失败!','error');
|
||||
|
||||
},
|
||||
error: function (XmlHttpRequest, textStatus, errorThrown)
|
||||
{
|
||||
$.messager.alert('提示',XmlHttpRequest.responseText,'error');
|
||||
}
|
||||
});
|
||||
}
|
||||
if (endEditing()) {
|
||||
$('#accountData').datagrid('acceptChanges');
|
||||
}
|
||||
}
|
||||
//获取MaxId
|
||||
function getMaxId()
|
||||
{
|
||||
var accountHeadMax=null;
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: "<%=path%>/accountHead/getMaxId.action",
|
||||
//设置为同步
|
||||
async:false,
|
||||
dataType: "json",
|
||||
success: function (systemInfo)
|
||||
{
|
||||
if(systemInfo)
|
||||
{
|
||||
accountHeadMax = systemInfo.showModel.map.accountHeadMax;
|
||||
var msgTip = systemInfo.showModel.msgTip;
|
||||
if(msgTip == "exceptoin")
|
||||
{
|
||||
$.messager.alert('提示','查找最大的Id异常,请与管理员联系!','error');
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
accountHeadMax=null;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if(accountHeadMax !=null)
|
||||
{
|
||||
if(accountHeadMax.length>0)
|
||||
{
|
||||
accountHeadMaxId=accountHeadMax[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
|
||||
<%
|
||||
String path = request.getContextPath();
|
||||
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
|
||||
String clientIp = Tools.getCurrentUserIP();
|
||||
%>
|
||||
<!DOCTYPE html>
|
||||
@@ -12,15 +11,21 @@
|
||||
<meta charset="utf-8">
|
||||
<!-- 指定以IE8的方式来渲染 -->
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8"/>
|
||||
<link rel="shortcut icon" href="<%=path%>/images/favicon.ico" type="image/x-icon" />
|
||||
<script type="text/javascript" src="<%=path %>/js/jquery-1.8.0.min.js"></script>
|
||||
<link rel="shortcut icon" href="<%=path%>/images/favicon.ico" type="image/x-icon" />
|
||||
<link rel="stylesheet" type="text/css" href="<%=path %>/js/easyui-1.3.5/themes/default/easyui.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="<%=path %>/js/easyui-1.3.5/themes/icon.css"/>
|
||||
<link type="text/css" rel="stylesheet" href="<%=path %>/css/common.css" />
|
||||
<script type="text/javascript" src="<%=path %>/js/easyui-1.3.5/jquery.easyui.min.js"></script>
|
||||
<script type="text/javascript" src="<%=path %>/js/easyui-1.3.5/locale/easyui-lang-zh_CN.js"></script>
|
||||
<script type="text/javascript" src="<%=path %>/js/My97DatePicker/WdatePicker.js"></script>
|
||||
<script type="text/javascript" src="<%=path %>/js/common/common.js"></script>
|
||||
<script src="<%=path %>/js/jquery-1.8.0.min.js"></script>
|
||||
<script src="<%=path %>/js/easyui-1.3.5/jquery.easyui.min.js"></script>
|
||||
<script src="<%=path %>/js/easyui-1.3.5/locale/easyui-lang-zh_CN.js"></script>
|
||||
<script src="<%=path %>/js/My97DatePicker/WdatePicker.js"></script>
|
||||
<script src="<%=path %>/js/common/common.js"></script>
|
||||
<script src="<%=path %>/js/pages/financial/financial_base.js"></script>
|
||||
<script>
|
||||
var kid = ${sessionScope.user.id};
|
||||
var path = "<%=path%>";
|
||||
var clientIp = "<%=clientIp%>";
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- 查询 -->
|
||||
@@ -148,785 +153,5 @@
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
var accountList = null;
|
||||
var accountID = null;
|
||||
var supplierList = null;
|
||||
var supplierID = null;
|
||||
var personList = null;
|
||||
var personID = null;
|
||||
var ProjectSearch=null;
|
||||
var kid=${sessionScope.user.id};
|
||||
var accountHeadMaxId=null; //获取最大的Id
|
||||
var accepId=null; //保存的主表id
|
||||
//初始化界面
|
||||
$(function()
|
||||
{
|
||||
initSystemData_person(); //经手人数据
|
||||
initSelectInfo_person(); //经手人信息
|
||||
initSystemData_account(); //账户数据
|
||||
initSelectInfo_account(); //账户信息
|
||||
initSupplier(); //供应商
|
||||
initTableData();
|
||||
ininPager();
|
||||
initForm();
|
||||
$("#searchBtn").click();
|
||||
});
|
||||
|
||||
//获取账户信息
|
||||
function initSystemData_account()
|
||||
{
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: "<%=path%>/account/getAccount.action",
|
||||
//设置为同步
|
||||
async:false,
|
||||
dataType: "json",
|
||||
success: function (systemInfo)
|
||||
{
|
||||
accountList = systemInfo.showModel.map.accountList;
|
||||
var msgTip = systemInfo.showModel.msgTip;
|
||||
if(msgTip == "exceptoin")
|
||||
{
|
||||
$.messager.alert('提示','查找账户信息异常,请与管理员联系!','error');
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
//获取账户信息
|
||||
function initSelectInfo_account()
|
||||
{
|
||||
var options = "";
|
||||
if(accountList !=null)
|
||||
{
|
||||
options = "";
|
||||
for(var i = 0 ;i < accountList.length;i ++)
|
||||
{
|
||||
var account = accountList[i];
|
||||
options += '<option value="' + account.id + '">' + account.name + '</option>';
|
||||
}
|
||||
$("#AccountId").empty().append(options);
|
||||
}
|
||||
}
|
||||
|
||||
//初始化单位信息
|
||||
function initSupplier()
|
||||
{
|
||||
$('#OrganId').combobox({
|
||||
url: "<%=path%>/supplier/findBySelect_sup.action",
|
||||
valueField:'id',
|
||||
textField:'supplier'
|
||||
});
|
||||
}
|
||||
|
||||
//获取财务员
|
||||
function initSystemData_person()
|
||||
{
|
||||
var type = "财务员";
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: "<%=path%>/person/getPersonByType.action",
|
||||
data: {
|
||||
Type: type
|
||||
},
|
||||
//设置为同步
|
||||
async:false,
|
||||
dataType: "json",
|
||||
success: function (systemInfo)
|
||||
{
|
||||
personList = systemInfo.showModel.map.personList;
|
||||
var msgTip = systemInfo.showModel.msgTip;
|
||||
if(msgTip == "exceptoin")
|
||||
{
|
||||
$.messager.alert('提示','查找系统基础信息异常,请与管理员联系!','error');
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
//获取财务员
|
||||
function initSelectInfo_person()
|
||||
{
|
||||
var options = "";
|
||||
|
||||
if(personList !=null)
|
||||
{
|
||||
for(var i = 0 ;i < personList.length;i ++)
|
||||
{
|
||||
var person = personList[i];
|
||||
if(0 == i)
|
||||
{
|
||||
personID = person.id;
|
||||
}
|
||||
if(person.type=="财务员")
|
||||
{
|
||||
options += '<option value="' + person.id + '">' + person.name + '</option>';
|
||||
}
|
||||
}
|
||||
$("#HandsPersonId").empty().append(options);
|
||||
}
|
||||
}
|
||||
|
||||
//防止表单提交重复
|
||||
function initForm()
|
||||
{
|
||||
$('#accountHeadFM').form({
|
||||
onSubmit: function(){
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//初始化表格数据
|
||||
function initTableData()
|
||||
{
|
||||
$('#tableData').datagrid({
|
||||
//width:700,
|
||||
height:heightInfo,
|
||||
rownumbers: false,
|
||||
//动画效果
|
||||
animate:false,
|
||||
//选中单行
|
||||
singleSelect : true,
|
||||
collapsible:false,
|
||||
selectOnCheck:false,
|
||||
//fitColumns:true,
|
||||
//单击行是否选中
|
||||
//checkOnSelect : false,
|
||||
//url:'<%=path %>/accountHead/findBy.action?pageSize=' + initPageSize,
|
||||
pagination: true,
|
||||
//交替出现背景
|
||||
striped : true,
|
||||
//loadFilter: pagerFilter,
|
||||
pageSize: 5,
|
||||
pageList: initPageNum,
|
||||
columns:[[
|
||||
{ field: 'Id',width:35,align:"center",checkbox:true},
|
||||
{ title: '单据编号',field: 'BillNo',width:100},
|
||||
{ title: '单据时间 ',field: 'BillTime',width:100},
|
||||
{ title: '备注',field: 'Remark',width:100},
|
||||
{ title: '操作',field: 'op',align:"center",width:180,formatter:function(value,rec)
|
||||
{
|
||||
var str = '';
|
||||
var rowInfo = rec.Id + 'AaBb' + rec.BillNo+ 'AaBb' + rec.BillTime+ 'AaBb' + rec.Remark
|
||||
+ 'AaBb' + rec.AccountId+ 'AaBb' + rec.AccountName + 'AaBb' + rec.OrganId + 'AaBb' + rec.OrganName
|
||||
+ 'AaBb' + rec.HandsPersonId + 'AaBb' + rec.HandsPersonName + 'AaBb' + rec.ChangeAmount;
|
||||
if(1 == value)
|
||||
{
|
||||
str += '<img src="<%=path%>/js/easyui-1.3.5/themes/icons/list.png" style="cursor: pointer;" onclick="showAccountHead(\'' + rowInfo + '\');"/> <a onclick="showAccountHead(\'' + rowInfo + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">查看</a> ';
|
||||
str += '<img src="<%=path%>/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editAccountHead(\'' + rowInfo + '\');"/> <a onclick="editAccountHead(\'' + rowInfo + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">编辑</a> ';
|
||||
str += '<img src="<%=path%>/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteAccountHead('+ rec.Id +');"/> <a onclick="deleteAccountHead('+ rec.Id +');" style="text-decoration:none;color:black;" href="javascript:void(0)">删除</a>';
|
||||
}
|
||||
return str;
|
||||
}
|
||||
}
|
||||
]],
|
||||
toolbar:[
|
||||
{
|
||||
id:'addAccountHead',
|
||||
text:'增加',
|
||||
iconCls:'icon-add',
|
||||
handler:function()
|
||||
{
|
||||
addAccountHead();
|
||||
}
|
||||
},
|
||||
{
|
||||
id:'deleteAccountHead',
|
||||
text:'删除',
|
||||
iconCls:'icon-remove',
|
||||
handler:function()
|
||||
{
|
||||
batDeleteAccountHead();
|
||||
}
|
||||
}
|
||||
],
|
||||
onLoadError:function()
|
||||
{
|
||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//初始化表格数据-明细列表-编辑状态
|
||||
function initTableData_account()
|
||||
{
|
||||
$('#accountData').datagrid({
|
||||
height:300,
|
||||
rownumbers: false,
|
||||
//动画效果
|
||||
animate:false,
|
||||
//选中单行
|
||||
singleSelect : true,
|
||||
collapsible:false,
|
||||
selectOnCheck:false,
|
||||
//fitColumns:true,
|
||||
//单击行是否选中
|
||||
//checkOnSelect : false,
|
||||
url:'<%=path %>/accountItem/findBy.action?HeaderId=' + accountHeadID,
|
||||
pagination: true,
|
||||
//交替出现背景
|
||||
striped : true,
|
||||
//loadFilter: pagerFilter,
|
||||
onClickRow: onClickRow,
|
||||
pageSize: 50,
|
||||
pageList: [50,100,150],
|
||||
columns:[[
|
||||
{ field: 'Id',width:35,align:"center",checkbox:true},
|
||||
{ title: '账户名称',field: 'AccountId',width:230,
|
||||
formatter:function(value,row,index){
|
||||
return row.AccountName;
|
||||
},
|
||||
editor:{
|
||||
type:'combobox',
|
||||
options:{
|
||||
valueField:'Id',
|
||||
textField:'AccountName',
|
||||
method:'get',
|
||||
url: "<%=path%>/account/findBySelect.action"
|
||||
}
|
||||
}
|
||||
},
|
||||
{ title: '金额',field: 'EachAmount',editor:'validatebox',width:50},
|
||||
{ title: '备注',field: 'Remark',editor:'validatebox',width:150}
|
||||
]],
|
||||
toolbar:[
|
||||
{
|
||||
id:'append',
|
||||
text:'新增',
|
||||
iconCls:'icon-add',
|
||||
handler:function()
|
||||
{
|
||||
append(); //新增
|
||||
}
|
||||
},
|
||||
{
|
||||
id:'delete',
|
||||
text:'删除',
|
||||
iconCls:'icon-remove',
|
||||
handler:function()
|
||||
{
|
||||
removeit(); //删除
|
||||
}
|
||||
},
|
||||
{
|
||||
id:'reject',
|
||||
text:'撤销',
|
||||
iconCls:'icon-undo',
|
||||
handler:function()
|
||||
{
|
||||
reject(); //撤销
|
||||
}
|
||||
}
|
||||
],
|
||||
onLoadError:function()
|
||||
{
|
||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//初始化表格数据-明细列表-查看状态
|
||||
function initTableData_account_show()
|
||||
{
|
||||
$('#accountDataShow').datagrid({
|
||||
height:300,
|
||||
rownumbers: false,
|
||||
//动画效果
|
||||
animate:false,
|
||||
//选中单行
|
||||
singleSelect : true,
|
||||
collapsible:false,
|
||||
selectOnCheck:false,
|
||||
//fitColumns:true,
|
||||
//单击行是否选中
|
||||
//checkOnSelect : false,
|
||||
url:'<%=path %>/accountItem/findBy.action?HeaderId=' + accountHeadID,
|
||||
pagination: true,
|
||||
//交替出现背景
|
||||
striped : true,
|
||||
//loadFilter: pagerFilter,
|
||||
onClickRow: onClickRow,
|
||||
pageSize: 50,
|
||||
pageList: [50,100,150],
|
||||
columns:[[
|
||||
{ field: 'Id',width:35,align:"center",checkbox:true},
|
||||
{ title: '账户名称',field: 'AccountName',width:230},
|
||||
{ title: '金额',field: 'EachAmount',width:50},
|
||||
{ title: '备注',field: 'Remark',width:150}
|
||||
]],
|
||||
onLoadError:function()
|
||||
{
|
||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//初始化键盘enter事件
|
||||
$(document).keydown(function(event)
|
||||
{
|
||||
//兼容 IE和firefox 事件
|
||||
var e = window.event || event;
|
||||
var k = e.keyCode||e.which||e.charCode;
|
||||
//兼容 IE,firefox 兼容
|
||||
var obj = e.srcElement ? e.srcElement : e.target;
|
||||
//绑定键盘事件为 id是指定的输入框才可以触发键盘事件 13键盘事件 ---遗留问题 enter键效验 对话框会关闭问题
|
||||
if(k == "13"&&(obj.id=="BillNo"||obj.id=="BillTime"))
|
||||
{
|
||||
$("#saveAccountHead").click();
|
||||
}
|
||||
//搜索按钮添加快捷键
|
||||
if(k == "13"&&(obj.id=="searchBillNo"))
|
||||
{
|
||||
$("#searchBtn").click();
|
||||
}
|
||||
});
|
||||
//分页信息处理
|
||||
function ininPager()
|
||||
{
|
||||
try
|
||||
{
|
||||
var opts = $("#tableData").datagrid('options');
|
||||
var pager = $("#tableData").datagrid('getPager');
|
||||
pager.pagination({
|
||||
onSelectPage:function(pageNum, pageSize)
|
||||
{
|
||||
opts.pageNumber = pageNum;
|
||||
opts.pageSize = pageSize;
|
||||
pager.pagination('refresh',
|
||||
{
|
||||
pageNumber:pageNum,
|
||||
pageSize:pageSize
|
||||
});
|
||||
showAccountHeadDetails(pageNum,pageSize);
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
$.messager.alert('异常处理提示',"分页信息异常 : " + e.name + ": " + e.message,'error');
|
||||
}
|
||||
}
|
||||
|
||||
//删除财务信息
|
||||
function deleteAccountHead(accountHeadID)
|
||||
{
|
||||
$.messager.confirm('删除确认','确定要删除此财务信息吗?',function(r)
|
||||
{
|
||||
if (r)
|
||||
{
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: "<%=path %>/accountHead/delete.action",
|
||||
dataType: "json",
|
||||
data: ({
|
||||
accountHeadID : accountHeadID,
|
||||
clientIp:'<%=clientIp %>'
|
||||
}),
|
||||
success: function (tipInfo)
|
||||
{
|
||||
var msg = tipInfo.showModel.msgTip;
|
||||
if(msg == '成功')
|
||||
{
|
||||
//加载完以后重新初始化
|
||||
$("#searchBtn").click();
|
||||
}
|
||||
else
|
||||
$.messager.alert('删除提示','删除财务信息失败,请稍后再试!','error');
|
||||
},
|
||||
//此处添加错误处理
|
||||
error:function()
|
||||
{
|
||||
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//批量删除财务信息
|
||||
function batDeleteAccountHead()
|
||||
{
|
||||
var row = $('#tableData').datagrid('getChecked');
|
||||
if(row.length == 0)
|
||||
{
|
||||
$.messager.alert('删除提示','没有记录被选中!','info');
|
||||
return;
|
||||
}
|
||||
if(row.length > 0)
|
||||
{
|
||||
$.messager.confirm('删除确认','确定要删除选中的' + row.length + '条财务信息吗?',function(r)
|
||||
{
|
||||
if (r)
|
||||
{
|
||||
var ids = "";
|
||||
for(var i = 0;i < row.length; i ++)
|
||||
{
|
||||
if(i == row.length-1)
|
||||
{
|
||||
ids += row[i].Id;
|
||||
break;
|
||||
}
|
||||
//alert(row[i].id);
|
||||
ids += row[i].Id + ",";
|
||||
}
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: "<%=path %>/accountHead/batchDelete.action",
|
||||
dataType: "json",
|
||||
async : false,
|
||||
data: ({
|
||||
accountHeadIDs : ids,
|
||||
clientIp:'<%=clientIp %>'
|
||||
}),
|
||||
success: function (tipInfo)
|
||||
{
|
||||
var msg = tipInfo.showModel.msgTip;
|
||||
if(msg == '成功')
|
||||
{
|
||||
//加载完以后重新初始化
|
||||
$("#searchBtn").click();
|
||||
$(":checkbox").attr("checked",false);
|
||||
}
|
||||
else
|
||||
$.messager.alert('删除提示','删除财务信息失败,请稍后再试!','error');
|
||||
},
|
||||
//此处添加错误处理
|
||||
error:function()
|
||||
{
|
||||
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//增加
|
||||
var url;
|
||||
var accountHeadID = 0;
|
||||
//保存编辑前的名称
|
||||
var orgAccountHead = "";
|
||||
|
||||
function addAccountHead()
|
||||
{
|
||||
$("#clientIp").val('<%=clientIp %>');
|
||||
$('#accountHeadFM').form('clear');
|
||||
$('#accountHeadDlg').dialog('open').dialog('setTitle','<img src="<%=path%>/js/easyui-1.3.5/themes/icons/edit_add.png"/> 增加财务信息');
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
$("#BillNo").val("").focus();
|
||||
|
||||
orgAccountHead = "";
|
||||
accountHeadID = 0;
|
||||
initTableData_account(); //明细列表
|
||||
reject(); //撤销下、刷新材料列表
|
||||
url = '<%=path %>/accountHead/create.action';
|
||||
}
|
||||
|
||||
//保存信息
|
||||
$("#saveAccountHead").unbind().bind({
|
||||
click:function()
|
||||
{
|
||||
if(!$('#accountHeadFM').form('validate'))
|
||||
return;
|
||||
else
|
||||
{
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: url,
|
||||
dataType: "json",
|
||||
async : false,
|
||||
data: ({
|
||||
Type: "付款",
|
||||
BillNo : $.trim($("#BillNo").val()),
|
||||
BillTime : $.trim($("#BillTime").val()),
|
||||
AccountId: $.trim($("#AccountId").val()),
|
||||
ChangeAmount: $.trim($("#ChangeAmount").val()),
|
||||
OrganId: $('#OrganId').combobox('getValue'),
|
||||
HandsPersonId: $.trim($("#HandsPersonId").val()),
|
||||
Remark: $.trim($("#Remark").val()),
|
||||
clientIp:'<%=clientIp %>'
|
||||
}),
|
||||
success: function (tipInfo)
|
||||
{
|
||||
if(tipInfo)
|
||||
{
|
||||
//保存明细记录
|
||||
if(accountHeadID ==0)
|
||||
{
|
||||
getMaxId(); //查找最大的Id
|
||||
accept(accountHeadMaxId); //新增
|
||||
}
|
||||
else
|
||||
{
|
||||
accept(accountHeadID); //修改
|
||||
}
|
||||
|
||||
|
||||
$('#accountHeadDlg').dialog('close');
|
||||
var opts = $("#tableData").datagrid('options');
|
||||
showAccountHeadDetails(opts.pageNumber,opts.pageSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
$.messager.show({
|
||||
title: '错误提示',
|
||||
msg: '保存信息失败,请稍后重试!'
|
||||
});
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error:function()
|
||||
{
|
||||
$.messager.alert('提示','保存信息异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//编辑信息
|
||||
function editAccountHead(accountHeadTotalInfo)
|
||||
{
|
||||
var accountHeadInfo = accountHeadTotalInfo.split("AaBb");
|
||||
$("#clientIp").val('<%=clientIp %>');
|
||||
$("#BillNo").val(accountHeadInfo[1]);
|
||||
$("#BillTime").val(accountHeadInfo[2]);
|
||||
$("#Remark").val(accountHeadInfo[3]);
|
||||
$("#AccountId").val(accountHeadInfo[4]);
|
||||
$('#OrganId').combobox('setValue', accountHeadInfo[6]);
|
||||
$("#HandsPersonId").val(accountHeadInfo[8]);
|
||||
$("#ChangeAmount").val(accountHeadInfo[10]);
|
||||
$('#accountHeadDlg').dialog('open').dialog('setTitle','<img src="<%=path%>/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑财务信息');
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
accountHeadID = accountHeadInfo[0];
|
||||
|
||||
initTableData_account(); //明细列表
|
||||
reject(); //撤销下、刷新材料列表
|
||||
url = '<%=path %>/accountHead/update.action?accountHeadID=' + accountHeadInfo[0];
|
||||
}
|
||||
|
||||
//查看信息
|
||||
function showAccountHead(accountHeadTotalInfo)
|
||||
{
|
||||
var accountHeadInfo = accountHeadTotalInfo.split("AaBb");
|
||||
$("#BillNoShow").text(accountHeadInfo[1]);
|
||||
$("#BillTimeShow").text(accountHeadInfo[2]);
|
||||
$("#RemarkShow").text(accountHeadInfo[3]);
|
||||
$("#AccountIdShow").text(accountHeadInfo[5]);
|
||||
$('#OrganIdShow').text(accountHeadInfo[7]);
|
||||
$("#HandsPersonIdShow").text(accountHeadInfo[9]);
|
||||
$("#ChangeAmountShow").text(accountHeadInfo[10]);
|
||||
$('#accountHeadDlgShow').dialog('open').dialog('setTitle','<img src="<%=path%>/js/easyui-1.3.5/themes/icons/list.png"/> 查看财务信息');
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
|
||||
accountHeadID = accountHeadInfo[0];
|
||||
initTableData_account_show(); //明细列表-查看状态
|
||||
}
|
||||
|
||||
//搜索处理
|
||||
$("#searchBtn").unbind().bind({
|
||||
click:function()
|
||||
{
|
||||
showAccountHeadDetails(1,initPageSize);
|
||||
var opts = $("#tableData").datagrid('options');
|
||||
var pager = $("#tableData").datagrid('getPager');
|
||||
opts.pageNumber = 1;
|
||||
opts.pageSize = initPageSize;
|
||||
pager.pagination('refresh',
|
||||
{
|
||||
pageNumber:1,
|
||||
pageSize:initPageSize
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
function showAccountHeadDetails(pageNo,pageSize)
|
||||
{
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: "<%=path %>/accountHead/findBy.action",
|
||||
dataType: "json",
|
||||
data: ({
|
||||
Type:"付款",
|
||||
BillNo:$.trim($("#searchBillNo").val()),
|
||||
BeginTime:$("#searchBeginTime").val(),
|
||||
EndTime:$("#searchEndTime").val(),
|
||||
pageNo:pageNo,
|
||||
pageSize:pageSize
|
||||
}),
|
||||
success: function (data)
|
||||
{
|
||||
$("#tableData").datagrid('loadData',data);
|
||||
},
|
||||
//此处添加错误处理
|
||||
error:function()
|
||||
{
|
||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
//重置按钮
|
||||
$("#searchResetBtn").unbind().bind({
|
||||
click:function(){
|
||||
$("#searchBillNo").val("");
|
||||
$("#searchBeginTime").val("");
|
||||
$("#searchEndTime").val("");
|
||||
//加载完以后重新初始化
|
||||
$("#searchBtn").click();
|
||||
}
|
||||
});
|
||||
|
||||
//结束编辑
|
||||
var editIndex = undefined;
|
||||
function endEditing() {
|
||||
if (editIndex == undefined) { return true }
|
||||
if ($('#accountData').datagrid('validateRow', editIndex)) {
|
||||
var ed = $('#accountData').datagrid('getEditor', {index:editIndex,field:'AccountId'});
|
||||
var AccountName = $(ed.target).combobox('getText');
|
||||
$('#accountData').datagrid('getRows')[editIndex]['AccountName'] = AccountName;
|
||||
$('#accountData').datagrid('endEdit', editIndex);
|
||||
editIndex = undefined;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//单击
|
||||
function onClickRow(index) {
|
||||
if (editIndex != index) {
|
||||
if (endEditing()) {
|
||||
$('#accountData').datagrid('selectRow', index)
|
||||
.datagrid('beginEdit', index);
|
||||
editIndex = index;
|
||||
} else {
|
||||
$('#accountData').datagrid('selectRow', editIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
//新增
|
||||
function append()
|
||||
{
|
||||
if (endEditing()) {
|
||||
$('#accountData').datagrid('appendRow', {});
|
||||
editIndex = $('#accountData').datagrid('getRows').length - 1;
|
||||
$('#accountData').datagrid('selectRow', editIndex).datagrid('beginEdit', editIndex);
|
||||
}
|
||||
}
|
||||
//删除
|
||||
function removeit() {
|
||||
if (editIndex == undefined) { return }
|
||||
$('#accountData').datagrid('cancelEdit', editIndex)
|
||||
.datagrid('deleteRow', editIndex);
|
||||
editIndex = undefined;
|
||||
}
|
||||
//撤销
|
||||
function reject() {
|
||||
$('#accountData').datagrid('rejectChanges');
|
||||
editIndex = undefined;
|
||||
}
|
||||
//判断
|
||||
function CheckData() {
|
||||
var row = $('#accountData').datagrid('getRows');
|
||||
var totalRowNum = "";
|
||||
for (var i = 0; i < row.length; i++) {
|
||||
if (row[i].AccountId == "") {
|
||||
totalRowNum += (i + 1) + "、";
|
||||
}
|
||||
}
|
||||
if (totalRowNum != "") {
|
||||
var totalRowNum = totalRowNum.substring(0, totalRowNum.length - 1);
|
||||
$.messager.alert('提示',"第" + totalRowNum + "行数据填写不完整!",'info');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
//保存
|
||||
function accept(accepId) {
|
||||
append();
|
||||
removeit();
|
||||
if ($("#accountData").datagrid('getChanges').length) {
|
||||
if (!CheckData())
|
||||
return false;
|
||||
var inserted = $("#accountData").datagrid('getChanges', "inserted");
|
||||
var deleted = $("#accountData").datagrid('getChanges', "deleted");
|
||||
var updated = $("#accountData").datagrid('getChanges', "updated");
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "<%=path%>/accountItem/saveDetials.action",
|
||||
data: {
|
||||
Inserted: JSON.stringify(inserted),
|
||||
Deleted: JSON.stringify(deleted),
|
||||
Updated: JSON.stringify(updated),
|
||||
HeaderId:accepId,
|
||||
clientIp:'<%=clientIp %>'
|
||||
},
|
||||
success: function (tipInfo)
|
||||
{
|
||||
if (tipInfo) {
|
||||
$.messager.alert('提示','保存成功!','info');
|
||||
}
|
||||
else
|
||||
$.messager.alert('提示','保存失败!','error');
|
||||
|
||||
},
|
||||
error: function (XmlHttpRequest, textStatus, errorThrown)
|
||||
{
|
||||
$.messager.alert('提示',XmlHttpRequest.responseText,'error');
|
||||
}
|
||||
});
|
||||
}
|
||||
if (endEditing()) {
|
||||
$('#accountData').datagrid('acceptChanges');
|
||||
}
|
||||
}
|
||||
//获取MaxId
|
||||
function getMaxId()
|
||||
{
|
||||
var accountHeadMax=null;
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: "<%=path%>/accountHead/getMaxId.action",
|
||||
//设置为同步
|
||||
async:false,
|
||||
dataType: "json",
|
||||
success: function (systemInfo)
|
||||
{
|
||||
if(systemInfo)
|
||||
{
|
||||
accountHeadMax = systemInfo.showModel.map.accountHeadMax;
|
||||
var msgTip = systemInfo.showModel.msgTip;
|
||||
if(msgTip == "exceptoin")
|
||||
{
|
||||
$.messager.alert('提示','查找最大的Id异常,请与管理员联系!','error');
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
accountHeadMax=null;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if(accountHeadMax !=null)
|
||||
{
|
||||
if(accountHeadMax.length>0)
|
||||
{
|
||||
accountHeadMaxId=accountHeadMax[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -254,7 +254,7 @@ public class AccountHeadAction extends BaseAction<AccountHeadModel>
|
||||
item.put("AccountName", accountHead.getAccountId()==null?"":accountHead.getAccountId().getName());
|
||||
item.put("BillNo", accountHead.getBillNo());
|
||||
item.put("BillTime", Tools.getCurrentMonth(accountHead.getBillTime()));
|
||||
item.put("ChangeAmount", accountHead.getChangeAmount());
|
||||
item.put("ChangeAmount", accountHead.getChangeAmount()==null?"":Math.abs(accountHead.getChangeAmount()));
|
||||
item.put("Remark", accountHead.getRemark());
|
||||
item.put("op", 1);
|
||||
dataArray.add(item);
|
||||
|
||||
Reference in New Issue
Block a user