The Invoice Number has already been taken.

installed.
all clients created.
all products created.
first invoice with date 1. Januar 2018 - so that the customer can see the history
Invoice number changed manually.
Error “The Invoice Number has already been taken.”
The invoice cannot be sent

What can I do?

the same error for all other entries

Thomas

self hosting | App Version: v4.4.3\nWhite Label: No

Are you using LastPass? If yes, does disabling it help?

unfortunately not

Do the debug information help?

select * from information_schema.tables where table_schema = 'd02a4cc3' and table_name = 'accounts'
1.59ms
d02a4cc3
select * from <code>users</code> where <code>id</code> = '1' and <code>users</code>.<code>deleted_at</code> is null limit 1
320μs
d02a4cc3
select * from <code>accounts</code> where <code>accounts</code>.<code>id</code> = '1' and <code>accounts</code>.<code>deleted_at</code> is null limit 1
360μs
d02a4cc3
select * from <code>companies</code> where <code>companies</code>.<code>id</code> = '1' and <code>companies</code>.<code>deleted_at</code> is null limit 1
140μs
d02a4cc3
select * from <code>languages</code> where <code>languages</code>.<code>id</code> = '3' limit 1
140μs
d02a4cc3
select <code>id</code> from <code>clients</code> where <code>clients</code>.<code>account_id</code> = '1' and <code>public_id</code> = '4' limit 1
230μs
d02a4cc3
select * from <code>invoices</code> where <code>account_id</code> = '1' order by <code>public_id</code> desc limit 1
210μs
d02a4cc3
select * from <code>clients</code> where <code>clients</code>.<code>id</code> = '4' limit 1
190μs
d02a4cc3
select * from <code>invoices</code> where <code>invoices</code>.<code>account_id</code> = '1' and <code>invoice_number</code> = 'RE20180001' limit 1
160μs
d02a4cc3
select * from <code>clients</code> where <code>clients</code>.<code>account_id</code> = '1' and <code>clients</code>.<code>deleted_at</code> is null order by <code>name</code> asc
210μs
d02a4cc3
select * from <code>contacts</code> where <code>contacts</code>.<code>client_id</code> in ('1', '2', '3', '4', '5', '6', '7', '8', '9', '10') and <code>contacts</code>.<code>deleted_at</code> is null
180μs
d02a4cc3
select * from <code>countries</code> where <code>countries</code>.<code>id</code> in ('276')
130μs
d02a4cc3
select * from <code>tax_rates</code> where <code>tax_rates</code>.<code>account_id</code> = '1' and <code>tax_rates</code>.<code>deleted_at</code> is null order by <code>name</code> asc
200μs
d02a4cc3
select * from <code>countries</code> where <code>countries</code>.<code>id</code> in ('276')
80μs
d02a4cc3
select * from <code>products</code> where <code>products</code>.<code>account_id</code> = '1' and <code>products</code>.<code>deleted_at</code> is null order by <code>product_key</code> asc
220μs
d02a4cc3
select * from <code>expenses</code> where <code>id</code> = '0' and <code>expenses</code>.<code>deleted_at</code> is null
170μs
d02a4cc3
select * from <code>timezones</code> where <code>timezones</code>.<code>id</code> = '36' limit 1
230μs
d02a4cc3
select * from <code>date_formats</code> where <code>date_formats</code>.<code>id</code> = '11' limit 1
170μs
d02a4cc3
select * from <code>documents</code> where <code>documents</code>.<code>invoice_id</code> is null and <code>documents</code>.<code>invoice_id</code> is not null order by <code>id</code> asc
200μs
d02a4cc3
select * from <code>expenses</code> where <code>expenses</code>.<code>invoice_id</code> is null and <code>expenses</code>.<code>invoice_id</code> is not null
90μs
d02a4cc3
select * from <code>clients</code> where <code>clients</code>.<code>account_id</code> = '1' and <code>id_number</code> = '0011' limit 1
190μs
d02a4cc3
select * from <code>currencies</code> where <code>currencies</code>.<code>id</code> = '3' limit 1
200μs
d02a4cc3
select * from <code>payment_terms</code> where <code>account_id</code> = '0' and <code>payment_terms</code>.<code>deleted_at</code> is null
150μs
d02a4cc3
select * from <code>payment_terms</code> where <code>payment_terms</code>.<code>account_id</code> = '1' and <code>payment_terms</code>.<code>deleted_at</code> is null
150μs
d02a4cc3
select * from <code>account_gateways</code> where <code>account_gateways</code>.<code>account_id</code> in ('1') and <code>account_gateways</code>.<code>deleted_at</code> is null
170μs
d02a4cc3
select * from <code>gateways</code> where <code>gateways</code>.<code>id</code> = '17' limit 1
160μs
d02a4cc3
select * from <code>gateways</code> where <code>gateways</code>.<code>id</code> = '62' limit 1
160μs
d02a4cc3
select * from <code>activities</code> where <code>account_id</code> = '1' and <code>invoice_id</code> is null and <code>activity_type_id</code> in ('6', '20') order by <code>id</code> desc
170μs
d02a4cc3
select * from <code>account_email_settings</code> where <code>account_email_settings</code>.<code>account_id</code> = '1' and <code>account_email_settings</code>.<code>account_id</code> is not null limit 1
220μs
d02a4cc3
select * from <code>datetime_formats</code> where <code>datetime_formats</code>.<code>id</code> = '11' limit 1
210μs
d02a4cc3
select * from <code>clients</code> where <code>clients</code>.<code>account_id</code> = '1' and <code>id_number</code> = '0011' limit 1
190μs
d02a4cc3
select * from <code>invoices</code> where <code>invoices</code>.<code>account_id</code> = '1' and <code>invoice_number</code> = 'GU-2018-0001' limit 1
240μs
d02a4cc3
select * from <code>accounts</code> where <code>accounts</code>.<code>deleted_at</code> is null limit 1
360μs
d02a4cc3
select * from <code>companies</code> where <code>companies</code>.<code>id</code> = '1' and <code>companies</code>.<code>deleted_at</code> is null limit 1

Does an invoice exist (even if deleted) which uses the number?

You’d need to either purge the client or change the old invoice.

For testing purposes, I deleted all data.

(Note: When exporting, a reference to the English files must be made. Otherwise you have an export with German column headings and cannot import it again.)

Tested via phpmyadmin, which contains the table with the invoices 0 entries.

one client created - same error.

Can it be due to the settings? I’d just erase everything else.

I’m not sure, how did you delete the data?

You may want to try recreating the database.

I have deleted the data about account management and then checked with phpmyadmin.

I will now delete everything, including the account, and then rebuild the portal.

My colleague just said: “The InvoiceNinja test system works.”

Great to hear it’s working!

Oops. How do I start the installation routine. I can’t log in because of account deletion.

If there are no users you should be able to use /setup

???

There is no domain.de/rechnung/setup

Login was domain.de/rechnung/public/login

Did you run any commands after recreating the database?

I reinstalled everything, including ftp and new database.

https://yadi.sk/i/A9R0iMaG3XEpya

https://yadi.sk/i/EF8kAOEP3XEq74

https://yadi.sk/i/NTCYsW8t3XEqB4

https://yadi.sk/i/eyOA_z3p3XEqE7

https://yadi.sk/i/JTamxnP_3XEqJJ

everything is fine

https://yadi.sk/i/niYd1aPO3XEqTm

no. same error. :frowning:

https://yadi.sk/i/NoxQ1Elc3XEqfH

this is the ‘field’

https://yadi.sk/i/W69BxxgI3XEqoS

<input required="" class="form-control" onchange="checkInvoiceNumber()" data-bind="value: invoice_number, valueUpdate: 'afterkeydown'" id="invoice_number" type="text" name="invoice_number">

and this the function

https://yadi.sk/i/g7g_zdLw3XEqvn

function checkInvoiceNumber() {
    var url = 'https://familienfreun.de/rechnung/public/check_invoice_number/?invoice_number=' + encodeURIComponent($('#invoice_number').val());
    $.get(url, function(data) {
        var isValid = data == 'success' ? true : false;
        if (isValid) {
            $('.invoice-number')
                .removeClass('has-error')
                .find('span')
                .hide();
        } else {
            if ($('.invoice-number').hasClass('has-error')) {
                return;
            }
            $('.invoice-number')
                .addClass('has-error')
                .find('div')
                .append('<span class="help-block">Rechnungsnummer ist schon vergeben.</span>');
        }
    });
}

Where’s the mistake? I’m not a programmer?

What do you see if you run this SQL query

select invoice_number from invoices;

0

MySQL lieferte ein leeres Resultat zurück (d.h. null Datensätze). (Die Abfrage dauerte 0.0002 Sekunden.)

https://yadi.sk/i/qhaZs91o3XExbu

===

i tested it additionally in microsoft edge and chrome as anonymous user and guest.