Changes in print formats to include selected print heading and discount

appended in description
This commit is contained in:
Anand Doshi 2011-12-13 15:57:09 +05:30
parent 130ae98675
commit 206df20f36
31 changed files with 261 additions and 119 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -53,7 +53,7 @@ def execute():
Install print formats Install print formats
""" """
from webnotes.modules.module_manager import reload_doc from webnotes.modules.module_manager import reload_doc
#reload_doc('core', 'doctype', 'print_format') reload_doc('core', 'doctype', 'print_format')
#copy_doctype_to_pfs() #copy_doctype_to_pfs()
global pf_to_install global pf_to_install

View File

@ -112,17 +112,26 @@
null, null,
{ {
'description' : function(data_row) { 'description' : function(data_row) {
if(data_row.serial_no) { var to_append = ''
return ( if(data_row.adj_rate){
data_row.description + to_append = '<div style="padding-left: 15px;"><i>Discount: ' +
'<div style="padding-left: 15px;"><i>Serial No.:' + data_row.adj_rate + '%</i></div>';
((data_row.serial_no.indexOf('\n')>-1)?'<br />':'&nbsp;') + if(data_row.description.indexOf(to_append)==-1) {
data_row.serial_no + '</i></div>' data_row.description = data_row.description + to_append;
);
} else {
return data_row.description;
} }
} }
if(data_row.serial_no) {
to_append = '<div style="padding-left: 15px;"><i>Serial No.:' +
((data_row.serial_no.indexOf('\n')>-1)?'<br />':'&nbsp;') +
data_row.serial_no + '</i></div>';
if(data_row.description.indexOf(to_append)==-1) {
data_row.description = data_row.description + to_append;
}
}
return data_row.description;
}
} }
); );
@ -176,7 +185,7 @@
--> -->
<table class='header-table' cellspacing=0> <table class='header-table' cellspacing=0>
<thead> <thead>
<tr><td><h1>Delivery Note</h1></td></tr> <tr><td><script>'<h1>' + (doc.select_print_heading || 'Delivery Note') + '</h1>'</script></td></tr>
<tr><td><h3><script>cur_frm.docname</script></h3></td></tr> <tr><td><h3><script>cur_frm.docname</script></h3></td></tr>
</thead> </thead>
<tbody> <tbody>

View File

@ -135,17 +135,26 @@
null, null,
{ {
'description' : function(data_row) { 'description' : function(data_row) {
if(data_row.serial_no) { var to_append = ''
return ( if(data_row.adj_rate){
data_row.description + to_append = '<div style="padding-left: 15px;"><i>Discount: ' +
'<div style="padding-left: 15px;"><i>Serial No.:' + data_row.adj_rate + '%</i></div>';
((data_row.serial_no.indexOf('\n')>-1)?'<br />':'&nbsp;') + if(data_row.description.indexOf(to_append)==-1) {
data_row.serial_no + '</i></div>' data_row.description = data_row.description + to_append;
);
} else {
return data_row.description;
} }
} }
if(data_row.serial_no) {
to_append = '<div style="padding-left: 15px;"><i>Serial No.:' +
((data_row.serial_no.indexOf('\n')>-1)?'<br />':'&nbsp;') +
data_row.serial_no + '</i></div>';
if(data_row.description.indexOf(to_append)==-1) {
data_row.description = data_row.description + to_append;
}
}
return data_row.description;
}
} }
); );
@ -199,7 +208,7 @@
--> -->
<table class='header-table' cellspacing=0> <table class='header-table' cellspacing=0>
<thead> <thead>
<tr><td colspan=2><div><h1>Delivery Note</h1></div></td></tr> <tr><td colspan=2><div><script>'<h1>' + (doc.select_print_heading || 'Delivery Note') + '</h1>'</script></div></td></tr>
<tr><td colspan=2><div style="height:15px"></div></td></tr> <tr><td colspan=2><div style="height:15px"></div></td></tr>
</thead> </thead>
<tbody> <tbody>
@ -303,4 +312,3 @@
</tfoot> </tfoot>
</table> </table>
</div> </div>

View File

