How do I change discount amount in Sales Invoice using GP Web Services?

How do I change discount amount in Sales Invoice using GP Web Services?

This question is answered

What is the correct Dynamics GP Web Services syntax to apply a Discount Percentage, set Freight Charge and set Drop-Ship Fee to a Sales Invoice?

Verified Answer
  • I'll give you the trade discount code because that can be a little tricky because it can be a money amount or percent.  I don't know what you mean by drop ship fee and the freight charge is just like setting any other amount.  

                 //here is how to set the trade discount amount

               //TradeDiscountAmount = new MoneyAmount();

               //TradeDiscountAmount.Value = 1.00M;

               //TradeDiscountAmount.DecimalDigits = 2;

               //TradeDiscountAmount.Currency = "USD";

               //TradeDiscount.Item = (MoneyAmount)TradeDiscountAmount;

               //here is how to set the trade discount percent

               TradeDiscountPercent = new Percent();

               TradeDiscountPercent.Value = .01M;

               TradeDiscount.Item = (Percent)TradeDiscountPercent;

               salesInvoice.TradeDiscount = TradeDiscount;

All Replies
  • I'll give you the trade discount code because that can be a little tricky because it can be a money amount or percent.  I don't know what you mean by drop ship fee and the freight charge is just like setting any other amount.  

                 //here is how to set the trade discount amount

               //TradeDiscountAmount = new MoneyAmount();

               //TradeDiscountAmount.Value = 1.00M;

               //TradeDiscountAmount.DecimalDigits = 2;

               //TradeDiscountAmount.Currency = "USD";

               //TradeDiscount.Item = (MoneyAmount)TradeDiscountAmount;

               //here is how to set the trade discount percent

               TradeDiscountPercent = new Percent();

               TradeDiscountPercent.Value = .01M;

               TradeDiscount.Item = (Percent)TradeDiscountPercent;

               salesInvoice.TradeDiscount = TradeDiscount;

  • Thanks Dave!  Some followup questions:

    1) What does "M" stand for in .01M ?

    2) In your second to the last row code above, where and how to we define "TradeDiscount.Item" ?

    Thanks,

    Rajat

  • Hi Dave,

    Wanted to circle back to you - sorry for the delay.  

    You suggestion worked.  Thanks for your help.

    Regards, Rajat