Topic: Duplicated Invoice Numbers if 2 users generating invoices at same time

I understand that in Forms Set Up, if you set a number format for Next Reference, each time when you generate a new document, let's say an invoice, the Invoice Number will increase by 1 the next time.

However, we are facing the issue that we often have the situation that more than 1 user are trying to generate invoices at the same time. All users get the same assigned invoice number. And then the first user finishes the generation process earlier and his invoice can be confirmed with that invoice number. And when the second user finishes the process, he will get alerted that 'your invoice number has already been used'

This is causing us issue so we can use sequential number.

Is it possible to avoid this? Thank you.

Re: Duplicated Invoice Numbers if 2 users generating invoices at same time

@joe: Can the Next Reference be just tentative on the form and on acceptance of submission can it not display the actual reference assigned?

Re: Duplicated Invoice Numbers if 2 users generating invoices at same time

Well, i would agree that the numbers should be updated automatically, but we have discussed this internally, and there were other problems involved here. I will let Janusz comment on this.

Joe

Re: Duplicated Invoice Numbers if 2 users generating invoices at same time

If the problem appears in FA 2.3.* you can increment the number and try save document again. In 2.4 you can define reference number template which will use separate identifier for every user, so effectively every user have its own numbering line.
Janusz

Re: Duplicated Invoice Numbers if 2 users generating invoices at same time

Please list this feature on FA 2.4 release.

6 (edited by assifsaleem 01/03/2019 02:55:23 pm)

Re: Duplicated Invoice Numbers if 2 users generating invoices at same time

UPGRADE TO 2.4.6 ISSUE MAY BE RESOLVED.

Re: Duplicated Invoice Numbers if 2 users generating invoices at same time

@itronics: An example of "separate identifier for every user" would be useful. Otherwise, all would have to wade thru the code for it. This may be explained in the Wiki. The following lists the possibilities.

Lines 55-66 in includes/references.inc:

