Invoice Tables in Magento
A Invoice is the actual record for the placed order, which order amount amount is received from customer. we are telling to magento, convert temporary order record to permanent record. We can’t cancel this order unless and until if required. Order is successfully processed by admin (after payment is received from customer), then that order is ready for the creating the invoice record. Admin can create the multiple invoice for that order. As per my understanding of invoice tables, i defined here.
Below will see the table which we used for generate the invoice.
1. sales_flat_invoice
2. sales_flat_invoice_item
3. sales_flat_invoice_grid
4. sales_flat_invoice_comment
Table :1 sales_flat_invoice:
This is the main table for generating the invoice from magento admin. Once Invoice is generated by admin, the permanent record (invoice) will be saved into this table. Multiple invoice is possible in magento. So based on the invoice, this table will be collect the invoice detail of that order. Here, will get order tax amount,shipping amount, etc…
Table :2 sales_flat_invoice_item:
This is next main table for invoice generation. Once invoice is generated for the order, based on the line item here row’s will create with tax, shipping amount etc…. Ex: If 3 line item is present in a order, then 3 rows will create in this table.
Table :3 sales_flat_invoice_grid:
This table is nothing but, it the grid purpose. All the invoice detail (entire website) will available from this table. This table mainly useful when admin check the invoice grid from admin section. Admin -> Sales -> Order -> Invoice . Intead of referring all the tables, admin grid will refer only this table.
Table :4 sales_flat_invoice_comment:
This table is usefull for comment purpose. If any comment is provide when invoice generating time, those detail will be available in this table.