Dolibarr / dolibarr

Dolibarr ERP CRM is a modern software package to manage your company or foundation's activity (contacts, suppliers, invoices, orders, stocks, agenda, accounting, ...). it's an open source Web application (written in PHP) designed for businesses of any sizes, foundations and freelancers.
https://www.dolibarr.org
GNU General Public License v3.0
5.43k stars 2.78k forks source link

Add purchase total value sort field in warehouse detail view #21112

Closed omogenot closed 1 year ago

omogenot commented 2 years ago

Feature Request

In the Products/Warehouse/Detail view, add a sort by Total Purchase Price value.

Use case

In the Products/Warehouse/Detail view, all the products contained in this warehouse are displayed, and the user can sort this list by Product Ref / Description / Quantity / Mean Unit Purchase Price / Unit Selling Price. To get a quick view of what products are sitting there and are representing a big amount of sleeping money, it would be nice to be able to sort by Total Purchase Price value. This would also help doing a quick inventory of the most expensive goods, or even determine what products shall be on sales to get rid of them.

Suggested implementation

For Dolibarr version 15.0.2, in file products/stock/card.php change lines 644 to 648 with:

    if ($separatedPMP) {
        $sql .= " pa.pmp as ppmp,";
                $sql .= " (ps.reel * pa.pmp) as svalue,";
    } else {
        $sql .= " p.pmp as ppmp,";
                $sql .= " (ps.reel * p.pmp) as svalue,";
    }

and change line 607 to add svalue as a sort field: print_liste_field_titre("EstimatedStockValueShort", "", "svalue", "&id=".$id, "", '', $sortfield, $sortorder, 'right ');

Suggested steps

No response

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 1 year with no activity. If this is a bug, please comment to confirm it is still present on latest stable version. if this is a feature request, please comment to notify the request is still relevant and not yet covered by latest stable version. This issue may be closed automatically by stale bot in 10 days (you should still be able to re-open it if required).