Computation of total quantity in delivery note form

Hi,

In delivery note form - how can I get total quantity of all items in delivery note items table, computed and displayed (analogous to net total field)?
While making delivery note, tallying total quantity being supplied is important.

Thanks,
Archit



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/ab734b41-0c06-4143-986d-229da8ee3dad%40googlegroups.com.

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

Add a Custom Field for the total and then write a script (JS) to calculate the total on save.

something like this:

https://gist.github.com/rmehta/8f4aedb91a6c58dfa31e

On 06-Jul-2014, at 1:05 am, archit garg <ar...@gmail.com> wrote:

Hi,

In delivery note form - how can I get total quantity of all items in delivery note items table, computed and displayed (analogous to net total field)?
While making delivery note, tallying total quantity being supplied is important.

Thanks,
Archit



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/ab734b41-0c06-4143-986d-229da8ee3dad%40googlegroups.com.

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




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/91A6ED4F-C8FD-426F-8CD1-9002FD4C247C%40gmail.com.

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

Hello Rushabh,

Thanks for the direction, here is how I have calculated the total quantity in my custom form. 

On Sunday, 6 July 2014 12:31:58 UTC+5:30, Rushabh Mehta wrote:
Add a Custom Field for the total and then write a script (JS) to calculate the total on save.

something like this:


On 06-Jul-2014, at 1:05 am, archit garg <ar...@gmail.com> wrote:

Hi,

In delivery note form - how can I get total quantity of all items in delivery note items table, computed and displayed (analogous to net total field)?
While making delivery note, tallying total quantity being supplied is important.

Thanks,
Archit



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/ab734b41-0c06-4143-986d-229da8ee3dad%40googlegroups.com.

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




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/c05cd076-e756-4864-ae9c-ef1007d06da9%40googlegroups.com.

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

Where does the following go?
I’ve added custom field of float type to delivery note and added the following to custom script on delivery note. However it shows total as 0.

cur_frm.cscript.custom_validate = function() {
var sum = 0;
$.each(cur_frm.doc.delivery_note_details, function(i, d) { sum += d.qty });

cur_frm.set_value(“total_qty”, sum);
}

frappe.ui.form.on(“Delivery Note Item”, “qty”, function(frm, cdt, cdn) {
// code for calculate total and set on parent field.
total_qty = 0;
$.each(frm.doc.items || [], function(i, d) {
total_qty += flt(d.qty);
});
frm.set_value(“total_quantity”, total_qty);
});