@ -134,17 +134,26 @@
null, null,
{ {
'description' : function(data_row) { 'description' : function(data_row) {
if(data_row.serial_no) { var to_append = ''
return ( if(data_row.adj_rate){
data_row.description + to_append = '<div style="padding-left: 15px;"><i>Discount: ' +
'<div style="padding-left: 15px;"><i>Serial No.:' + data_row.adj_rate + '%</i></div>';
((data_row.serial_no.indexOf('\n')>-1)?'<br />':'&nbsp;') + if(data_row.description.indexOf(to_append)==-1) {
data_row.serial_no + '</i></div>' data_row.description = data_row.description + to_append;
);
} else {
return data_row.description;
} }
} }
if(data_row.serial_no) {
to_append = '<div style="padding-left: 15px;"><i>Serial No.:' +
((data_row.serial_no.indexOf('\n')>-1)?'<br />':'&nbsp;') +
data_row.serial_no + '</i></div>';
if(data_row.description.indexOf(to_append)==-1) {
data_row.description = data_row.description + to_append;
}
}
return data_row.description;
}
} }
); );
@ -198,7 +207,7 @@
--> -->
<table class='header-table' cellspacing=0> <table class='header-table' cellspacing=0>
<thead> <thead>
<tr><td colspan=2><h1>Delivery Note</h1></td></tr> <tr><td colspan=2><script>'<h1>' + (doc.select_print_heading || 'Delivery Note') + '</h1>'</script></td></tr>
<tr><td colspan=2><h3><script>cur_frm.docname</script></h3></td></tr> <tr><td colspan=2><h3><script>cur_frm.docname</script></h3></td></tr>
</thead> </thead>
<tbody> <tbody>
@ -298,5 +307,3 @@
</tfoot> </tfoot>
</table> </table>
</div> </div>

View File

@ -160,7 +160,7 @@
--> -->
<table class='header-table' cellspacing=0> <table class='header-table' cellspacing=0>
<thead> <thead>
<tr><td><h1>Purchase Order</h1></td></tr> <tr><td><script>'<h1>' + (doc.select_print_heading || 'Purchase Order') + '</h1>'</script></td></tr>
<tr><td><h3><script>cur_frm.docname</script></h3></td></tr> <tr><td><h3><script>cur_frm.docname</script></h3></td></tr>
</thead> </thead>
<tbody> <tbody>
@ -246,4 +246,3 @@
</tfoot> </tfoot>
</table> </table>
</div> </div>

View File

@ -183,7 +183,7 @@
--> -->
<table class='header-table' cellspacing=0> <table class='header-table' cellspacing=0>
<thead> <thead>
<tr><td colspan=2><div><h1>Purchase Order</h1></div></td></tr> <tr><td colspan=2><div><script>'<h1>' + (doc.select_print_heading || 'Purchase Order') + '</h1>'</script></div></td></tr>
<tr><td colspan=2><div style="height:15px"></div></td></tr> <tr><td colspan=2><div style="height:15px"></div></td></tr>
</thead> </thead>
<tbody> <tbody>
@ -273,4 +273,3 @@
</tfoot> </tfoot>
</table> </table>
</div> </div>

View File

@ -182,7 +182,7 @@
--> -->
<table class='header-table' cellspacing=0> <table class='header-table' cellspacing=0>
<thead> <thead>
<tr><td colspan=2><h1>Purchase Order</h1></td></tr> <tr><td colspan=2><script>'<h1>' + (doc.select_print_heading || 'Purchase Order') + '</h1>'</script></td></tr>
<tr><td colspan=2><h3><script>cur_frm.docname</script></h3></td></tr> <tr><td colspan=2><h3><script>cur_frm.docname</script></h3></td></tr>
</thead> </thead>
<tbody> <tbody>
@ -268,5 +268,3 @@
</tfoot> </tfoot>
</table> </table>
</div> </div>

View File

@ -107,7 +107,22 @@
[// Here specify the column widths [// Here specify the column widths
'3%', '10%', '15%', '32%', '5%', '3%', '10%', '15%', '32%', '5%',
'5%', '15%', '15%' '5%', '15%', '15%'
] ],
null,
null,
{
'description' : function(data_row) {
if(data_row.adj_rate) {
var to_append = '<div style="padding-left: 15px;"><i>Discount: ' +
data_row.adj_rate + '%</i></div>';
if(data_row.description.indexOf(to_append)==-1) {
return data_row.description + to_append;
} else { return data_row.description; }
} else {
return data_row.description;
}
}
}
); );
// This code takes care of page breaks // This code takes care of page breaks
@ -160,7 +175,9 @@
--> -->
<table class='header-table' cellspacing=0> <table class='header-table' cellspacing=0>
<thead> <thead>
<tr><td><h1>Quotation</h1></td></tr> <tr><td>
<script>'<h1>' + (doc.select_print_heading || 'Quotation') + '</h1>'</script>
</td></tr>
<tr><td><h3><script>cur_frm.docname</script></h3></td></tr> <tr><td><h3><script>cur_frm.docname</script></h3></td></tr>
</thead> </thead>
<tbody> <tbody>
@ -253,4 +270,3 @@
</tfoot> </tfoot>
</table> </table>
</div> </div>

