Page breaks between the content. I have so many vouchers to print. I need one voucher in one page with page break. I have developed like, i have placed the content in a div which has height and width as A4 size.
"<div style='height:900px;border:0px solid #000000'> " .So i got vocuhers as page wise
My code is
function getdataforprinting(val){
xmlhttp = false;
if (window.XMLHttpRequest) {// code for Firefox, Opera, IE7, etc.
xmlhttp=new XMLHttpRequest();
} else if (window.ActiveXObject) {// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
/* ========== AJAX Initializtion ========== */
if (xmlhttp!=null) {
url="/getdataforedit"+"?ion="+ion;
xmlhttp.onreadystatechange= function () { getprint(xmlhttp); };
xmlhttp.open("POST", url, true);
xmlhttp.setRequestHeader("Cache-Control","no-cache, private, max-age=0");
xmlhttp.send(null);
} else {
alert("Your browser does not support XMLHTTP.");
}
}
function getprint(httpRequest1)
{
if(httpRequest1.readyState==4)
{
if(httpRequest1.status==200)
{
var rest="";
var result = httpRequest1.responseXML;
var suplength=result.getElementsByTagName("supplier").length;
if(suplength>0)
{
var msg=result.getElementsByTagName("supplier");
for(var t=0;t<suplength;t++)
{
var suppname=result.getElementsByTagName("suppname")[t].childNodes[0].nodeValue;
var billdate=result.getElementsByTagName("billdate")[t].childNodes[0].nodeValue;
var paymode=result.getElementsByTagName("paymode")[t].childNodes[0].nodeValue;
var ionno=result.getElementsByTagName("ionno")[t].childNodes[0].nodeValue;
var bbrcode=result.getElementsByTagName("bbrcode")[t].childNodes[0].nodeValue;
var instno=result.getElementsByTagName("instno")[t].childNodes[0].nodeValue;
var instdate=result.getElementsByTagName("instdate")[t].childNodes[0].nodeValue;
var billno=result.getElementsByTagName("billno")[t].childNodes[0].nodeValue;
var billamount=result.getElementsByTagName("billamount")[t].childNodes[0].nodeValue;
var amount=result.getElementsByTagName("payamt")[t].childNodes[0].nodeValue;
var suppid=result.getElementsByTagName("suppid")[t].childNodes[0].nodeValue;
rest+="<div style='height:900px;border:0px solid #000000'>";
rest+="<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"60%\"><tr>";
rest+="<td class=\"text_bg\">Inter Office Document Number</td>";
rest+="<td class=\"text_bg\">"+ionno+"</td>";
rest+="</tr><tr><td class=\"text_bg\">Supplier payment voucher number</td>";
rest+="<td class=\"text_bg\">"+suppid+"</td></tr>";
rest+="<tr><td class=\"text_bg\">Supplier name</td>";
rest+="<td class=\"text_bg\">"+suppname+"</td></tr><tr><td class=\"text_bg\">Supplier Bill date</td>";
rest+="<td class=\"text_bg\">"+billdate+"</td></tr><tr><td class=\"text_bg\">Supplier Bill amount</td>";
rest+="<td class=\"text_bg\">"+billamount+"</td></tr><tr><td class=\"text_bg\">Pay mode</td><td class=\"text_bg\">"+paymode+"</td>";
rest+="</tr><tr><td class=\"text_bg\">Bank Name</td><td class=\"text_bg\">bnk</td></tr><tr>";
rest+="<td class=\"text_bg\">Branch</td><td class=\"text_bg\">br</td></tr><tr>";
rest+="<td class=\"text_bg\">Instrument Number</td>";
rest+="<td class=\"text_bg\">"+instno+"</td></tr><tr><td class=\"text_bg\">Instrument Date</td>";
rest+="<td class=\"text_bg\">"+instdate+"</td></tr> </table>";
rest+="</div>";
} //for close
var disp_setting="toolbar=yes,location=no,directories=yes,menubar=yes,";
disp_setting+="scrollbars=yes,width=650, height=600, left=100, top=25";
var docprint= window.open("", "", disp_setting);
docprint.document.open();
docprint.document.write('<html>');
docprint.document.write('<body onLoad="self.print()"><center>');
docprint.document.write(rest);
docprint.document.write('</center></body></html>');
docprint.document.close();
docprint.focus();
}
}
}}
"<div style='height:900px;border:0px solid #000000'> " .So i got vocuhers as page wise
My code is
function getdataforprinting(val){
xmlhttp = false;
if (window.XMLHttpRequest) {// code for Firefox, Opera, IE7, etc.
xmlhttp=new XMLHttpRequest();
} else if (window.ActiveXObject) {// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
/* ========== AJAX Initializtion ========== */
if (xmlhttp!=null) {
url="/getdataforedit"+"?ion="+ion;
xmlhttp.onreadystatechange= function () { getprint(xmlhttp); };
xmlhttp.open("POST", url, true);
xmlhttp.setRequestHeader("Cache-Control","no-cache, private, max-age=0");
xmlhttp.send(null);
} else {
alert("Your browser does not support XMLHTTP.");
}
}
function getprint(httpRequest1)
{
if(httpRequest1.readyState==4)
{
if(httpRequest1.status==200)
{
var rest="";
var result = httpRequest1.responseXML;
var suplength=result.getElementsByTagName("supplier").length;
if(suplength>0)
{
var msg=result.getElementsByTagName("supplier");
for(var t=0;t<suplength;t++)
{
var suppname=result.getElementsByTagName("suppname")[t].childNodes[0].nodeValue;
var billdate=result.getElementsByTagName("billdate")[t].childNodes[0].nodeValue;
var paymode=result.getElementsByTagName("paymode")[t].childNodes[0].nodeValue;
var ionno=result.getElementsByTagName("ionno")[t].childNodes[0].nodeValue;
var bbrcode=result.getElementsByTagName("bbrcode")[t].childNodes[0].nodeValue;
var instno=result.getElementsByTagName("instno")[t].childNodes[0].nodeValue;
var instdate=result.getElementsByTagName("instdate")[t].childNodes[0].nodeValue;
var billno=result.getElementsByTagName("billno")[t].childNodes[0].nodeValue;
var billamount=result.getElementsByTagName("billamount")[t].childNodes[0].nodeValue;
var amount=result.getElementsByTagName("payamt")[t].childNodes[0].nodeValue;
var suppid=result.getElementsByTagName("suppid")[t].childNodes[0].nodeValue;
rest+="<div style='height:900px;border:0px solid #000000'>";
rest+="<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"60%\"><tr>";
rest+="<td class=\"text_bg\">Inter Office Document Number</td>";
rest+="<td class=\"text_bg\">"+ionno+"</td>";
rest+="</tr><tr><td class=\"text_bg\">Supplier payment voucher number</td>";
rest+="<td class=\"text_bg\">"+suppid+"</td></tr>";
rest+="<tr><td class=\"text_bg\">Supplier name</td>";
rest+="<td class=\"text_bg\">"+suppname+"</td></tr><tr><td class=\"text_bg\">Supplier Bill date</td>";
rest+="<td class=\"text_bg\">"+billdate+"</td></tr><tr><td class=\"text_bg\">Supplier Bill amount</td>";
rest+="<td class=\"text_bg\">"+billamount+"</td></tr><tr><td class=\"text_bg\">Pay mode</td><td class=\"text_bg\">"+paymode+"</td>";
rest+="</tr><tr><td class=\"text_bg\">Bank Name</td><td class=\"text_bg\">bnk</td></tr><tr>";
rest+="<td class=\"text_bg\">Branch</td><td class=\"text_bg\">br</td></tr><tr>";
rest+="<td class=\"text_bg\">Instrument Number</td>";
rest+="<td class=\"text_bg\">"+instno+"</td></tr><tr><td class=\"text_bg\">Instrument Date</td>";
rest+="<td class=\"text_bg\">"+instdate+"</td></tr> </table>";
rest+="</div>";
} //for close
var disp_setting="toolbar=yes,location=no,directories=yes,menubar=yes,";
disp_setting+="scrollbars=yes,width=650, height=600, left=100, top=25";
var docprint= window.open("", "", disp_setting);
docprint.document.open();
docprint.document.write('<html>');
docprint.document.write('<body onLoad="self.print()"><center>');
docprint.document.write(rest);
docprint.document.write('</center></body></html>');
docprint.document.close();
docprint.focus();
}
}
}}
No comments:
Post a Comment