$refline_placeholders = array(
    'MM' => 'date',
    'YY' => 'date',
    'YYYY' => 'date',
    'UU' => 'user',
     'P' => 'pos',
//     FIXME:  for placeholders below all the code should work, but as the ref length is variable,
//       length specification in placeholder format should be implemented.
//    'C' => 'customer',
//    'B' => 'branch',
//    'S' => 'supplier',
//    'L' => 'location'

Lines 302-332:

        $regex = preg_replace(
            array(
                '/\\\{/',    // unquote placeholders
                '/\\\}/',
                '/\{MM\}/',
                '/\{YY\}/',
                '/\{YYYY\}/',
                '/\{C\}/',
                '/\{B\}/',
                '/\{S\}/',
                '/\{L\}/',
                '/\{UU\}/',
                 '/\{P\}/',
                '/\{\d+}/',
            ),
            array(
                '{',
                '}',
                $month,
                $year2,
                $year4,
                $cust,
                $branch,
                $supp,
                $location,
                $user,
                 $pos,
                '\d+',
            ), $regex);

        $regex = '"^'.$regex.'"i';

Re: Duplicated Invoice Numbers if 2 users generating invoices at same time

Dear Sir..
I am facing this problem now in 2.4.6 and i have tried many option in the software Transaction References menu
Could you please guided me in how can i activate this feature ?

9 (edited by poncho1234 02/22/2019 09:05:35 pm)

Re: Duplicated Invoice Numbers if 2 users generating invoices at same time

Hi, please read post 4 above, which means you need to use {UU} in your transaction reference. So each ref will be unique.

The wiki entry is mentioned in post 7 above too, which also states to use this method.

Re: Duplicated Invoice Numbers if 2 users generating invoices at same time

Dear Ponocho
I appreciate your feedback ...but my question is how can i use {UU} ...is it some thing that i have to change in the
references.inc file or just some modification in Transaction References menu ?

Re: Duplicated Invoice Numbers if 2 users generating invoices at same time

Setup => Transaction References => Edit the "Pattern" field to include {UU} somewhere in it so that each user will have their own numbering.

Re: Duplicated Invoice Numbers if 2 users generating invoices at same time

Dear Apmuthu
So thanks for help
I tried to include that in transaction reference but i get this error
Missing numeric placeholder. If you want to use template based references, you have to define numeric placeholder too.

Re: Duplicated Invoice Numbers if 2 users generating invoices at same time

Dear Apmuthu
So thanks
It works now
I appreciate your guide

Re: Duplicated Invoice Numbers if 2 users generating invoices at same time

i am trying to use the Prefix with each specific area for our branches ...i.e JED , RYD
Is it possible to make the Prefix comes automatically without user selection when they issues the transaction ..?

Re: Duplicated Invoice Numbers if 2 users generating invoices at same time

At the beginning of Reference Pattern: you will see another box, you can add a preffix in there.
If you have already used the transaction ref, you may not be able to edit the prefix, so in this case make a new transaction reference

Re: Duplicated Invoice Numbers if 2 users generating invoices at same time

Dear Poncho
So thanks
But my question is: Is it possible to use the Prefix automatically without user selection ...I specify many prefix for the same sales invoice as example ...i e RYD and JED ...but the problem is the user has to select between these prefix ...
Is it possible to make this prefix automatic comes with each user without his selection ?
Or is there any way that i can link the user with specific Prefix ?

17 (edited by poncho1234 02/24/2019 05:10:15 pm)

Re: Duplicated Invoice Numbers if 2 users generating invoices at same time

You may be able to useeither:-
1. {L} - Location, you will have to define each country as a location and sell from that location
Or
2.
{P} - pos - Point Of Sale, each pos needs to be defined in setup against a location, which does come back to option 1.

In both casesyou will probably get just a number (of the location or pos), but you and your users will know what number each country is.

Please try on your training company first and report back for completeness.

Edit: I've had a quick look, it appears that pos can only be assigned to each user, which leaves just option 1.

Re: Duplicated Invoice Numbers if 2 users generating invoices at same time

Dear Poncho
I really appreciate your time for help ...
I create new inventory location ...and also tried with point of sale and even i create new sales areas ...
the problem is how can i link this with the reference number ?

19 (edited by poncho1234 02/24/2019 05:15:34 pm)

Re: Duplicated Invoice Numbers if 2 users generating invoices at same time

???? Along side the {UU} add a {L} you can separate them with a '-' or a '/' if you want.

So some examples:-

{YY}/{MM}-{001} exactly as it is written with curly brackets and YY & MM. example gives 19/02-001

{YY}{MM}-{001} exactly as it is written with curly brackets gives 1902-001

{YYYY}/{MM}-{UU}/{L}-{001} exactly as it is written with curly brackets gives 2019/02-07/4-001 where 07 = user number and 4 = location number

{YY}/{MM}/{UU}/{L}/{A001} exactly as it is written with curly brackets gives 19/02/07/4/A001 where 07 = user number and 4 = location number

{YYYY}/{MM}-{UU}-{001} exactly as it is written with curly brackets gives 2019/02-07-001 where 07 = user number

{YY}/{MM}/{UU}/{A001} exactly as it is written with curly brackets gives 19/02/07/A001 where 07 = user number

You can add or remove placeholders as you want... as per this this wiki page see the code block following 'Supported special fields for each transaction type: '

Experiment on your trial company

When you sell an item you have an option to sell from a location which you can select, this is the location that will used in the ref #

You can read about locations here.

Re: Duplicated Invoice Numbers if 2 users generating invoices at same time

It display this error:
Invalid placeholder 'L'. Placeholders allowed for this transaction type are: MM,YY,YYYY,UU,P.
i try it at sales invoice

21 (edited by poncho1234 02/24/2019 05:17:10 pm)

Re: Duplicated Invoice Numbers if 2 users generating invoices at same time

Read post 7 above:-

you need to uncomment:-


File:includes\references.inc
63: //    'C' => 'customer',
64: //    'B' => 'branch',
65: //    'S' => 'supplier',
66: //    'L' => 'location'


So that it reads as this:-

File:includes\references.inc
63:     'C' => 'customer',
64:     'B' => 'branch',
65:     'S' => 'supplier',
66:     'L' => 'location'


This is not currently implemented

22 (edited by poncho1234 02/24/2019 05:05:25 pm)

Re: Duplicated Invoice Numbers if 2 users generating invoices at same time

I have given you some wrong information, it looks like {L} cannot be used in a sales order, if you look at File:includes\references.inc lines 27 - 52 it states which placeholders can be used in which transaction type.
Which leaves using pos; but for pos to work using location each user would have to be assigned a pos and therefore location. Which means you would need multiple log-ins per user which is not really practicable.

Edit it also seems that the following is not fully implemented yet:-

File:includes\references.inc
63: //    'C' => 'customer',
64: //    'B' => 'branch',
65: //    'S' => 'supplier',
66: //    'L' => 'location'

So please comment those lines again and remove any used from transaction refs

There is more info in this wiki page This pages will inform you of what place holders can be used in which transaction type.

My own testing results in the following:-

{C} works in sales direct invoice but only after page refresh

{B} in sales direct invoice gives a warning 'Missing refline context data: 'branch'' and gives a 'B' in ref #
{S} & {L} in supplier invoice gives a warning ''Missing refline context data: 'supplier'/ 'location' and gives a 'S'/'L' in ref #

Re: Duplicated Invoice Numbers if 2 users generating invoices at same time

poncho1234 wrote:

{C} works in sales direct invoice but only after page refresh

Attempts to set reference {C} gives me the error
Invalid placeholder 'C'. Placeholders allowed for this transaction type are: MM,YY,YYYY,UU,P.

Re: Duplicated Invoice Numbers if 2 users generating invoices at same time

Yes that would be correct:-

C, B, S and L are still to be implemented as stated in post 22