Depending upon your setup in Dynamics AX 2012, you may find that discounts entered on a purchase line do not seem to be included in the inventory cost transactions, even after the line is invoiced. There is a note about it in this article, but it may not be clear how the issue manifests.
If no account is set up, the discount is not recorded directly in the ledger account. Instead, the discount is deducted from the revenue or cost value.
The problem is the account setup on the Item Group. See the screenshot below. Having the expense account set up here is causing the discount to post to that account rather than being deducted from cost. Removing the 58000 account allows the discount to post to cost.