This is not my code... I'm a little weak at C, but a friend sent it in and I thought it would be valuable.
This code will create a Payables Invoice for Web Services, with custom code to handle Multi Companies