erpcya / adempiere

ADempiere Business Suite ERP/CRM/MFG/SCM/POS done the Bazaar way in an open and unabated fashion. Focus is on the Community that includes Subject Matter Specialists, Implementors and End-Users.
www.adempiere.net
GNU General Public License v2.0
2 stars 5 forks source link

[Bug Report] Error con balanceo de nómina #63

Open yamelsenih opened 5 months ago

yamelsenih commented 5 months ago

Bug report

Cuando se está contabilizando una nómina y se tiene una diferencia negativa se genera un error de balanceo.

Steps to reproduce

  1. Genere una Nómina: Debe tener más deducciones que asignaciones contabilizadas
  2. Complete la Nómina
  3. Verifique el botón de completar

Screenshot or Gif

fd5b2665-32c2-4b78-b43f-08c16f7ac93a

Expected behavior

Por lo general al contabilizar un documento de nómina debe llevarlo a la cuenta de balanceo si hay diferencia.

Aquí hay un problema porque está comparando valores absolutos:

if (totalDebit.abs().compareTo(totalCredit.abs()) > 0) {
  regTotal = fact.createLine(null, acct, getC_Currency_ID(), null, totalDebit.subtract(totalCredit));
} else {
  regTotal = fact.createLine(null, acct, getC_Currency_ID(), totalCredit.abs().subtract(totalDebit.abs()), null);
}

Contexto Adicional

https://github.com/adempiere/adempiere/issues/4305 https://github.com/adempiere/adempiere/pull/4306

Issues-translate-bot commented 5 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Bug report

When a payroll is being posted and there is a negative difference, a balancing error is generated.

Steps to play

  1. Generate a Payroll: You must have more deductions than posted assignments
  2. Complete the Payroll
  3. Check the complete button

Screenshot or Gif

fd5b2665-32c2-4b78-b43f-08c16f7ac93a

Expected behavior

Generally, when posting a payroll document, you should take it to the balancing account if there is a difference.

There is a problem here because you are comparing absolute values:

if (totalDebit.abs().compareTo(totalCredit.abs()) > 0) {
  regTotal = fact.createLine(null, acct, getC_Currency_ID(), null, totalDebit.subtract(totalCredit));
} else {
  regTotal = fact.createLine(null, acct, getC_Currency_ID(), totalCredit.abs().subtract(totalDebit.abs()), null);
}