Print Format question

Visto 238 veces
Saltar al primer mensaje no leído

Hernan Gonzalez

no leída,
9 ene 2014, 12:57:449/1/14
a erpnext-u...@googlegroups.com
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:



Ageka Pesos.txt

Akhilesh Darjee

no leída,
10 ene 2014, 0:41:4710/1/14
a erpnext-u...@googlegroups.com
Hi Hernan,

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


--
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-fo...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--

Regards,
Akhilesh Darjee

Hernan Gonzalez

no leída,
11 ene 2014, 17:12:4111/1/14
a erpnext-u...@googlegroups.com
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 <nuco....@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+unsub...@googlegroups.com.

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



--

Regards,
Akhilesh Darjee

Akhilesh Darjee

no leída,
12 ene 2014, 4:22:3912/1/14
a erpnext-u...@googlegroups.com

Hi Hernan,

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

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

Hernan Gonzalez

no leída,
12 ene 2014, 10:29:2912/1/14
a erpnext-u...@googlegroups.com
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%'
);
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

Akhilesh Darjee

no leída,
13 ene 2014, 0:39:4113/1/14
a erpnext-u...@googlegroups.com
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)


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

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



--
Regards,
Akhilesh Darjee

Anand Doshi

no leída,
13 ene 2014, 0:40:2013/1/14
a ERPNext User's Forum
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.


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

Hernan Gonzalez

no leída,
16 ene 2014, 13:01:1516/1/14
a erpnext-u...@googlegroups.com
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);
}
  }

);

// 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>

Akhilesh Darjee

no leída,
17 ene 2014, 0:36:0117/1/14
a erpnext-u...@googlegroups.com
Hi Hernan,
You should use return flt(data_row.qty, 2);
 
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-fo...@googlegroups.com.

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



--
Regards,
Akhilesh Darjee

Hernan Gonzalez

no leída,
17 ene 2014, 6:22:3817/1/14
a erpnext-u...@googlegroups.com
Well i tryed thar before and it returns a 0, (without decimals)
Regards,
Akhilesh Darjee

Akhilesh Darjee

no leída,
17 ene 2014, 6:26:1117/1/14
a erpnext-u...@googlegroups.com
Hi Hernan,

Use format_number(data_row.qty, null, 2)


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

For more options, visit https://groups.google.com/groups/opt_out.
Se ha eliminado el mensaje

Hernan Gonzalez

no leída,
17 ene 2014, 14:41:3117/1/14
a erpnext-u...@googlegroups.com
Welli added the  "null," but it gives the same output.

Hi Hernan,

--
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+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Akhilesh Darjee

no leída,
23 ene 2014, 4:37:5923/1/14
a erpnext-u...@googlegroups.com
Hi Hernan,

Can you please share the code via pastebin.com


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

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

Hernan Gonzalez

no leída,
24 ene 2014, 15:39:5924/1/14
a erpnext-u...@googlegroups.com
http://pastebin.com/6Z7bCa7z

Here is the complete code.

Akhilesh Darjee

no leída,
27 ene 2014, 4:25:3927/1/14
a erpnext-u...@googlegroups.com
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.


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

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

Hernan Gonzalez

no leída,
27 ene 2014, 8:54:1327/1/14
a erpnext-u...@googlegroups.com
It works great!!, thanks a lot for your effort.

Rushabh Mehta

no leída,
29 ene 2014, 9:01:1729/1/14
a erpnext-u...@googlegroups.com
Please consider making a contribution too :)

Addy

no leída,
31 mar 2014, 23:21:0531/3/14
a erpnext-u...@googlegroups.com
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.

Umair Sayyed

no leída,
1 abr 2014, 2:24:351/4/14
a ERPNext User's Forum
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.



--
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-fo...@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

Paul Dowd

no leída,
17 abr 2014, 2:14:1917/4/14
a erpnext-u...@googlegroups.com
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
Responder a todos
Responder al autor
Reenviar
0 mensajes nuevos