Add Delivery Qty to Sales Invoice From Delivery Note, Misc fixes

Fixes #2164 and #1548