很多时候我们需要直接在前台页面进行打印内容
JS页面代码如下
var temp="";
var LODOP;
function CreateOneFormPage(){
LODOP=getLodop();
var strBodyStyle="";
var strFormHtml=strBodyStyle+"
"+document.getElementById("form1").innerHTML+"";
LODOP.ADD_PRINT_HTM(15,15,700,700,strFormHtml);
myrefresh();
};
function myrefresh(){
window.location.reload();
}
function prn1_preview() {
var current=new Date();
$("#qin_time").text("时间");
$("#qothers_name").text("物资名称");
$("#qothers_type").text("物资类别");
$("#qothers_count").text("数量");
$("#qothers_unit").text("单位");
$("#qothers_standard").text("规格型号");
$("#qothers_price").text("单价");
$("#qtotal_price").text("总价");
$("#qnototal_price").text("不含税价");
$("#qtax_rate").text("税额");
$("#qmanufacturer_name").text("供应商");
$("#qstorage_name").text("存放位置");
$("#qpather").text("送货人");
$("#qinput_person").text("录入人员");
var items = $("#other_rows").datagrid('getRows');
for(var i=0;i
temp+="";
temp+=""+items[i].in_time+" | ";
temp+=""+items[i].others_name+" | ";
temp+=""+items[i].others_type+" | ";
temp+=""+items[i].others_count+" | ";
temp+=""+items[i].others_unit+" | ";
temp+=""+items[i].others_standard+" | ";
temp+=""+items[i].others_price+" | ";
temp+=""+items[i].total_price+" | ";
temp+=""+items[i].no_total_price+" | ";
temp+=""+items[i].tax_rate+" | ";
temp+=""+items[i].manufacturer_name+" | ";
temp+=""+items[i].storage_name+" | ";
temp+=""+items[i].pather+" | ";
temp+=""+items[i].input_person+" | ";
temp+="
";
}
$('#last').append(temp);
$.messager.confirm('Confirm','是否打印?',function(r){
if (r){
CreateOneFormPage();
LODOP.PREVIEW();
}
});
};
function print(){
prn1_preview();
}
这里面可能会用到插件,需要的可以联系我