[Solved] Assign invoice number when opening Writer template

Writing a book, Automating Document Production - Discuss your special needs here
Post Reply
alphonsobellinni
Posts: 2
Joined: Wed Feb 22, 2023 9:47 pm

[Solved] Assign invoice number when opening Writer template

Post by alphonsobellinni »

Setting up invoices. Would like to have invoice numbers automatically entered when opening template.

Also would like to be able to print two copies of invoices, one in color, one black and white.

Don't know what to look for.

 Edit: Changed subject, was Invoice numbering 
Make your post understandable by others 
-- MrProgrammer, forum moderator 
Last edited by MrProgrammer on Wed May 03, 2023 10:56 pm, edited 2 times in total.
Reason: Tagged ✓ [Solved] provided link to invoice example in Base -- MrProgrammer, forum moderator
openoffice 4.1.6 on Windows 10 pro
User avatar
Zizi64
Volunteer
Posts: 11372
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Invoice numbering

Post by Zizi64 »

Setting up invoices. Would like to have invoice numbers automatically entered when opening template.

Also would like to be able to print two copies of invoices, one in color, one black and white.

Don't know what to look for.
One of the posible solutions: the Macros.

You must store the last VALID invoice number somewhere: Into a txt file, into a database, or into the invoice template itself (for example in the Custom Document Properties). You can get it by a macro and you can increase it by one. You must use real numeric value, or you must convert it to numeric value for the time of the increasing, if it were a string like "invoice number", like "Inv001".

When the invoice number becomes valid? I am sure not at the opening the invoice template, but (I suppose it) after you completed it and printed the desired copies.

I suppose it you can control the print procedure by macro to print a B&W and a color copy of the actual invoice (I have not any clue why you need it.)
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
alphonsobellinni
Posts: 2
Joined: Wed Feb 22, 2023 9:47 pm

Re: Invoice numbering

Post by alphonsobellinni »

Thank you for the reply. I will try to make a macro. May be a few days before I have time to mess with it.

Reason for printing invoices in color and black & white: color copy for customer, black & white for our records.
openoffice 4.1.6 on Windows 10 pro
John_Ha
Volunteer
Posts: 9584
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

Re: Invoice numbering

Post by John_Ha »

Use mail merge from a spreadsheet where the number is incremented??
LO 6.4.4.2, Windows 10 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
User avatar
MrProgrammer
Moderator
Posts: 4920
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA

Re: Invoice numbering

Post by MrProgrammer »

Hi, and welcome to the forum.
alphonsobellinni wrote: Wed Feb 22, 2023 10:16 pm Setting up invoices
You might want to consider doing this with a package which performs invoicing, rather than creating this yourself. Find packages via a web search. Here is one recent review from a respected publisher. You'll find many others.
Best Invoicing And Billing Software (February 2023)

Some of those are free; some aren't. But software you pay for may provide more value than its cost. For example, it may allow you to accept electronic payments for invoices, which would be difficult and risky to implement yourself, and the ability to pay electronically may attract additional customers. Only you can select the one which best meets your requirements.

alphonsobellinni wrote: Wed Feb 22, 2023 10:16 pm Would like to have invoice numbers automatically entered when opening template.
Writer has no place to store or retrieve the last-used invoice number so that a template can display the next one. You would need to develop a macro system to add that capability. These are often complex. Expect to spend a week or more creating your first macro, more if you're not already a programmer. You could search the forum to see if anyone has already done this. The obvious search term would be invoice.

However, a database will assign numbers automatically when the data is entered on the form which you've created for your invoice. The data will be stored in database tables. You will access it using Base where you can create queries to select data from the tables then filter, summarize, sort, and/or group it. Base can generate reports from the queries using a layout which you specify. I think the layout could include a header with a logo. A database solution will be superior to anything which you would improvise in Writer or Calc, and probably won't require any macros.
[Example] Invoice Forms (without macros)
Board index » Getting started » Tutorials » Base

alphonsobellinni wrote: Wed Feb 22, 2023 10:16 pm Also would like to be able to print two copies of invoices, one in color, one black and white.
Many color printers supply a dialog where one can choose between color or black and white. I don't know if it's possible for a database report to create one copy in color and one in black and white.

If this solved your problem please go to your first post use the Edit button and add [Solved] to the start of the Subject field. Select the green checkmark icon at the same time.
Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.6.3, iMac Intel.   The locale for any menus or Calc formulas in my posts is English (USA).
Mountaineer
Posts: 318
Joined: Sun Sep 06, 2020 8:27 am

Re: Invoice numbering

Post by Mountaineer »

MrProgrammer wrote: Thu Feb 23, 2023 6:54 pm ...
I don't know if it's possible for a database report to create one copy in color and one in black and white.
The easier approach is to repeat the report.
I created two solutions over the years.
One is a macro in a Calc-Sheet, wich saves as pdf, then prints 2-3 times and changing background colour of the cells between prints (only on right side to save ink).
Second is an external script using pdfTK to overlay the current pdf with several background pages.
Considering Base I would either use my second approach or just copy the report, change colour in the second and print one after the other by macro. (Basics are available in the Guide to Base, i use this for other reports)

Both systems used to replace traditional dot-matrix printers printing on layers of sheets.

In our traditional process the first "original" was sent out by mail, the second was archived, the third had to be signed by the person who handled the transport to document this. Now we usually work only with pdf and even customs declarations don't need actual printouts, but for different types of shippers "sign the yellow copy" for the goods you take just works with every shipper.
OpenOffice 3.1 on Windows Vista
John_Ha
Volunteer
Posts: 9584
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

Re: Invoice numbering

Post by John_Ha »

Print two mono copies, the customer one onto a pre-printed sheet with your coloured logo etc in drawer 1; and your one onto plain paper in drawer 2.
LO 6.4.4.2, Windows 10 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
Post Reply