If, before a judgment is given, the amount then due, with the costs of action, is brought into court and paid to the clerk, the action shall be dismissed, and, if the same be done after judgment and before sale, the effect of the judgment as to the amount then due and paid shall be terminated and the execution, if any have issued, be recalled by the clerk. When an installment not due is adjudged to be paid, the court shall determine and specify in the judgment what sum shall be received in satisfaction thereof, which sum may be equal to the installment or otherwise, according to the present value thereof.