Print Format question

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+un...@googlegroups.com.

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

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+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.

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

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+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.

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

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+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.

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+un...@googlegroups.com.

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

Well, this doesnt seem to work:

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', '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+un…@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+un...@googlegroups.com.

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

Hi Hernan,

Don't use print_table() function, create your own custom function which will show item details table.
In that function when printing qty, use flt(qty, 2)


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+un…@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+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.

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

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+un…@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+un…@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+un...@googlegroups.com.

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

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',
doc.name,
'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);
}
  }

);

// 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+un…@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+un...@googlegroups.com.

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

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+un…@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+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.

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

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+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.

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

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+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.

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.

I already tried that and it just gives a blank row.



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+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.

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

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+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.

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

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+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.

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.

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+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.

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

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+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.

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.

It works great!!, thanks a lot for your effort.


On Monday, January 27, 2014 6:25:39 AM UTC-3, 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.

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

Please consider making a contribution too :)

On Monday, January 27, 2014 7:24:13 PM UTC+5:30, Hernan Gonzalez wrote:
It works great!!, thanks a lot for your effort.



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.

Hi,

I would like to ask if it is OK for users to delete certain (standard) print formats from the system.
I see that we can assign roles the ability to delete the print formats but I just wanted to confirm that whether deleting the Standard print formats in various documents would have any adverse effect on the system. Please let me know the same since we are planning to delete some of the standard print formats which we are not using.

On Wednesday, January 29, 2014 7:31:17 PM UTC+5:30, Rushabh Mehta wrote:
Please consider making a contribution too :)

On Monday, January 27, 2014 7:24:13 PM UTC+5:30, Hernan Gonzalez wrote:
It works great!!, thanks a lot for your effort.



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/3194a99e-ad41-4f74-8357-1fd77038a3f0%40googlegroups.com.

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

Hello Aditya,

Deleting Standard Print Formats (Classic, Modern, Spartan) should not be a problem. If needed, you can add it again as non-standard print format. HTML script for these Print Formats will be available on Github.



On Tue, Apr 1, 2014 at 8:51 AM, Addy <ad...@gmail.com> wrote:
Hi,

I would like to ask if it is OK for users to delete certain (standard) print formats from the system.
I see that we can assign roles the ability to delete the print formats but I just wanted to confirm that whether deleting the Standard print formats in various documents would have any adverse effect on the system. Please let me know the same since we are planning to delete some of the standard print formats which we are not using.



On Wednesday, January 29, 2014 7:31:17 PM UTC+5:30, Rushabh Mehta wrote:

Please consider making a contribution too :slight_smile:


On Monday, January 27, 2014 7:24:13 PM UTC+5:30, Hernan Gonzalez wrote:

It works great!!, thanks a lot for your effort.




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/3194a99e-ad41-4f74-8357-1fd77038a3f0%40googlegroups.com.

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




--
Thanks and Regards,

Umair Sayyed
www.erpnext.com