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.29k stars 2.74k forks source link

Merge payment by transfer to multiple thirdparties in single line in bankjournal #23853

Closed Daviid-P closed 7 months ago

Daviid-P commented 1 year ago

Feature Request

Is it possible to have something like image

Instead of separating like this:

image

I've tried to move most of the payment creation on htdocs\compta\prelevement\class\bonprelevement.class.php out of the

foreach ($amountsperthirdparty as $thirdpartyid => $cursoramounts) {

loop, leaving only

//$paiement->amounts      = $cursoramounts; // Array with detail of dispatching of payments for each invoice
$paiement->amounts = $paiement->amounts + $cursoramounts;

and that creates a single SPAY23-00001 with all the lines and the correct amount.

However, once I go to /accountancy/journal/bankjournal.php?id_journal=3 to write into the bookkeeping table the amounts are duplicated

image

Probably triplicated if I had 3 suppliers in the payment.

So I though to keep the SPAYs separate and then modify accountancy/journal/bankjournal.php to group the bank rows in a single line but $tabpay and $tabbq use the SPAY rowid to separate things so I'm not sure how to make it work.

Use case

When we make the payment through the bank we don't make multiple payments to each supplier, if we have to pay 100€ to Supplier A, 500€ to Supplier B and 1000€ to Supplier C we only make a single payment of 1600€.

So later to balance things it'd be easier if we can match the single 1600€ payment with a single line in dolibarr.

Suggested implementation

No response

Suggested steps

No response

Daviid-P commented 1 year ago

Maybe I could add num_chq to the $tabpay array and try to merge if it's not null or empty?

Daviid-P commented 1 year ago

I somewhat managed to do it

image

The only problem is that fk_doc can only point to a single payment.

Daviid-P commented 1 year ago

I think it's related to @simnandez https://github.com/Dolibarr/dolibarr/pull/9984 Here's what I did https://gist.github.com/Daviid-P/fc023d62df085c2961c2b89d720ffe9d/revisions (remove the container-lg class if you use the split view) There's other changes there so I marked with CUSTOMCODE what I added to merge into a single line.

Basically selected also the num_chq column and created an array with num_chq as the key where I store all payments.

github-actions[bot] commented 7 months 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).