Hi
Try this?
1. When you are externally defining the format for quantity field, remove the format specification from the global defeniton (currency/qnty tab).
2. Secondly, in your code, you used char and take the substring like + 0(11). - this may create problem if the value is more and getting truncated. Instead use the variable as P and decimals 2.
Try the option 1 and please update
Regards,Venkat