View File

@ -130,7 +130,22 @@
[// Here specify the column widths [// Here specify the column widths
'3%', '10%', '15%', '32%', '5%', '3%', '10%', '15%', '32%', '5%',
'5%', '15%', '15%' '5%', '15%', '15%'
] ],
null,
null,
{
'description' : function(data_row) {
if(data_row.adj_rate) {
var to_append = '<div style="padding-left: 15px;"><i>Discount: ' +
data_row.adj_rate + '%</i></div>';
if(data_row.description.indexOf(to_append)==-1) {
return data_row.description + to_append;
} else { return data_row.description; }
} else {
return data_row.description;
}
}
}
); );
// This code takes care of page breaks // This code takes care of page breaks
@ -183,7 +198,7 @@
--> -->
<table class='header-table' cellspacing=0> <table class='header-table' cellspacing=0>
<thead> <thead>
<tr><td colspan=2><div><h1>Quotation</h1></div></td></tr> <tr><td colspan=2><div><script>'<h1>' + (doc.select_print_heading || 'Quotation') + '</h1>'</script></div></td></tr>
<tr><td colspan=2><div style="height:15px"></div></td></tr> <tr><td colspan=2><div style="height:15px"></div></td></tr>
</thead> </thead>
<tbody> <tbody>
@ -280,4 +295,3 @@
</tfoot> </tfoot>
</table> </table>
</div> </div>

View File

@ -129,7 +129,22 @@
[// Here specify the column widths [// Here specify the column widths
'3%', '10%', '15%', '32%', '5%', '3%', '10%', '15%', '32%', '5%',
'5%', '15%', '15%' '5%', '15%', '15%'
] ],
null,
null,
{
'description' : function(data_row) {
if(data_row.adj_rate) {
var to_append = '<div style="padding-left: 15px;"><i>Discount: ' +
data_row.adj_rate + '%</i></div>';
if(data_row.description.indexOf(to_append)==-1) {
return data_row.description + to_append;
} else { return data_row.description; }
} else {
return data_row.description;
}
}
}
); );
// This code takes care of page breaks // This code takes care of page breaks
@ -182,7 +197,7 @@
--> -->
<table class='header-table' cellspacing=0> <table class='header-table' cellspacing=0>
<thead> <thead>
<tr><td colspan=2><h1>Quotation</h1></td></tr> <tr><td colspan=2><script>'<h1>' + (doc.select_print_heading || 'Quotation') + '</h1>'</script></td></tr>
<tr><td colspan=2><h3><script>cur_frm.docname</script></h3></td></tr> <tr><td colspan=2><h3><script>cur_frm.docname</script></h3></td></tr>
</thead> </thead>
<tbody> <tbody>
@ -275,5 +290,3 @@
</tfoot> </tfoot>
</table> </table>
</div> </div>

View File

