LODOP打印控制每页打印一定行数

function doPrint(){
	intype=combo_intype.getActualValue();
	dept=combo_dept.getActualValue();
	checkdate=$("#checkdate").val();
	checkdate2=$("#checkdate2").val();
	//empname=comb_empname.getActualValue();
	 empname=$("#empname").val();
	 if(empname.match(/\d*/)){
	 	
	 }else if(empname.match([\u4e00-\u9fa5]/g)){
     	empname=encodeURI(empname);
     }
	var str="checkdate="+checkdate+"&medtype="+encodeURI(encodeURI(intype))+"&empname="+empname+"&dept="+dept+
	"&checkdate2="+checkdate2+"&time="+(new Date()).valueOf();
	var zongshu;
	$.ajax({
		async: false,
		cache: false,
		ifModified: true,
		type: "post",
		url: "staform/tongjichuyuanbingrenCount.htm",
		data:str,
		dataType: "json",
		error:function(){
            alert("服务器内部错误!");
        },
		success: function(data){
				var count = data.value;
				zongshu=count;
  		}
	});
	$.ajax({
		async:false,
		cache:false,
		type: "post",
		url:'staform/cybrPrint.htm',
		data:str,
		error:function(){
			alert('fail');
		},
		success:function(data){
			var textHtm='<table width="700" border="0" cellspacing="0" cellpadding="0" class="biangeng_5">'
                     +'<tr>'
                     +'<td colspan="2" style="font-size:20px; font-weight:bold; text-align:center; height:49px;">按日期统计出院病人</td>'
                     +'</tr>'
                     +'<tr>'
                     +'   <td colspan="2" class="biangeng_8" height="38";>'
	                 +'       <table width="700" border="0" cellspacing="0" cellpadding="0">'
	                 +'           <tr>'
	                 +'             <td width="100" style="font-size:15.6px;">合计人数:</td>'
	                 +'             <td width="100" style="font-size:15.6px;">'+zongshu+'</td>'
	                 +'           <td width="100"></td>'
	                 +'            <td width="85" style="font-size:15.6px;">统计日期:</td>'
	                 +'           <td width="165" style="font-size:15.6px;"> '+checkdate+' 至 '+checkdate2+' </td>'
	                 +'           </tr>'
	                 +'      </table>'
                     +' </td>'
                     +'  </tr>'
                     +' </table>';
			var textHtml='<table width="100%" border="1" width="100%" cellspacing="0" cellpadding="0" bgcolor="#000000" class="mar3" style="font-size:14px;">'
	                 +'         <tr bgcolor="#FFFFFF" align="center">'
	                 +'          <td width="8%" style="font-size:15.6px;height:30px;">病案号</td>'
	                 +'          <td width="10%" style="font-size:15.6px;height:30px;">病人姓名</td>'
	                 +'          <td width="6%" style="font-size:15.6px;height:30px;">床位号</td>'
	                 +'         <td width="12%" style="font-size:15.6px;height:30px;">科室名称</td>'
	                 +'         <td width="12%" style="font-size:15.6px;height:30px;">出院日期</td>'
	                 +'         <td width="12%" style="font-size:15.6px;height:30px;">结算日期</td>'
	                 +'         <td width="10%" style="font-size:15.6px;height:30px;">主治医生</td>'
	                 +'         <td width="30%" style="font-size:15.6px;height:30px;">出院诊断</td>'
	                 +'       </tr>'

			LODOP.NEWPAGE();
			LODOP.PRINT_INITA(0,0,"210mm","297mm",""); //打印前初始化,若放在循环里初始化,则只会打印出最后一次LODOP.ADD_PRINT_HTM,只能初始化一次
			LODOP.SET_PRINT_PAGESIZE(1,2100,0,"A4");
			LODOP.ADD_PRINT_HTM(0,10,663,"60mm","<style>  tr{height:50px;} td {font-size:13px;height:20px;} input{border:none; border:1px solid #000;}</style>"+textHtm);
			LODOP.ADD_PRINT_HTM(84,10,736,"270mm","<style>  tr{height:50px;} td {font-size:13px;height:20px;} input{border:none; border:1px solid #000;}</style>"+textHtml);			
			var js=eval("("+data+")");
			var flag=1;
			for(var i=0;i<js.length;i++){
			    var bedno=js[i].bedno==null?'':js[i].bedno;
				textHtml+='<tr bgcolor="#FFFFFF" align="center">'
				+'<td width="8%" style="font-size:15.6px;height:30px;">'+js[i].inpno+'</td>'
				+'<td width="10%" style="font-size:15.6px;height:30px;">'+js[i].patname+'</td>'
				+'<td width="6%" align="center" style="font-size:15.6px;text-align:left;height:30px;">'+(js[i].bedno==null?'':js[i].bedno)+'</td>'
				+'<td width="12%" align="center" style="font-size:15.6px;height:30px;">'+js[i].wardname+'</td>'
				+'<td width="12%" align="center" style="font-size:15.6px;height:30px;">'+(js[i].preout_date==null?'':js[i].preout_date)+'</td>'
				+'<td width="12%" style="font-size:15.6px;height:30px;">'+(js[i].out_date==null?'':js[i].out_date)+'</td>'
				+'<td width="10%" style="font-size:15.6px;height:30px;">'+js[i].doctorname+'</td>'
				+'<td width="30%" style="font-size:15.6px;text-align:left;height:30px;">'+(js[i].diagname.substring(0,14))+'</td></tr>'
				flag=flag+1;//alert(flag);
				if(flag>=31){
					flag=1;
					textHtml+="</table>";
					LODOP.ADD_PRINT_HTM(84,10,736,"270mm","<style>  tr{height:50px;} td {font-size:13px;height:20px;} input{border:none; border:1px solid #000;}</style>"+textHtml);
				    LODOP.NEWPAGE();
				    textHtml='<table width="100%" border="1" width="100%" cellspacing="0" cellpadding="0" bgcolor="#000000" class="mar3" style="font-size:14px;">'
	                 +'         <tr bgcolor="#FFFFFF" align="center">'
	                 +'          <td width="8%" style="font-size:15.6px;height:30px;">病案号</td>'
	                 +'          <td width="10%" style="font-size:15.6px;height:30px;">病人姓名</td>'
	                 +'          <td width="6%" style="font-size:15.6px;height:30px;">床位号</td>'
	                 +'         <td width="12%" style="font-size:15.6px;height:30px;">科室名称</td>'
	                 +'         <td width="12%" style="font-size:15.6px;height:30px;">出院日期</td>'
	                 +'         <td width="12%" style="font-size:15.6px;height:30px;">结算日期</td>'
	                 +'         <td width="10%" style="font-size:15.6px;height:30px;">主治医生</td>'
	                 +'         <td width="30%" style="font-size:15.6px;height:30px;">出院诊断</td>'
	                 +'       </tr>'
				}
			}	
			if(flag<31)	{
			textHtml+="</table>";
			//LODOP.NEWPAGE();
			LODOP.ADD_PRINT_HTM(84,10,736,"270mm","<style>  tr{height:50px;} td {font-size:13px;height:20px;} input{border:none; border:1px solid #000;}</style>"+textHtml);
			}
			LODOP.PREVIEW();
  			//LODOP.PRINT_DESIGN(); 			
  			//LODOP.PRINT();
		}
	});	
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值