Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Negative Payment to supplier
10-28-2021, 10:53 AM, (This post was last modified: 10-28-2021, 11:07 AM by srdjanm.)
#1
Negative Payment to supplier
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
Reply
10-28-2021, 11:34 AM,
#2
RE: Negative Payment to supplier
Thanks for the info, srdjanm, I'll have to check the handling at that area. I may not have a response tonight, though.
Reply
10-28-2021, 05:31 PM,
#3
RE: Negative Payment to supplier
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
Reply
10-29-2021, 12:30 AM,
#4
RE: Negative Payment to supplier
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
Reply
10-29-2021, 12:50 AM,
#5
RE: Negative Payment to supplier
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
Reply
10-29-2021, 01:05 AM,
#6
RE: Negative Payment to supplier
Tim,

Yes, I'll merge that now so that it will be part of the release.
(and contact Phil about the email for GitHib)
Reply
10-29-2021, 01:13 AM,
#7
RE: Negative Payment to supplier
Thanks Paul and Srdjan
Reply
10-29-2021, 11:43 PM,
#8
RE: Negative Payment to supplier
(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
Reply
10-30-2021, 12:05 AM,
#9
RE: Negative Payment to supplier
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
Reply
10-30-2021, 05:49 AM,
#10
RE: Negative Payment to supplier
(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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)