Total Item quantity in sales order and purchase rder

In sales order and purchase order we only get total amount but not total quantity . In a previous post I have seen that I need to add script in sales_common.js to display total quantity . Is there any easy way to display total item quantity or anyone can help me with a sample code ?