注意,在用门诊和住院打印方法时,打印方法调用不同,在js中查找

住院:INPHA_PRINTCOM.Presc(prescNo, "正方", "");

门诊:OUTPHA_PRINTCOM.Presc(prescNo, "正方", "");

一,住院打印

1,在csp中添加打印按钮标签

<button class="btn btn-default btn_button btn_common dhcpha-col-border-left" id="btn-print"><img 
src="#(Application)#scripts/pharmacy/images/reprint-default.png" class="dhcpha-btn-image"><br><strong>打印处方</strong></button>

2,根据csp页面定义的div获取元素id,并定义记录当前tab

3,在js中初始化中插件中,初始化切换页签的显示和隐藏

4,根据csp列表添加的显示列div的id元素,添加打印方法。

//住院草药处方打印
// wangsheng
function PrintHandler() {
	if (NowTAB == "#div-presc-condition") {
		if (DhcphaGridIsEmpty("#grid-presclist") == true) {
		return;
			}
        var prescrowdata = $("#grid-presclist").jqGrid('getRowData');
        var selectid = $("#grid-presclist").jqGrid('getGridParam', 'selrow');
        var selrowdata = $("#grid-presclist").jqGrid('getRowData', selectid);
    } else {
	    if (DhcphaGridIsEmpty("#grid-admpresclist") == true) {
		return;
			}
        var prescrowdata = $("#grid-admpresclist").jqGrid('getRowData');
        var selectid = $("#grid-admpresclist").jqGrid('getGridParam', 'selrow');
        var selrowdata = $("#grid-admpresclist").jqGrid('getRowData', selectid);
    }
	if (selectid == null) {
		dhcphaMsgBox.alert("没有选中数据,无法打印!");
		return;
	}
	var prescNo = selrowdata.TPrescNo;
	var phdrow = selrowdata.Tphd;
	INPHA_PRINTCOM.Presc(prescNo, "正方", "");
}

二,门诊8.4打印方法

//打印
function PrintHandler() {
	if (DhcphaGridIsEmpty("#grid-disp") == true) {
		return;
	}
	var selectid = $("#grid-disp").jqGrid('getGridParam', 'selrow');
	var selrowdata = $("#grid-disp").jqGrid('getRowData', selectid);
	if (selectid == null) {
		dhcphaMsgBox.alert("没有选中数据,无法打印!");
		return;
	}
	var prescNo = selrowdata.TPrescNo;
	var phdrow = selrowdata.Tphd;
	
	OUTPHA_PRINTCOM.Presc(prescNo, "正方", "");
}