Cash Discounts not clearing during lockbox posting process

When the lockbox process is being completed, we are finding customer’s cash discount is just showing as a short payment vs. being coded off to the cash discount account. For example, customer’s invoice is $100 and they are paying $98 (within the discount period - so it is valid) and the $2 not paid is not clearing off the invoice during the lockbox process and when the batch is posted the balance remains open on the invoice. When you review this in Invoice Tracker or Customer Tracker the $2 remains. We need guidance on how to have the $2 clear when the batch is posted.