Different Invoice type / reference number

Hi all again!
I have a new problem with implementation specific to my country (Argentina)
Our fiscal regulations indicate that we should make diferent kind of invoices (even the invoice form and serial number are different) in case of invoicing to a particular kind of customer.
These special customers are mainly goverment divisions or institutions free of some taxes…
So the main invoice type is called Invoice type “A” and the other is called Invoice type “B”
Problem is that dolibarr asumes that invoices are just one sequence of serial numbers (Dolibarr is much more logic than our regulations, I know)
How do i have to deal with this? I have thinking about modifying but is totally out of my knowledge, maybe some fresh aproach from someone else gives me a workaround with the software unmodified.
Many thanks in advance for any help or idea!
regards
Ale.

This is what i can do to fix your pb:
If kind of invoice depends on third party type, it is possible to add the type in the dictionnary (menu setup->other->Company types.
Then i can add a feature to include the code of the company type inside the invoice numbering mask (for the moment we can add the date, a sequential number and customer code, but i can add the company type code). This means you will have to fill the information company type for each third party.
You will get like that for a company type “STANDARD” for example
IN000y-091231-STANDARD
if you use a mask IN{0000}-{yy}{mm}{dd}-{type}
and for a company type “GOV” you will have
IN000x-091231-GOV
where x and y are two different counters.

Of course, you could choose your mask.
Does this solution will solve your problem.
We are very aware of having a solution that works for everybody so you’re feedback is very important for us.
also, i move the post in “argentina” forum.

Many thanks for the answer!!!
I think it will work, seems perfect!..yes I think it could be enough!

In that case my mask could be IN{type}-{0000}-{mm}{yy}
and “type” could be “A” “B” “C” “M” (the letters used here to identify the type of invoice) where each “type” has it’s own counter ?
Hope this could be usefull as feedback.
regards
Ale

I made the change. To test it, this is what you must do:
* Use last CVS version
* Download the file mercure2.php and put it into path htdocs/includes/modules/facture/mercure2/mercure2.php
* Then go on the invoice setup and choose the mask
IN{tttt}-{0000}-{mm}{yy}

With as many t than characters you want for the company type.
Value for tttt is the code (without TE_) you can find in the home -> setup -> dictionnary -> company types
* The tell me if it works.

mercure2.zip (4.78 KB)

will it work on 2.6?
meanwhile
many thanks for your help,
I’ll post if it works as soon as I test it.
I’m moving to new hardware the whole server this weekend, so the cvs installatio will be the first thing in todo list on monday!
Thanks again Eldy

No sorry it can’t work with 2.6 but 2.7 will be release in few days now…

It works OK!
I moved to my new server…
I have two dolibarr installation
one for test purposes(2.7) an the other with real data (2.6)
I installed as you said and got it working.

Thank you very much Eldy!

after intalling and using this new module, I realize that in fact what determines the type (letter tag) of invoice could be “tva_assuj” value 1 or 0 from llx_societe table. (this would be enough) but as you have solved… it also works and can be used more generically
I will examine your module and see if I can understand, and I could make another one for linking this tva_assuj with invoice mask.

mercy beaucoup! (?)
Ale

Even if discriminant is tva_assuj and not the type, you cansolve this with the type. Go on the dictionnary and create two different types (one for tva_assuj=0 and one for tva_assuj=1, and the you can use the type).
Also if there is other thing to do to be “argentina” compliant.
It is very difficult to open a new market because when product is not ready user try and forget even if it’s not difficult to change things.
Once software is ready, there is a lot of new real users and the feedback welcome easily but the most difficult is to get “first feedbacks” for new countries. And we can’t know what are things to change because there is no argentinian developers in core team for the moment, so your feedback is very important for us.

OK , as you said this is what I’ve done:
I’ve created 3 main types: A, B and C,
these are the main types we would use here.
so each time you create a customer you assign a type, and so the invoice type series and numbering format.
Is working very well… and is enough for aour regulations.
Many thanks Eldy again , and count on me for feedbacking! sure I’ll ask for help many times again.
I’m deploying Dolibarr for my Small Enterprise, and looks really very good.
I think Dolibarr is almost 100% argentina compliant! at least for general product and service companies. (and I’m advicing friends and collegues to give it a try)
Just very few details that I hope could be able to help and feedback on.
I could help to develop Dollibarr but my programming knowledge is very limited, just an advanced user(?)very little php and mysql.
But if necessary I could collaborate translating or checking translations.(mainly “neutral” Spanish and “Local” Spanish)
Regards
Alejandro

Thanks.
So i will include this change into official 2.8 version.

Eldy:
Just one more question on this…
Ho do I change the counter to start at a certain invoice number.
this is because we have mass imported invoices up to now, and when I changed the mask type I have first invoice number 00001
I whould like to change the counter just one time to start from invoice
F{t}002621 for example or another number for the other type.
can I change a table value in database?
never mind if past invoices are with obsolete mask, We will start now with the right number and type.
Thanks a lot in advance.
Alejandro

When you define the new mask, try to use
{0000+123}
instead of
{0000}
This will start counter to 123

Many thanks again Eldy

Hi Eldy, It’s me again on this subject:
Something isn’t working ok now
my mask is: F{t}-{00000+269}
and my facture number result is: FA1001-0070…
And even when customer type is defined as C or B invoice keeps as FADDMM-0071 same type and next serial # (not different type and numbering as expected)
Maybe I do not fully tested it as it seemed to me to be working at first glance…
I’m not sure if the test where made on 2.6 and now when using 2.7… things doesn’t work.
or maybe I changed something with 2.7 installation, but I have checked it and do not find any wrong file version.
I will try to reinstall from the very beggining but it could be very helpful if anyone could reproduce the error or not.
I’ll keep trying changin masks to see what happens and i’ll check mercure 2 module to see if I could understand where is the fault. but as always any help could save me a lot of time.
Regards
Alejandro

Check in your invoice module setup that the “default” module (with green tick) is mercure and not terre.

Ok i’ll do it and report back here

It’s ok
the module is configured as mercure2
should I replace mercure files by mercure2 ones?
it is not working here
i’ll upgrade my test installation to 2.8 and chek it again
meanwhile the production installation gives me wrong invoice number
(editable by phpmyadmin)

mercure2 was a test i think. You should be able to do what you want with “mercure” in 2.8

Alejandro,
remember that the letter (A/B/C) is taken from the Type Code. Try with {tttt} and you will see the effect. The same happens to my at the beginning. I created 3 codes: TE_A, TE_B, and TE_C, and works PERFECT.

Regards
Victor
Buenos Aires
Argentina

Alejandro pudiste solucionar el tema de la discriminacion entre factuas A y B?

Saludos
Catriel