At the moment, when terminating a billing schedule line with refund (Credit option = issue credit) always all invoiced periods will be credited. Also, the created sales order with the revised line always uses the quantity of the billing schedule line, not the total quantity of all invoiced periods.
When terminating a billing schedule line with refund, make it selectable whether all periods or only one or some of them should be credited.
When terminatiing a billing schedule line with refund and crediting all invoiced periods use the total quantity in the revised sales order to make it more clear for the user and also to accord the credited quantity to the invoiced quantity. When implementing the 1st suggestion, of course also implement to use the correct quantity of the periods to be credited and not just the line quantity.