· Create two
separate fields in Sales order header.
o
Total Discount in Amount
o
Total Discount %
· The
user can enter either Total discount % or Total discount amount, if the user
has entered the discount %, the total discount amount need to be calculated and
show.
· If
the user has entered the total discount amount, then system need to calculate
the total discount % and show.
· Need
to calculate the total discount after the line discount calculation.
· The
calculated total discount value need to push it to on the Sales total form.
(Standard field).
· Once
it is pushed to standard field (Total discount), the system will take care of
postings.
[ExtensionOf(tableStr(SalesTable))]
internal final class DAX_SalesTable_Extension
{
public void modifiedField(FieldId _fieldId)
{
SalesTable salestable = this;
SalesLine salesline;
next modifiedField(_fieldId);
select sum(LineAmount) from salesline
where salesline.SalesId == salestable.SalesId;
switch(_fieldId)
{
case fieldnum(salestable,DAX_TotalDiscountAmount):
this.DAX_TotalDiscountPercentahe = this.DAX_TotalDiscountAmount/salesLine.LineAmount*100;
break;
case fieldnum(salestable,DAX_TotalDiscountPercentahe):
this.DAX_TotalDiscountAmount = (this.DAX_TotalDiscountPercentahe/100)*salesLine.LineAmount;
break;
default:
}
}
}
No comments:
Post a Comment