User authentication is temporarily unavailable. If this situation persists, please inform your Wiki Admin.

Per operator invoice numbers

Add si_biller_index table

Add a new table, si_biller_index, that is similar in function to si_index, just with one index per operator:

CREATE TABLE IF NOT EXISTS `simple_invoices`.`si_biller_index` ( 
    `biller_id` INT(10) NOT NULL , 
    `invoice_number` INT(11) NOT NULL , 
    INDEX `fk_si_biller_index_1` (`biller_id` ASC) , 
    PRIMARY KEY (`biller_id`) , 
    CONSTRAINT `fk_si_biller_index_1` 
    FOREIGN KEY (`biller_id` ) REFERENCES `simple_invoices`.`si_biller` (`id` ) ON DELETE CASCADE ON UPDATE CASCADE

Change SQL to use the new table

Have si_biller_index updated in much the same way as for si_index (in sql_queries.php) when a new invoice is created and add a new column, invoice_number, to si_invoices where this per operator index is inserted.

Show invoice number in UI

Then make sure that the invoice_number is shown in the manage view of the invoices module and also that it is used in the default template for printing.


Patch for this functionality (here in combination with template_for_f60_invoice_form) can be found here.

Improvements/possible integration

  • One could extend si_index in such a way that it could be used as the si_biller_index shown above.
  • Then one could have a boolean column for the biller saying if the invoice number series should be independent for this given biller.
 | wiki/per_operator_invoice_numbers.txt · Last modified: 2016/10/11 06:15 (external edit)