@ -107,7 +107,22 @@
[// Here specify the column widths [// Here specify the column widths
'3%', '20%', '37%', '5%', '3%', '20%', '37%', '5%',
'5%', '15%', '15%' '5%', '15%', '15%'
] ],
null,
null,
{
'description' : function(data_row) {
if(data_row.adj_rate) {
var to_append = '<div style="padding-left: 15px;"><i>Discount: ' +
data_row.adj_rate + '%</i></div>';
if(data_row.description.indexOf(to_append)==-1) {
return data_row.description + to_append;
} else { return data_row.description; }
} else {
return data_row.description;
}
}
}
); );
// This code takes care of page breaks // This code takes care of page breaks
@ -128,7 +143,6 @@
print_other_charges: function(parent) { print_other_charges: function(parent) {
console.log(parent);
var oc = getchildren('RV Tax Detail', doc.name, 'other_charges'); var oc = getchildren('RV Tax Detail', doc.name, 'other_charges');
var rows = '<table width=100%>\n'; var rows = '<table width=100%>\n';
for(var i=0; i<oc.length; i++) { for(var i=0; i<oc.length; i++) {
@ -161,7 +175,7 @@
--> -->
<table class='header-table' cellspacing=0> <table class='header-table' cellspacing=0>
<thead> <thead>
<tr><td><h1>Invoice</h1></td></tr> <tr><td><script>'<h1>' + (doc.select_print_heading || 'Invoice') + '</h1>'</script></td></tr>
<tr><td><h3><script>cur_frm.docname</script></h3></td></tr> <tr><td><h3><script>cur_frm.docname</script></h3></td></tr>
</thead> </thead>
<tbody> <tbody>
@ -258,4 +272,3 @@
</tfoot> </tfoot>
</table> </table>
</div> </div>

View File

@ -130,7 +130,22 @@
[// Here specify the column widths [// Here specify the column widths
'3%', '20%', '37%', '5%', '3%', '20%', '37%', '5%',
'5%', '15%', '15%' '5%', '15%', '15%'
] ],
null,
null,
{
'description' : function(data_row) {
if(data_row.adj_rate) {
var to_append = '<div style="padding-left: 15px;"><i>Discount: ' +
data_row.adj_rate + '%</i></div>';
if(data_row.description.indexOf(to_append)==-1) {
return data_row.description + to_append;
} else { return data_row.description; }
} else {
return data_row.description;
}
}
}
); );
// This code takes care of page breaks // This code takes care of page breaks
@ -151,7 +166,6 @@
print_other_charges: function(parent) { print_other_charges: function(parent) {
console.log(parent);
var oc = getchildren('RV Tax Detail', doc.name, 'other_charges'); var oc = getchildren('RV Tax Detail', doc.name, 'other_charges');
var rows = '<table width=100%>\n'; var rows = '<table width=100%>\n';
for(var i=0; i<oc.length; i++) { for(var i=0; i<oc.length; i++) {
@ -184,7 +198,7 @@
--> -->
<table class='header-table' cellspacing=0> <table class='header-table' cellspacing=0>
<thead> <thead>
<tr><td colspan=2><div><h1>Invoice</h1></div></td></tr> <tr><td colspan=2><div><script>'<h1>' + (doc.select_print_heading || 'Invoice') + '</h1>'</script></div></td></tr>
<tr><td colspan=2><div style="height:15px"></div></td></tr> <tr><td colspan=2><div style="height:15px"></div></td></tr>
</thead> </thead>
<tbody> <tbody>
@ -285,4 +299,3 @@
</tfoot> </tfoot>
</table> </table>
</div> </div>

View File

@ -129,7 +129,22 @@
[// Here specify the column widths [// Here specify the column widths
'3%', '20%', '37%', '5%', '3%', '20%', '37%', '5%',
'5%', '15%', '15%' '5%', '15%', '15%'
] ],
null,
null,
{
'description' : function(data_row) {
if(data_row.adj_rate) {
var to_append = '<div style="padding-left: 15px;"><i>Discount: ' +
data_row.adj_rate + '%</i></div>';
if(data_row.description.indexOf(to_append)==-1) {
return data_row.description + to_append;
} else { return data_row.description; }
} else {
return data_row.description;
}
}
}
); );
// This code takes care of page breaks // This code takes care of page breaks
@ -150,7 +165,6 @@
print_other_charges: function(parent) { print_other_charges: function(parent) {
console.log(parent);
var oc = getchildren('RV Tax Detail', doc.name, 'other_charges'); var oc = getchildren('RV Tax Detail', doc.name, 'other_charges');
var rows = '<table width=100%>\n'; var rows = '<table width=100%>\n';
for(var i=0; i<oc.length; i++) { for(var i=0; i<oc.length; i++) {
@ -183,7 +197,7 @@
--> -->
<table class='header-table' cellspacing=0> <table class='header-table' cellspacing=0>
<thead> <thead>
<tr><td colspan=2><h1>Invoice</h1></td></tr> <tr><td colspan=2><script>'<h1>' + (doc.select_print_heading || 'Invoice') + '</h1>'</script></td></tr>
<tr><td colspan=2><h3><script>cur_frm.docname</script></h3></td></tr> <tr><td colspan=2><h3><script>cur_frm.docname</script></h3></td></tr>
</thead> </thead>
<tbody> <tbody>
@ -280,5 +294,3 @@
</tfoot> </tfoot>
</table> </table>
</div> </div>

View File

@ -107,7 +107,22 @@
[// Here specify the column widths [// Here specify the column widths
'3%', '20%', '37%', '5%', '3%', '20%', '37%', '5%',
'5%', '15%', '15%' '5%', '15%', '15%'
] ],
null,
null,
{
'description' : function(data_row) {
if(data_row.adj_rate) {
var to_append = '<div style="padding-left: 15px;"><i>Discount: ' +
data_row.adj_rate + '%</i></div>';
if(data_row.description.indexOf(to_append)==-1) {
return data_row.description + to_append;
} else { return data_row.description; }
} else {
return data_row.description;
}
}
}
); );
// This code takes care of page breaks // This code takes care of page breaks
@ -160,7 +175,7 @@
--> -->
<table class='header-table' cellspacing=0> <table class='header-table' cellspacing=0>
<thead> <thead>
<tr><td><h1>Sales Order</h1></td></tr> <tr><td><script>'<h1>' + (doc.select_print_heading || 'Sales Order') + '</h1>'</script></td></tr>
<tr><td><h3><script>cur_frm.docname</script></h3></td></tr> <tr><td><h3><script>cur_frm.docname</script></h3></td></tr>
</thead> </thead>
<tbody> <tbody>
@ -257,4 +272,3 @@
</tfoot> </tfoot>
</table> </table>
</div> </div>

View File

@ -130,7 +130,22 @@
[// Here specify the column widths [// Here specify the column widths
'3%', '20%', '37%', '5%', '3%', '20%', '37%', '5%',
'5%', '15%', '15%' '5%', '15%', '15%'
] ],
null,
null,
{
'description' : function(data_row) {
if(data_row.adj_rate) {
var to_append = '<div style="padding-left: 15px;"><i>Discount: ' +
data_row.adj_rate + '%</i></div>';
if(data_row.description.indexOf(to_append)==-1) {
return data_row.description + to_append;
} else { return data_row.description; }
} else {
return data_row.description;
}
}
}
); );
// This code takes care of page breaks // This code takes care of page breaks
@ -183,7 +198,7 @@
--> -->
<table class='header-table' cellspacing=0> <table class='header-table' cellspacing=0>
<thead> <thead>
<tr><td colspan=2><div><h1>Sales Order</h1></div></td></tr> <tr><td colspan=2><div><script>'<h1>' + (doc.select_print_heading || 'Sales Order') + '</h1>'</script></div></td></tr>
<tr><td colspan=2><div style="height:15px"></div></td></tr> <tr><td colspan=2><div style="height:15px"></div></td></tr>
</thead> </thead>
<tbody> <tbody>
@ -284,4 +299,3 @@
</tfoot> </tfoot>
</table> </table>
</div> </div>

