It's not clear from your code what you mean.
the number of lines in the invoice increased or decreased as needed. For example, if the invoice consists of one product, then leave three lines of 20 products, leave 23 lines. the content of the invoice changed from the number of product lines. last time you helped me a lot