Lines of Invoice
-
Hi I have two Classes: Invoice and LineOfInvoice. In class LineOfInvoice I have a field named "line_number". My question is: in a datagrid the user removes line 3 of the invoice. What is the best way to update the line number field of invoice after third line (witch was removed). Line 4 becomes line 3, line 5 becomes line 4, ... Remove all lines and insert all lines again with the right numbering from datagrid? update only de rows after the line removed? Thanks!
-
Hi I have two Classes: Invoice and LineOfInvoice. In class LineOfInvoice I have a field named "line_number". My question is: in a datagrid the user removes line 3 of the invoice. What is the best way to update the line number field of invoice after third line (witch was removed). Line 4 becomes line 3, line 5 becomes line 4, ... Remove all lines and insert all lines again with the right numbering from datagrid? update only de rows after the line removed? Thanks!
I did something similar to this a while ago. I just updated the lines after the one that was removed with an SQL like this: UPDATE [tableName] SET line = line - 1 WHERE idKey = @idKey AND line > @removedLine Hope it helps! ;) Edbert P. Sydney, Australia.