View File

@ -129,7 +129,22 @@
[// Here specify the column widths [// Here specify the column widths
'3%', '20%', '37%', '5%', '3%', '20%', '37%', '5%',
'5%', '15%', '15%' '5%', '15%', '15%'
] ],
null,
null,
{
'description' : function(data_row) {
if(data_row.adj_rate) {
var to_append = '<div style="padding-left: 15px;"><i>Discount: ' +
data_row.adj_rate + '%</i></div>';
if(data_row.description.indexOf(to_append)==-1) {
return data_row.description + to_append;
} else { return data_row.description; }
} else {
return data_row.description;
}
}
}
); );
// This code takes care of page breaks // This code takes care of page breaks
@ -182,7 +197,7 @@
--> -->
<table class='header-table' cellspacing=0> <table class='header-table' cellspacing=0>
<thead> <thead>
<tr><td colspan=2><h1>Sales Order</h1></td></tr> <tr><td colspan=2><script>'<h1>' + (doc.select_print_heading || 'Sales Order') + '</h1>'</script></td></tr>
<tr><td colspan=2><h3><script>cur_frm.docname</script></h3></td></tr> <tr><td colspan=2><h3><script>cur_frm.docname</script></h3></td></tr>
</thead> </thead>
<tbody> <tbody>
@ -279,5 +294,3 @@
</tfoot> </tfoot>
</table> </table>
</div> </div>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long