1、jq版直接打印代码

function BtnPrintHandler() {
    if ($('#grid-returntotal').datagrid('getData').rows.length == 0) {
        dhcphaMsgBox.alert("页面没有数据");
        return;
    }
    if ($('#grid-returntotal').datagrid('getSelected') == null) {
        dhcphaMsgBox.alert("请选择需要打印的数据!");
        return;
    }
    var selecteddata = $('#grid-returntotal').datagrid('getSelected');
    if (selecteddata == null) {
        return;
    }
    //var pharet = selecteddata["tPhaRet"];
   // PrintReturnCom(pharet, "补");    #grid-returndetail
//    
    var startdatetime = $("#date-start").val();
    var enddatetime = $("#date-end").val();
	var daterange = startdatetime + " 至 " + enddatetime;
	var phLocDesc = $("#sel-phaloc").select2("data")[0].text;
	var wardData = $("#sel-wardloc").select2("data");
	var pharet = selecteddata["tPhaRet"];
	var pharetno = selecteddata["tPhaRetNo"];
	var ReturnOper  = selecteddata["tReturnOper"];
	var wardDesc=""
	wardDesc = selecteddata["tWard"];
    if (wardData = ""){
		wardDesc = selecteddata["tWard"];
	}
	var Para = {
		title: DHCPHA_CONSTANT.SESSION.GHOSP_DESC + "退药申请单",
		countDate: daterange,
		sysDT: getPrintDateTime(),
		phLocDesc: phLocDesc,
    	ordLocDesc: wardDesc,
    	retNo: pharetno,
    	ReturnOper: ReturnOper
	}
	//打印公共 Huxt 2019-12-25
		PRINTCOM.XML({
		printBy: 'lodop',
		XMLTemplate: 'PHAIPReturn',
		data: {
			Para: Para,
			Grid: {type:'easyui', grid:'grid-returndetail'}
		},
		preview:false,
		listBorder: {style:2, startX:1, endX:195},
		page: { rows: 30, x: 245, y: 2, fontname: '黑体', fontbold: 'true', fontsize: '12', format: '页码:{1}/{2}' }
	});
}

2、调用润乾预览打印

2.1、js中初始化方法

 var PrintBT = new Ext.Toolbar.Button({
                text : '打印',
                tooltip : '点击打印',
                iconCls : 'page_print',
                height:30,
                width:70,
                handler : function() {
	                var record = MasterInfoGrid.getSelectionModel().getSelected();
	    			var aspno = record.get("AspNo");
                    PrintAdjPrice(aspno);
                }
            });   

2.2、润乾打印方法

 * creator:yunhaibao
 * createdate:2015-12-01
 * description:鎵撳嵃鍗曚釜璋冧环鍗曪紙娑︿咕锛�
 * params: ingr:璋冧环鍗曞彿
 * return:
 * */
function PrintAdjPrice(adjpriceno){
	if(adjpriceno==null || adjpriceno==''){
		Msg.info("warning","璇烽€夋嫨璋冧环鍗曞悗鎵撳嵃!");
		return;
	}
	var RQDTFormat=App_StkRQDateFormat; //+" "+App_StkRQTimeFormat;
	var printtype=1;
	/*if (printtype==1) {
		//鐩存帴鎵撳嵃
		fileName="{DHCST_InAdjSalePrice_Common.raq(AspNo="+adjpriceno+";HospDesc="+App_LogonHospDesc+")}";
		DHCCPM_RQDirectPrint(fileName);
	}
	else {
		//棰勮鎵撳嵃	
		fileName="DHCST_InAdjSalePrice_Common.raq&AspNo="+adjpriceno+"&HospDesc="+App_LogonHospDesc;
		DHCCPM_RQPrint(fileName);
	}*/
	if (printtype==1) {
		//鐩存帴鎵撳嵃
		fileName="{DHCST_InAdjSalePrice_Common.raq(AspNo="+adjpriceno+";HospDescIO="+session['LOGON.HOSPID']+";RQDTFormat="+RQDTFormat+")}";
		DHCCPM_RQDirectPrint(fileName);
	}
	else {
		//棰勮鎵撳嵃	
		fileName="DHCST_InAdjSalePrice_Common.raq&AspNo="+adjpriceno+"&HospDescIO="+session['LOGON.HOSPID']+"&RQDTFormat="+RQDTFormat;
		DHCCPM_RQPrint(fileName);
	}
}

2.3、需要在csp中引用打印公共方法

<script type="text/javascript" src="../scripts/DHCCPMRQCommon.js"></script>