How can I calculate the total amount and divide it into installments and manipulate them individuall
Summary:I need to divide the total amount of a transaction into installments and be able to visualize them and manipulate these installments individually, because I need to apply discounts individually to each installment, but I am not able to calculate it so that I can manipulate the amounts, for example if I have a transaction with a total amount of $6000.00, and I need to divide it into 6 installments, but I need to apply a discount only to the first installment.
How can I proceed considering that I am not able to perform this calculation and return the values of the installments in an array that would allow me to apply the discounts individually, the amount of installments that I need to divide the transaction value is defined by a dynamic menu field that returns information from a data table