General approach to going from Estimate->Invoice

I’m still pretty new at Servoy, and am having trouble conceptualizing the best way to go about programming the progress from Estimate to Invoice in my system. Assume the simple route that I have an estimate with a number of line items. I want to create an invoice, init some data on the invoice then loop over the estimate’s line items creating matching line items (based on some criteria) on the Invoice.

I’m having a bit of trouble seeing the best way to do this without a lot of jumping around between forms and creating a number of methods on different forms. Could someone outline the simplest approach to a problem like this for me?

Thanks, greg.

Maybe you can start having a look to the foundset functions: they are quick and smart.
From a single method you can easily work with the functions and foundsets of other forms of your application.

Something like this:

for ( var i = 1 ; i <= foundset.getSize() ; i++ )
{
	var record = foundset.getRecord(i)
	record.field = new_value;
}

or on a related table:

for ( var i = 1 ; i <= a_to_b.getSize() ; i++ )
{
	var record = a_to_b.getRecord(i)
	record.field = new_value;
}

or on another form

for ( var i = 1 ; i <= forms.otherform.foundset.getSize() ; i++ )
{
	var record = forms.otherform.foundset.getRecord(index)
	record.field = new_value;
}

Hope it helps, ciao

You might want to try a status based approach. For example the estimate becomes an invoice when a estimate completion date is entered. I use this approach to populate work queues from receiving, estimation, approval, final inspevtion, shipping, invoicing etc.

the status is then used to control methods, elements, forms, editability, subforms, etc…

hope this helps