You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

131 lines
5.4 KiB
JavaScript

10 months ago
var commonGridObj_invoicebooks;
function $(id){
return document.getElementById(id);
}
function createGrid(){
//header
var headerArgs_invoicebook = new Array("<input type=\"checkbox\" id=\"ck_all\" onclick=\"checkall()\" />","发票系统名称","发票中文名称","发票代码号","发票起始号","发票结束号","发票总数","是否锁定","是否删除","创建人","创建时间");
//width
var widthArgs_invoicebook = new Array("40","150","150","150","150","150","120","70","70","120","120");
//column align
var colAlignArgs_invoicebook = new Array("center","center","center","center","center","center","center","center","center","center","center");
//column sort
var colSortArgs_invoicebook = new Array("na","str","str","str","str","str","str","str","str","str","str");
//column type
var colTypeArgs_invoicebook = new Array("ch","ro","ro","ro","ro","ro","ro","ch","ch","ro","ro");
commonGridObj_invoicebooks = new TGridCommon("mygrid_container_invoicebook","form1",headerArgs_invoicebook,widthArgs_invoicebook,colAlignArgs_invoicebook,colSortArgs_invoicebook,colTypeArgs_invoicebook);
commonGridObj_invoicebooks.setResponseUrl("InvoiceBookGridSource.aspx");
commonGridObj_invoicebooks.setRequest("InvoiceBookGridSource.aspx?handle=booklist&show_page=15&cur_page=1&uid="+commonGridObj_invoicebooks.newGuid());
commonGridObj_invoicebooks.setSourceType("json");
commonGridObj_invoicebooks.setSkin("xp");
commonGridObj_invoicebooks.setImageUrl("../images/");
commonGridObj_invoicebooks.initGrid();
commonGridObj_invoicebooks.bind();
commonGridObj_invoicebooks.initPageByHandle("booklist");
commonGridObj_invoicebooks.getGridObj().attachEvent("onRowSelect", function(id,ind){
var openSet = "height=490, width=800, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top= " +(screen.height-490)/2 + ",Left= "+(screen.width-800)/2
var openType = "_blank";
var openUrl = "InvoiceBookEdit.aspx?handle=edit&id="+id;
window.open (openUrl,openType,openSet);
});
commonGridObj_invoicebooks.clickEvent = function(){
commonGridObj_invoicebooks.getGridObj().attachEvent("onRowSelect", function(id,ind){
var openSet = "height=490, width=800, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top= " +(screen.height-490)/2 + ",Left= "+(screen.width-800)/2
var openType = "_blank";
var openUrl = "InvoiceBookEdit.aspx?handle=edit&id="+id;
window.open (openUrl,openType,openSet);
});
}
commonGridObj_invoicebooks.getGridObj().attachEvent("onEditCell",function(stage,rId,cInd,nValue,oValue){
if(stage == 0){
if(cInd != 0){
return false;
}else{
return true;
}
}
});
commonGridObj_invoicebooks.onEditEvent = function(){
commonGridObj_invoicebooks.getGridObj().attachEvent("onEditCell",function(stage,rId,cInd,nValue,oValue){
if(stage == 0){
if(cInd != 0){
return false;
}else{
return true;
}
}
});
}
}
function addInvoiceBook(){
var openSet = "height=490, width=800, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top= " +(screen.height-490)/2 + ",Left= "+(screen.width-800)/2
var openType = "_blank";
var openUrl = "InvoiceBookEdit.aspx?handle=add";
window.open (openUrl,openType,openSet);
}
function deleteUnpostApplication(){
var iCount = 0;
var iSucce = 0;
var iFail = 0;
if(commonGridObj_invoicebooks != null){
for(var i=0;i<commonGridObj_invoicebooks.getGridObj().getRowsNum();i++){
var rId = commonGridObj_invoicebooks.getGridObj().getRowId(i);
var rowIndex = commonGridObj_invoicebooks.getGridObj().getRowIndex(rId);
var checkState = commonGridObj_invoicebooks.getGridObj().cellByIndex(rowIndex,0).getValue();
if(checkState == 1){
iCount++;
var bookID = commonGridObj_invoicebooks.getGridObj().getRowId(i);
var url = "InvoiceBookGridSource.aspx?handle=deletebook&bookid="+bookID+"&uid="+commonGridObj_invoicebooks.newGuid();
var loader = dhtmlxAjax.getSync(url);
var deleteVal = loader.xmlDoc.responseText;
if(deleteVal == 1){
iSucce++;
}else{
iFail++;
}
}
}
}
if(iCount > 0){
alert("删除发票册 共 "+iCount+" 条 成功 "+iSucce+" 条 失败 "+iFail+"");
createGrid();
}else{
alert("没有选择要删除的票册");
}
}
function refreshList(){
createGrid();
}
//全选框
function checkall(){
var checkStatus = $("ck_all").checked;
if(checkStatus == 1){
var iCount = commonGridObj_invoicebooks.getGridObj().getRowsNum();
for(var i=0;i < iCount;i++){
commonGridObj_invoicebooks.getGridObj().cellByIndex(i,0).setValue(1);
}
}else{
var iCount = commonGridObj_invoicebooks.getGridObj().getRowsNum();
for(var i=0;i < iCount;i++){
commonGridObj_invoicebooks.getGridObj().cellByIndex(i,0).setValue(0);
}
}
}