Page 1 of 2 12 LastLast
Results 1 to 10 of 16
  1. #1
    Join Date
    Jan 2009
    Posts
    119
    Plugin Contributions
    0

    Default How to Change Invoice Number to YYYYMMDDxxxx?

    Hi,
    Is it possible to change the invoice numbers to reflect the date the order was raised.. e.g the fifth invoice raised on 13 August 2011 would have the invoice number 201108130005?

    I've searched the forum and found this post but i don't know how to change it. Can anybody help me?

    Thanks

    It's easy to modify the order number shown on the invoice so that it includes the year of the order.
    For example, if you have order number xyz, ordered in 2008 and want to display it on the invoice as Invoice No. xyz-2008 you can edit the file admin/invoices.php...
    find this line of code at about line 141:
    Code:
        <td class="main"><b><?php echo ENTRY_ORDER_ID . $oID; ?></b></td>
    and replace it with this:
    Code:
        <td class="main"><b><?php echo ENTRY_ORDER_ID . $oID . '-' . date(Y,strtotime($order->info['date_purchased'])) ; ?></b></td>
    Then all your invoice numbers will include the year of the order, without ever having to update anything manually.

  2. #2
    Join Date
    Feb 2005
    Location
    Lansing, Michigan USA
    Posts
    20,024
    Plugin Contributions
    3

    Default Re: How to Change Invoice Number to YYYYMMDDxxxx?

    What about that post wasn't clear ?

  3. #3
    Join Date
    Jan 2009
    Posts
    119
    Plugin Contributions
    0

    Default Re: How to Change Invoice Number to YYYYMMDDxxxx?

    Its probably just that i cant read /dont understand php.
    If i put that code in i get "Invoice No. xyz-2011"?

    so I'm assuming...
    $oID . gives me xyz
    '-' gives me -
    . date(Y,strtotime($order->info['date_purchased'])) gives me 2011?

    What will give me yyyymmdd and is it just a matter of reversing it so i have yyymmddxyz?

    is this a valid code?

    Code:
    <td class="main"><b><?php echo ENTRY_ORDER_ID date(Y,strtotime($order->info['date_purchased'])) . $oID . ; ?></b></td>

  4. #4
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: How to Change Invoice Number to YYYYMMDDxxxx?

    Not quite. The dot before the semi-colon would give you a problem, and you will probably want to use "Ymd" rather than "Y" to give you the month and day too.

    However, this won't restart the numerical part each day. If the last number today was 5, the first tomorrow will be 6.
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

  5. #5
    Join Date
    Jan 2009
    Posts
    119
    Plugin Contributions
    0

    Default Re: How to Change Invoice Number to YYYYMMDDxxxx?

    thanks kuroi, i'll remove the dot in question and change the Y. the end bit not changing is close enough to what i wanted to do (now that i know how its going to work)

    thanks again for your help

  6. #6
    Join Date
    Mar 2010
    Posts
    77
    Plugin Contributions
    0

    Default Re: How to Change Invoice Number to YYYYMMDDxxxx?

    Hi, I've been looking at the above and cant get the below code to work. My invoice numbers are just continuing to role over as normal without the Year Month Date prefix!

    <td class="main"><b><?php echo ENTRY_ORDER_ID date(YMD,strtotime($order->info['date_purchased'])) . $oID ; ?></b></td>

    The code I'm replacing is in the admin/invoice.php file and is shown below.

    <td class="main"><b><?php echo ENTRY_ORDER_ID . $oID; ?></b></td>

    Am i doing something wrong?

    Thanks
    Tony

  7. #7
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: How to Change Invoice Number to YYYYMMDDxxxx?

    The YMD needs quotes around it. Single or double, either will do.
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

  8. #8
    Join Date
    Mar 2010
    Posts
    77
    Plugin Contributions
    0

    Default Re: How to Change Invoice Number to YYYYMMDDxxxx?

    still not having it!


    I dont have to change anything in the DB do I? field length etc??

  9. #9
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: How to Change Invoice Number to YYYYMMDDxxxx?

    You're missing a concatenation dot between ENTRY_ORDER_ID and the date function.

    i.e. should read
    ENTRY_ORDER_ID . date("YMD", etc
    and this won't change your underlying order numbers, just prepend the date when displaying in this specific location.
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

  10. #10
    Join Date
    Mar 2010
    Posts
    77
    Plugin Contributions
    0

    Default Re: How to Change Invoice Number to YYYYMMDDxxxx?

    thanks for the advice but its still not having it. I'll look at it again when I have more time.

    thanks again.

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. v151 Can I have secondary invoice number based on date? YYYYMMDDxxxx
    By gsmsalers in forum General Questions
    Replies: 4
    Last Post: 9 Oct 2013, 07:00 AM
  2. How to modify BSB number in the online invoice?
    By didart in forum Basic Configuration
    Replies: 2
    Last Post: 11 May 2012, 02:10 AM
  3. How can I change the number of the invoice?
    By bryancsparks in forum General Questions
    Replies: 1
    Last Post: 1 Mar 2010, 12:10 AM
  4. reset / change invoice number
    By asappia in forum General Questions
    Replies: 1
    Last Post: 30 Jan 2009, 06:09 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR