JSP 페이지 순환 인쇄
4139 단어 JavaScript 개발ExtJs 프레임워크
choosePrint() 메서드 호출:
//
var timer, win, recCount, rownum;
function choosePrint() {
rownum = 0;
var records = grid.getSelectionModel().getSelections();//
recCount = records.length;
var JSONString = "";
record = records[rownum];
showPrint(record);
timer = setInterval(printSave, "500");
}
function printSave() {
if (win.closed) {
if (rownum >= recCount) {
clearInterval(timer);
} else {
var records = grid.getSelectionModel().getSelections();
record = records[rownum];
showPrint(record)
}
}
}
function showPrint(record) {
var Customername = record.get('Customername');
var Curtype1 = record.get('Curtype1');
var Amount1 = record.get('Amount1');
var Curtype2 = record.get('Curtype2');
var Amount2 = record.get('Amount2');
var Businessnum = record.get('Businessnum');
var Acnt1 = record.get('Acnt1');
var Acnt2 = record.get('Acnt2');
var Biztype = record.get('Biztype');
var Pztype = record.get('Pztype');
var Exrate = record.get('Exrate');
var Bizid = record.get('Bizid');
var Pzid = record.get('Pzid');
var Id = record.get('Id');
var Feetype = record.get('Feetype');
var Curtype = record.get('Curtype');
var Amount = record.get('Amount');
JSONString = Customername + "," + Acnt1 + "," + Acnt2 + ","
+ Biztype + "," + Pztype + "," + Businessnum + ","
+ Curtype1 + "," + Amount1 + "," + Curtype2 + "," + Amount2
+ "," + Exrate + "," + Bizid + "," + Pzid + "," + Id + ","
+ Feetype + "," + Curtype + "," + Amount + ";";
win = showJSWindow(
'print.ered?reqCode=vorcharPrint&flag=Print&JSONString='
+ JSONString, 600, 400);
rownum++;
}
/** */
function showJSWindow(url, width, height) {
var pWidth = width ? width : document.body.clientWidth * 0.7;
var pHeight = height ? height : 470;
var str = 'width=' + pWidth
+ ',height=' + pHeight
+ ',toolbar=no,menubar=no,scrollbars=no,resizable=yes,location=no,status=no';
return window.open(url, '', str);
}
여기서 이 코드의 의미는 다음과 같습니다.
win = showJSWindow(
'print.ered?reqCode=vorcharPrint&flag=Print&JSONString='
+ JSONString, 600, 400);
jsp 페이지 vocharPrint를 엽니다.jsp
window.onload = function() {
window.print();
window.close();
}