webERP Forum
Negative Payment to supplier - Printable Version

+- webERP Forum (http://www.weberp.org/forum)
+-- Forum: webERP Discussion (http://www.weberp.org/forum/forumdisplay.php?fid=1)
+--- Forum: Problems / Bugs? (http://www.weberp.org/forum/forumdisplay.php?fid=8)
+--- Thread: Negative Payment to supplier (/showthread.php?tid=8860)

Pages: 1 2


Negative Payment to supplier - srdjanm - 10-28-2021

I'm using version 4.15.1
Problem statement:
Supplier currency is USD, non functional currency. Functional currency is CAD.
Payment from USD bank account
When negative number is entered and accept is pressed it draws a red box around the amount, transaction is not processed.

I also tested negative payment from functional currency bank account CAD to USD supplier and it is the same issue when negative value is entered, the red box.
Thank you
Srdjan


RE: Negative Payment to supplier - TurboPT - 10-28-2021

Thanks for the info, srdjanm, I'll have to check the handling at that area. I may not have a response tonight, though.


RE: Negative Payment to supplier - TimSchofield - 10-28-2021

This happens because the Javascript function payVerify() is not allowing the payment if the amount being paid is less than the amount being allocated, and obviously when the amount being paid is negative, and the amount being allocated is defaulting to zero then this is kicking in. I didn't write this function, and I am not sure that he follows this forum any more, but I would change line 461 of javascripts/MiscFunctions from

if (parseFloat(document.getElementById(b).value) < parseFloat(parseFloat(document.getElementById(a).value))){

to

if ((parseFloat(document.getElementById(b).value) < parseFloat(parseFloat(document.getElementById(a).value))) && (parseFloat(document.getElementById(b).value) > 0)){

Paul: should this change be incorporated in your release?
Tim


RE: Negative Payment to supplier - srdjanm - 10-29-2021

Thank you Tim!
I just tested this change and it did not work in my case. I think because the "Total input Amount" is 0, no allocation against invoices.

I tweaked your change from:
&& (parseFloat(document.getElementById(b).value) > 0)){
to
&& (parseFloat(document.getElementById(b).value) >= 0)){

and this worked. Not sure if this is correct?
Thank you
Srdjan


RE: Negative Payment to supplier - TimSchofield - 10-29-2021

Hmm, element b is the total amount of the payment, and element a is the total amount of the allocation, which is why I chose > and not >=. However both work for me, so I am more than happy to go with your change. I will commit it, and leave it up to Paul as to whether he pulls it accross.

Thanks
Tim


RE: Negative Payment to supplier - TurboPT - 10-29-2021

Tim,

Yes, I'll merge that now so that it will be part of the release.
(and contact Phil about the email for GitHib)


RE: Negative Payment to supplier - TimSchofield - 10-29-2021

Thanks Paul and Srdjan


RE: Negative Payment to supplier - srdjanm - 10-29-2021

(10-29-2021, 01:13 AM)TimSchofield Wrote: Thanks Paul and Srdjan
Hi,
I did some more testing on Firefox and Chrome.
Changing this function has implications on other functions where it is not used. It brakes compatibility.
1. Date entry: the calendar is gone, can not choose date.
2. Enter Supplier invoice screen: Try to change Tax from "Automatic" to "Manual", you can't enter new tax value, screen does not change.

This need deeper look. So, I put back the original code.
Thank you
Srdjan


RE: Negative Payment to supplier - TimSchofield - 10-30-2021

The payVerify() function is only called from one place and that is in Payments.php. I'm unsure how changing it can be causing the issues you say. The date picker and the Supplier Invoice script are working fine on my local system with that change.

It seems like JavaScript is not working at all on your system. On firefox try CTRL-SHIFT-I and look under the console tab when you try to do something like clicking on a date field and see what it says.

Tim


RE: Negative Payment to supplier - srdjanm - 10-30-2021

(10-30-2021, 12:05 AM)TimSchofield Wrote: The payVerify() function is only called from one place and that is in Payments.php. I'm unsure how changing it can be causing the issues you say. The date picker and the Supplier Invoice script are working fine on my local system with that change.

It seems like JavaScript is not working at all on your system. On firefox try CTRL-SHIFT-I and look under the console tab when you try to do something like clicking on a date field and see what it says.

Tim
I was missing a bracket in the function...It is working now.
Thank you
Srdjan