If you want to act on the field level, use the Translation Formula and do your regular @IF(fieldname<0;fieldname;-fieldname) thing.
If you want to act at the view level, just use the same formula in the column where you show Qty for the take-out form, but control that the form is right :
Code:
@if(fieldname>0 & Form="OrderInventory";-fieldname;fieldname)
As for the invoice number, you can generate any random number in a number of ways. Somehow, I have the feeling that you want a sequential number. Not only that, but a sequential number that is globally unique and does not depend on who creates the invoice. Ouch. That is not a good idea for a number of reasons, the first being that Notes has never been developed around the database notion. Notes is not a relational database system, and sequential numbering is the very first trademark of a relation db.
You can create a sequential numbering system for individual users easily. Make a profile document for the user with the current number, and increment by one at each access by that user. You can even include some more code to make it a yearly counter. That is easy.
But making a sequential numbering system that will give one unique number that does not depend on the user is not guaranteed.
Oh of course, you can devise a global profile doc that contains the current number, include some collision-detection code to prevent two users from opening it simultaneously, and ensure that your code specifies that only one user can update it at a time. You can try, and you might even succeed - for a while. Unfortunately, the Domino engine was not built around that idea. That idea belongs to relational systems and, once again, Notes is not relational.
You could also try this in several different ways, but the end result is always the same : in Notes you are never 100% sure that your construct for a sequential number is viable. You will, one day, get a double. How you deal with that is something you'll have to decide when it happens.
As far as I'm concerned, Notes is not the right system to build sequential-number applications on. So, if you really need sequential, global numbers, have Notes ask an Oracle database for one. It's the only way you'll be sure.
Pascal.