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

When I saw invoice numbering i have on mind, this isnt good for my. But I have solution for users with <10000 invoices maybe more. open: include/sql_queries.php and paste this code on the end:

function lastInvoiceYearItem($type_id="2",$format="y",$inv_length="3") {
$year_newid = $$format).sprintf("%0".$inv_length."d","0");
$sql = "SELECT count(`date`) AS count FROM `".TB_PREFIX."invoices` WHERE YEAR(`date`) = YEAR(CURDATE()) AND `type_id` = '".$type_id."'";
$lastinyear = dbQuery($sql);
$lastinyear_num = $lastinyear->fetch();
$year_id = $lastinyear_num["count"]+1;
$year_newid = $$format).sprintf("%0".$inv_length."d",$year_id);
return $year_newid;

Go to line: 1914 and comment the line, next add this:

':index_id', lastInvoiceYearItem(), //':index_id',

after // is commented line

This is all, you can format your invoice numbering. But type ID its in this case only 2, bug is reported!

 | wiki/custom_numbering.txt · Last modified: 2016/10/11 06:15 (external edit)