Microsoft Dynamics Job Openings


Microsoft Dynamics Forums Homepage

Forum Home Forum Home > Microsoft Dynamics RMS & Microsoft Dynamics POS > POS
  New Posts New Posts RSS Feed - Add discount line programmatically to sale line
  FAQ FAQ  Forum Search   Register Register  Login Login


Add discount line programmatically to sale line

 Post Reply Post Reply
Author
Message
B.A View Drop Down
MicrosoftDynamicsForums.com Member
MicrosoftDynamicsForums.com Member


Joined: September 19 2016
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote B.A Quote  Post ReplyReply Direct Link To This Post Topic: Add discount line programmatically to sale line
    Posted: September 19 2016 at 1:12am
Good day.
i am hoping that someone could possibly help me.
i am trying to programmatically add a discount line to a saleline item.

i am needing to loop through the current lines on the transaction and conditionally add a discount to lines that meet certain criteria.

this is the code i have so far:

 LSRetailPosis.Transaction.RetailTransaction retailTrans = posTransaction as LSRetailPosis.Transaction.RetailTransaction;

                        if ((TypeOfTransaction)retailTrans.TransactionType == TypeOfTransaction.Sales)
                        {
                            foreach (var val in retailTrans.SaleItems)
                            {
                               
                               LSRetailPosis.Transaction.Line.Discount.LineDiscountItem disc = new LSRetailPosis.Transaction.Line.Discount.LineDiscountItem();
                               
                               
                               
                                disc.Percentage = 10;
                                // this is where i am getting stuck, i am not sure how i should add the discount ite to the existing line
                                val.DiscountLines.AddAfter

                               
                                val.Comment = "test Discount";

                                val.CalculateLine();


                            }
                        }

any help would be appreciated
Back to Top
Sponsored Links


Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down


Copyright 2013 microsoftdynamicsforums.com. All rights reserved. MicrosoftDynamicsForums.com is an independent non-Microsoft website.
Email: contact AT microsoftdynamicsforums DOT com