Quantcast
Channel: Microsoft Dynamics GP
Viewing all articles
Browse latest Browse all 59474

Forum Post: RE: GP Web Services - CreateGLTransaction - GLTransactionLine loop

$
0
0

When you say the "same" amount, I'm going to assume that all of the lines get the values applied to the last line. This would happen because each of the lines is pointing to your "mnyTotal_Amount" object that stores the currency amount for the line. Remember that the MoneyAmount is an object as well. When you use it, you're just pointing to the object. You would need to create new objects of the MoneyAmount type for each transaction line that you're adding. That way, the individual MoneyAmount objects would have their own value and not affect each other.

You don't show the code that creates the MoneyAmount objects. You should just be able to move the statements that look like this:

MoneyAmount mnyTotal_Amount = new MoneyAmount();

MoneyAmount zeroAmount = new MoneyAmount();

....into the loop, so that new MoneyAmount objects are created for each line.

Hope this helps.


Viewing all articles
Browse latest Browse all 59474

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>