html自定义打印循环,JSP页面实现循环打印

首先在页面上要有一个“打印按钮”,来触发这个打印操作:

调用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

结算打印

body {

margin: 0px;

}

.printStyle td {

BACKGROUND-COLOR: #FFFFFF;

COLOR: black;

FONT-FAMILY: 'Times New Roman';

FONT-SIZE: 12pt;

}

.Noprint {

DISPLAY: none;

}

border="0">

List printList2 = (List) request.getAttribute("printList2");

for (Iterator iterator = printList2.iterator(); iterator.hasNext();) {

HashMap printMap2 = (HashMap) iterator.next();

%>

日期:

户名 :账号:业务类型:

.get("Printtype") : ""%>

LC编号:外汇金额:    合同号:

.get("Contrno") : ""%>

if (printMap2.get("Feetype") != null

|| printMap2.get("Feetype") != "") {

if (printMap2.get("Feetype") == "F001") {

%>

手续费:    

}

if (printMap2.get("Feetype") == "F002") {

%>

电报费:    

}

} else {

%>

汇率:

}

%>

备注:
合计:

}

%>

记账:复核:

window.onload = function() {

window.print();

window.close();

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值