Page 1 of 1

Extending simple invoicing

Posted: 2013-12-06 15:45
by soltec1
I have setup the simple invoicing and want to pick some of the experts brains here about an extension.

So three tables: client, invoice and invoice_items

How to get a single invoice to display multiple items within the "invoice"

In other words, a single invoice "code" to display many items, within the invoice table itself (the reason is then a csv export is possible per invoice, with all item, item quantity, and item price in separate fields, while at the moment, each item is listed in the invoice items only)

I was thinking lookup fields, or hooks, or i dont really know??

Let me know if i need to explain better. I think im overcomplicating the thing, but any direction help would be awesome !!

Thanks in advance :)

Re: Extending simple invoicing

Posted: 2013-12-06 21:18
by benzoD
Sounds like the best way would be to have lookup fields. Create fields in your invoice table, make them lookup fields pointing to the information in your other tables.

Client: name, email, phone, address
Invoice_items: hours_billed, job_name, job_code, date_of_job, job_notes
Invoice: client_name (lookup->client.name), job_date(lookup->invoice_items.date_of_job), job_description(lookup->invoice_items.job_notes), billed(invoice_items.hours_billed)

Once you've filled in information for the client name, job_notes, etc, in invoice they are filled as pull down menus with the info you've already put in.

Hope this helps.

Re: Extending simple invoicing

Posted: 2013-12-07 02:39
by soltec1
Thanks benzoD,
My db is like this

Client: client_ID, name, email, phone, address
invoice: invoice_id, client_name (lookup->Client.client.name), inv_code, status, due_date, total
Invoice_items: item_id, invoices (lookup-> to invoice.inv_code), item, unit_price, qty, price

At the moment a new record in invoice items is listed under the same inv_code, so thats all fine..but i want EACH item listed in the invoice table, so EACH invoice item, qty, price be listed in the invoice table as a lookup..So if there is 4 items, i want all 4 items listed in separate fileds, invoice: item1, qty1, price1, AND item2, qty2, price2 AND. item3, qty3, price3

you might ask why the need for this,

because then i can import a FULL INVOICE with multiple items as a csv file, into excel, do a mail merge and print out the invoices :)

thanks :)

Re: Extending simple invoicing

Posted: 2013-12-15 23:18
by soltec1
ok basically used mpdf - mpdf1.com to generate the invoices and added a "generate invoice" button code to invoices.php

much better solution than mailmerging.

pdf templating a little tricky but results are instant invoices on the fly, and easy way to add new invoice templates as services increase