I am creating in angular the following, the form of creating an invoice works without problems (search, create, modify and delete) everything is working with their respective teachers of clients, currencies; In addition, an api service was implemented for the project.
Now I have to implement the form of the credit note, although it takes almost all the fields of the invoice, (implement the same search of the invoice number so that from there the rest is generated) the only thing that changes are two calculated fields (Delay and net paid days, are calculated fields, which are taken from two dates of the invoice form).
As I understand the concept of the credit note applied to this case would be to use the field (Amount Invoiced USD, Amount Invoiced) and the form of the credit note the field (Pending Paidment).
Where would be the same amount but negative balance of these 3 fields, but the doubt I have is that not to repeat so much code in the process of credit note were these fields calculated (not to store them in the database? ) I implement them out of the API as a business rule or only in the context of the active form in this case credit note.
Thanks in advance, your valuable help.