Here is a quick and easy way to create order invoice programmatically.
Suppose, $_order contains your order.
Here goes the code to create invoice:-
* Create invoice
* The invoice will be in 'Pending' state
$invoiceId = Mage::getModel('sales/order_invoice_api')
$invoice = Mage::getModel(‘sales/order_invoice’)
* Pay invoice
* i.e. the invoice state is now changed to ‘Paid’
That’s all. Your invoice for the order is created. Isn’t that easy