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.
DS7/DSWeb/js/InvoiceMakeOutList.js

124 lines
5.1 KiB
JavaScript

3 years ago
var commonGridObj_invoice;
function $(id) {
return document.getElementById(id);
}
function checkAll() {
if (commonGridObj_invoice != null) {
for (var i = 0; i < commonGridObj_invoice.getGridObj().getRowsNum(); i++) {
var rowId = commonGridObj_invoice.getGridObj().getRowId(i);
var rowIndex = commonGridObj_invoice.getGridObj().getRowIndex(rowId);
if ($("ck_all").checked) {
commonGridObj_invoice.getGridObj().cellByIndex(rowIndex, 0).setValue(1);
} else {
commonGridObj_invoice.getGridObj().cellByIndex(rowIndex, 0).setValue(0);
}
}
}
}
function createGrid(){
//header
var headerArgs_invoice = new Array("<input type=\"checkbox\" id=\"ck_all\" onclick=\"checkAll()\" />","申请编号","申请状态","发票号码","客户名称","发票抬头","申请金额","币别","申请人","申请时间","开出人","开出时间");
//width
var widthArgs_invoice = new Array("40","150","120","120","150","200","100","70","100","150","100","150");
//column align
var colAlignArgs_invoice = new Array("center","center","center","center","center","center","center","center","center","center","center","center");
//column sort
var colSortArgs_invoice = new Array("na","str","str","str","str","str","str","str","str","str","str","str");
//column type
var colTypeArgs_invoice = new Array("ch","ro","ro","ro","ro","ro","ro","ro","ro","ro","ro","ro");
commonGridObj_invoice = new TGridCommon("mygrid_container_invoice","form1",headerArgs_invoice,widthArgs_invoice,colAlignArgs_invoice,colSortArgs_invoice,colTypeArgs_invoice);
commonGridObj_invoice.setResponseUrl("InvoiceApplicationGridSource.aspx");
commonGridObj_invoice.setRequest("InvoiceApplicationGridSource.aspx?handle=makeoutapp");
commonGridObj_invoice.setSourceType("json");
commonGridObj_invoice.setSkin("xp");
commonGridObj_invoice.setImageUrl("../images/");
commonGridObj_invoice.initGrid();
commonGridObj_invoice.bind();
// commonGridObj_invoice.getGridObj().attachEvent("onEditCell",function(stage,rId,cInd,nValue,oValue){
// if(stage == 0){
// return false;
// }
// });
// commonGridObj_invoice.getGridObj().attachEvent("onRowDblClicked", function(rId,cInd){
// var rId = commonGridObj_invoice.getGridObj().getSelectedRowId();
// var openSet = "height=270, width=500, toolbar=no, menubar=no,scrollbars=no, resizable=1,location=no, status=no,Top= " +(screen.height-710)/2 + ",Left= "+(screen.width-800)/2
// var openType = "_blank";
//
// var openUrl = "Edit.aspx?flowid="+rId+"&handle=edit";
// window.open (openUrl,openType,openSet);
// });
}
//开出发票
function makeOutInvoice(){
var iCount = 0;
var selRowID = "";
if(commonGridObj_invoice != null){
for(var i = 0;i<commonGridObj_invoice.getGridObj().getRowsNum();i++){
var rowId = commonGridObj_invoice.getGridObj().getRowId(i);
var chBox = commonGridObj_invoice.getGridObj().cellByIndex(i,0).getValue();
if(chBox == 1){
selRowID = rowId;
iCount++;
}
}
}
if(iCount > 1){
alert("每次只能处理一条开票申请,请重新选择");
selRowID = "";
return;
}else if(iCount > 0){
var openSet = "height=490, width=820, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top= " +(screen.height-490)/2 + ",Left= "+(screen.width-820)/2
var openType = "_blank";
var openUrl = "InvoiceMakeOutModify.aspx?handle=makeout&id="+selRowID;
window.open (openUrl,openType,openSet);
}else{
alert("您没有选择要开票的申请");
}
}
//驳回发票申请
function rejectApplication(){
var iCount = 0;
if(commonGridObj_invoice != null){
for(var i = 0;i<commonGridObj_invoice.getGridObj().getRowsNum();i++){
var rowId = commonGridObj_invoice.getGridObj().getRowId(i);
var chBox = commonGridObj_invoice.getGridObj().cellByIndex(i,0).getValue();
//如果选中,则将保存的开发票申请提交,提交前先判断当前发票申请是否已经提交申请
if(chBox == 1){
iCount++;
//异步执行操作
var url = "InvoiceApplicationGridSource.aspx?invoiceappid="+rowId+"&handle=voidinvoiceapp&uid="+commonGridObj_invoice.newGuid();
var loader = dhtmlxAjax.getSync(url);
var postStatus = loader.xmlDoc.responseText;
var status = parseInt(postStatus);
switch(status){
case 1:
createGrid();
alert("开票申请驳回成功");
break;
case -3:
alert("开票申请不存在");
break;
}
}
}
if(iCount == 0){
alert("您没有选择要驳回的开票申请");
}
}
}