# Arrangement on the invoice

**URL:** <https://www.dolibarr.org/forum/t/arrangement-on-the-invoice/21290>\
**Category:** Using my Dolibarr\
**Created:** [October 7, 2021, 10:34am UTC](https://www.dolibarr.org/forum/t/arrangement-on-the-invoice/21290 "2021-10-07T10:34:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Skogstomt](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/s/c77e96/32.png) [@Skogstomt](https://www.dolibarr.org/forum/u/Skogstomt)\
**Post date:** [October 7, 2021, 10:34am UTC](https://www.dolibarr.org/forum/t/arrangement-on-the-invoice/21290/1 "2021-10-07T10:34:53Z")

</div>

Hi.  
When I have to turn a sales order into an invoice, the products end up in disorder.  
I would like them to end up in chronological order.

 ![orderordning](https://www.dolibarr.org/forum/uploads/dolibarrorg/original/2X/6/6af69cd48f36c81d0a25d7978dbed2418bec0640.jpeg)

Do you have any ideas?  
Thanks so much

---

<div class="post-metadata">

**Author:** ![pcbleu](https://www.dolibarr.org/forum/user_avatar/www.dolibarr.org/pcbleu/32/3120_2.png) [@pcbleu](https://www.dolibarr.org/forum/u/pcbleu)\
**Post date:** [October 7, 2021, 11:10am UTC](https://www.dolibarr.org/forum/t/arrangement-on-the-invoice/21290/2 "2021-10-07T11:10:46Z")

</div>

Hey

lines in the invoice are just listed as it has been created,  
to obtain what you want, you will be obliged to modify the “order by” clause

the invoice object is loaded in htdocs/compta/facture/class/facture.class.php

 ![image](https://www.dolibarr.org/forum/uploads/dolibarrorg/original/2X/b/b2ff693e51ab8d3a79499e9ae5258d464a456493.png)  
on line 1777, you can replace the sql clause with “order by l.description, l.rowid;”

a good way to test this is to activate logs file on Dolibarr & make some tries with phpmyadmin, with the sql command generated with this fetch\_lines function

Good continuation

---

<div class="post-metadata">

**Author:** ![Skogstomt](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/s/c77e96/32.png) [@Skogstomt](https://www.dolibarr.org/forum/u/Skogstomt)\
**Post date:** [October 11, 2021, 7:55am UTC](https://www.dolibarr.org/forum/t/arrangement-on-the-invoice/21290/3 "2021-10-11T07:55:03Z")

</div>

Success 🙂  
Thanks so much for your help and your time!

Now they are completely in the order I want!
