• Resolved itattitude

    (@itattitude)


    Hi,
    I’ve bought the PRO version of your plugin, but I can’t resolve a huge problem:
    when I receive an order, after checking it I click on the Invoice icon and then I have my invoice for the first time, in which the invoice number is correct.

    I’ve updated the yearly invoice number not automatically, and after clicking on the invoice icon of one of my oldest order, now I see all of my 2016’s invoices with the wrong numeration, because now they’re all have the new numeration that I set for 2017!!

    Plus, I think the plugin should be like: I generate for the first time the invoice of my order, so I automaticaly generate a number. This number should remain the same for ever, so if i’m going to click on this order’s invoice icon on march I should see the same number. For now, everytime I click, the system reset the invoice number and I see the number updated, and It’s a big mistake!

    Please tell me if I just block the invoice number once generated, or how can I do to fix the problem of my 2016’s invoices.

    Thank you so much!

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Contributor Ewout

    (@pomegranate)

    Hi!
    What you describe is not how the plugin normally works.

    Normally, the plugin creates the invoice number and invoice date only once, which is the first time the invoice is created. Note that if you create an invoice in 2017 for an order that was placed in 2016, the invoice date will NOT be 2017. Once a number and date are set, they will not be changed unless you do so manually.
    You can read more about this here in our documentation: Invoice numbers explained.

    If you still have issues and it is not working as described above and in the documentation, send us an email with your license information at [email protected]. We’re not allowed to provide support for our premium plugins via these forums by WordPre3ss.org forum rules.

    Hope that helps though!
    Ewout

    Hi, I have the same problem on the free version of “PDF Invoices & Packing Slips”. The number of invoices are duplicating. Invoices made in 2016, now in the “Invoice Number” column are as 2017. See the picture >> https://ibb.co/nP5yrF

    WordPress 4.7.3
    WooCommerce 2.6.14
    PDF I&PS 1.6.0.2

    If I try to print now the invoice of 2016, the date of the invoice in PDF is the date of today … but I’m sure I printed that invoice in 2016.

    Plugin Contributor Ewout

    (@pomegranate)

    @flyangel
    I tested this all with the same versions as you and my invoice date doesn’t change.

    Can you go into another 2016 order, take a screenshot of the invoice date (this is not the order date, the invoice date is in the ‘PDF Invoice Data’ block), create an invoice and check if the invoice date has changed? This stays the same when I do this, so I just want to confirm whether this is different for you. I haven’t had any other reports of this issue. The issue from the original post above was resolved by using [invoice_year] in the invoice number format (they had used ‘2017’ as a fixed number instead).

    Ewout

    This is the screenshot of an order of 2016 >> https://ibb.co/bERtQa
    and this is its PDF >> https://ibb.co/e8Cpyv

    I also checked the settings (the Invoice number format) and the suffix is correctly set [invoice_year].

    Plugin Contributor Ewout

    (@pomegranate)

    Hi! Can you take the screenshot of the 2016 order before you create the PDF? The date on this one was already set.

    I think I found the problem (or the date of occurrence of the problem).
    I turned on for the first time the function “Display invoice date” on January 5, 2017 ,…but I used the plugin (and printed invoices) since July 2016.

    In all the invoices printed before January 5 (without the function active) now the date is wrong (in the order “PDF Invoice Data” block, and in the printed PDF), the date shown is the date of today.

    In all the invoices printed after January 5 the date is correct (in the order “PDF Invoice Data” block and in the printed PDF).

    Is this a bug or is it normal to be so?

    ——————————————————-
    …all previous invoices are wrong
    ——————————————————-
    INVOICE | INVOICE DATE ———– | ORDER DATE
    43-2017 | Wrong (today) ———- | 2017-01-04 23:05
    44-2017 | Wrong (today) ———- | 2017-01-04 21:42
    45-2017 | Wrong (today) ———- | 2017-01-04 22:42
    46-2017 | RIGHT (2017-01-07 09:36) | 2017-01-07 03:40
    47-2017 | RIGHT (2017-01-07 10:50) | 2017-01-07 00:03
    48-2017 | RIGHT (2017-01-07 12:37) | 2017-01-06 19:49
    ——————————————————-
    …and all subsequent invoices are correct.
    ——————————————————-

    Plugin Contributor Ewout

    (@pomegranate)

    Hi! Thanks for investigating further – I see the issue with this. The invoice date is not created until it is requested, meaning that as you correctly assessed, no invoice date will be recorded if you have not turned on that feature.
    I will fix this in the next release, although this will not be able to restore invoice dates for existing orders ??

    Here’s a filter you can use to use the order date as invoice date, I have included a condition so that it only does this for invoice dates before january 5th:

    
    add_filter( 'wpo_wcpdf_invoice_date', 'wpo_wcpdf_invoice_order_date', 10, 2 );
    function wpo_wcpdf_invoice_order_date ( $formatted_invoice_date, $invoice_date ) {
    	$order_date = WPO\WC\PDF_Invoices\Compatibility\Order::get_prop( WPO_WCPDF()->export->order, 'date_created' );
    	$order_date_timestamp = $order_date->getTimestamp();
    
    	// if invoice from before January 5th, 2017: use order date as invoice date
    	if ( $order_date_timestamp < strtotime('2017-01-05 23:59:59') ) {
    		$formatted_invoice_date = $order_date->date_i18n( wc_date_format() );
    	}
    
    	return $formatted_invoice_date;
    }
    

    Note that this only works with version 1.6.0.2 (and higher) of the PDF invoice plugin!
    Read this if you haven’t worked with code snippets like this before: How to use filters

    I’m sorry for the inconvenience, hope this helps!

    Ewout

    The code snippet is a great help, allowing me to avoid manually edit PDF documents. Your plugin is great! Thank you for your support!

    Plugin Contributor Ewout

    (@pomegranate)

    I have just pushed an update (1.6.1) that makes sure the invoice date is always set when the invoice is created, regardless of the display setting, so that if you change this setting later, the date will already be there. Hopefully this will prevent this from happening to anyone else ??

    Ewout

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Invoice Number serious issue’ is closed to new replies.