Scenario : Discount for Return order for Selected SalesOrder in ax 2012 r3
Hi guys recently I got
requirement on “Discount for Return order for Selected SalesOrder “
Actually as per Functionality while doing Return Order for Selected SalesOrder(i.e if Original SalesOrder is having some discpercent),here in return order line if you change qty the Original "DiscPercent" of that selected SalesOrder will not effect here So to effect " Discount for Return order" i had written following code
Note: This Code Will Effect only if you change qty on Return Order line for selected SalesOrder
Now go to
Returntable Form >> SalesLine DataSource>>ExpectedRetQty Field>>Modified()
void
modified()
{
SalesLine
salesline1;
// Find Original Salesorder's InventTransId by using InventTransIdReturn
// Find Original Salesorder's
salesline1 =
SalesLine::findInventTransId(SalesLine.InventTransIdReturn);
super();
interCompanyIsPriceDiscSearchNeeded = salesLine.RecId;
if (mcrCallCenterEnabled)
{
element.mcrSetLineControls();
}
//here original Salesorder linepercent will get by above finding Inventransid by using that we can do percent calculation as below
// here Salesline1 is the Original SalesOrder Recid
//here original Salesorder linepercent will get by above finding Inventransid by using that we can do percent calculation as below
// here Salesline1 is the Original SalesOrder Recid
if (salesline1.LinePercent)
{
salesline.LineAmount =
(salesline.SalesPrice -(salesline.SalesPrice*(salesline1.LinePercent/100)))*salesline.ExpectedRetQty;
salesline.LinePercent= salesline1.LinePercent;
salesline.LinePercent= salesline1.LinePercent;
}
else
{
if
(salesline1.LineDisc)
{
salesline.LineAmount = (salesline.SalesPrice - salesline1.LineDisc) *
salesline.ExpectedRetQty;
salesline.LineDisc = salesline1.LineDisc;
salesline.LineDisc = salesline1.LineDisc;
}
else
{
salesline.LineAmount = salesline.SalesPrice * salesline.ExpectedRetQty;
}
}
}
No comments:
Post a Comment