Print Format question

Hi Akhilesh

I've tried to use your print format because I have a very similar problem where I need to show only integers on the print formats. However when I copied your print format in nothing shows up in the item table. The rest shows fine, just the item table is missing the items. 

Is there a different or simpler way of doing this change without changing the entire structure of how the item table is built?

thanks

Paul

On Monday, 27 January 2014 22:25:39 UTC+13, Akhilesh Darjee wrote:
Hi Hernan,

Please use this code - http://pastebin.com/K0g6ZWhh.
This might solve your problem.
Also change the table heading lables according to your preferred language.


On Sat, Jan 25, 2014 at 2:09 AM, Hernan Gonzalez <nu...@gmail.com> wrote:
http://pastebin.com/6Z7bCa7z

Here is the complete code.




On Thursday, January 23, 2014 6:37:59 AM UTC-3, Akhilesh Darjee wrote:
Hi Hernan,

Can you please share the code via pastebin.com


On Sat, Jan 18, 2014 at 1:11 AM, Hernan Gonzalez <nu...@gmail.com> wrote:
Welli added the  "null," but it gives the same output.

 

On Friday, January 17, 2014 8:26:11 AM UTC-3, Akhilesh Darjee wrote:
Hi Hernan,

Use format_number(data_row.qty, null, 2)


On Fri, Jan 17, 2014 at 4:52 PM, Hernan Gonzalez <nu...@gmail.com> wrote:
Well i tryed thar before and it returns a 0, (without decimals)


On Friday, January 17, 2014 2:36:01 AM UTC-3, Akhilesh Darjee wrote:
Hi Hernan,

On Thu, Jan 16, 2014 at 11:31 PM, Hernan Gonzalez <nu...@gmail.com> wrote:
Well, i'm getting closer. this code returns a value with two decimals, but the value is always 0.00. 


Any sugestions?

<script>
si_std = {
print_item_table: function() {

var table = print_table(
'Sales Invoice',
'entries',
'Sales Invoice Item',
[// Here specify the table columns to be displayed
'Sr', 'item_name', 'description', 'qty',
'basic_rate', 'amount'
],
[// Here specify the labels of column headings
'Sr', 'Nombre', 'Descripción', 'Cant',
'Unitario', 'Monto'
],
[// Here specify the column widths
'3%', '22%', '40%', '5%',
'15%', '15%'
],
null,
null,
  {
  // return Quantity
'qty': function(data_row) {

return format_number(data_row.qty, 2);

}

You should use return flt(data_row.qty, 2);

 
  }

);

// This code takes care of page breaks
if(table.appendChild) {
out = table.innerHTML;
} else {
out = '';
for(var i=0; i < (table.length-1); i++) {
out += table[i].innerHTML + 
'<div style = "page-break-after: always;" \
class = "page_break"></div>\
<div class="page-settings"></div>';
}
out += table[table.length-1].innerHTML;
}
return out;
},


print_other_charges: function(parent) {
var oc = getchildren('Sales Taxes and Charges', doc.name, 'other_charges');
var rows = '<table width=100%>\n';
for(var i=0; i<oc.length; i++) {
if(!oc[i].included_in_print_rate) {
rows +=
'<tr>\n' +
'\t<td>' + oc[i].description + '</td>\n' +
'\t<td>AR$</td>\n' +
'\t<td width=38%, align="right">' + format_number(oc[i].tax_amount,null,2) + '</td>\n' +
'</tr>\n';
}
}
return rows + '</table>\n';
}
};
</script>

On Monday, January 13, 2014 2:40:20 AM UTC-3, Anand Doshi wrote:
Hi Hernan,

Just like how the description modifier is passed to the print_table function, in the same dictionary, you can also pass a qty modifier and return flt(data_row.qty, 2)


Thanks,
Anand.


On Sun, Jan 12, 2014 at 8:59 PM, Hernan Gonzalez <nu…@gmail.com> wrote:

Well, this doesnt seem to work:

si_std = {
print_item_table: function() {
var table = print_table(
'Sales Invoice',
'entries',
'Sales Invoice Item',
[// Here specify the table columns to be displayed
'Sr', 'item_name', 'description', 'Flt(qty, 2)', 'stock_uom',
'basic_rate', 'amount'
],
[// Here specify the labels of column headings
'Sr', 'Nombre', 'Descripción', 'Cant',
'Unidad', 'Unitario', 'Monto'
],
[// Here specify the column widths
'3%', '20%', '37%', '5%',
'5%', '15%', '15%'

);



On Sunday, January 12, 2014 6:22:39 AM UTC-3, Akhi wrote:

Hi Hernan,

You can use for function for all float values,  even for any.
Flt(qty, 2)

On Jan 12, 2014 3:42 AM, "Hernan Gonzalez" <nu...@gmail.com> wrote:
How do i put the flt(amount, 2)  inside the "print_item_table" function, only for the "qty" field.

si_std = {
		print_item_table: function() {
			var table = print_table(
				'Sales Invoice',
				doc.name,
				'entries',
				'Sales Invoice Item',
				[// Here specify the table columns to be displayed
					'Sr', 'item_name', 'description', 'qty', 'stock_uom',
					'basic_rate', 'amount'
				],
				[// Here specify the labels of column headings
					'Sr', 'Nombre', 'Descripción', 'Cant',
					'Unidad', 'Unitario', 'Monto'
				],
				[// Here specify the column widths
					'3%', '20%', '37%', '5%',
					'5%', '15%', '15%'
				],
				null,
				null,
				{

On Friday, January 10, 2014 2:41:47 AM UTC-3, Akhi wrote:
Hi Hernan,

You can use flt(amount, 2) to set the precision to 2 decimal places.


On Thu, Jan 9, 2014 at 11:27 PM, Hernan Gonzalez <nu...@gmail.com> wrote:
I want to limit the number of decimal places for the qty field (float), i can limit the decimal Float Precision in global defaults, but i want to keep the precision set to 4 decimals and show only two in the print format as it is done in currency fields.


My custom print format is attached.

And this is the output:





You received this message because you are subscribed to the Google Groups “ERPNext User’s Forum” group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.






Regards,
Akhilesh Darjee



You received this message because you are subscribed to the Google Groups “ERPNext User’s Forum” group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.



You received this message because you are subscribed to the Google Groups “ERPNext User’s Forum” group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.




You received this message because you are subscribed to the Google Groups “ERPNext User’s Forum” group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.




--
Regards,
Akhilesh Darjee



You received this message because you are subscribed to the Google Groups “ERPNext User’s Forum” group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.




--
Regards,
Akhilesh Darjee



You received this message because you are subscribed to the Google Groups “ERPNext User’s Forum” group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.




--
Regards,
Akhilesh Darjee



You received this message because you are subscribed to the Google Groups “ERPNext User’s Forum” group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.




--
Regards,
Akhilesh Darjee



You received this message because you are subscribed to the Google Groups "ERPNext User's Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/b50c0121-373d-47c4-a4f6-4f70f91d62f5%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.