hg merge release-1.0c (merge release1 into release2)

This commit is contained in:
Carlos Ruiz 2013-12-30 21:42:30 -05:00
commit 7506668fb6
2 changed files with 6 additions and 2 deletions

View File

@ -47,6 +47,7 @@ import org.compiere.model.MJournalGenerator;
import org.compiere.model.MJournalGeneratorLine;
import org.compiere.model.MJournalGeneratorSource;
import org.compiere.model.MJournalLine;
import org.compiere.model.MPeriod;
import org.compiere.model.MProduct;
import org.compiere.model.MTable;
import org.compiere.model.PO;
@ -419,6 +420,9 @@ public class GLJournalGenerate extends SvrProcess
j.setC_DocType_ID(journalGenerator.getC_DocType_ID());
j.setControlAmt(Env.ZERO);
j.setDateAcct(p_DateAcct);
int C_Period_ID = MPeriod.getC_Period_ID(getCtx(), p_DateAcct, j.getAD_Org_ID());
if (C_Period_ID > 0)
j.setC_Period_ID(C_Period_ID);
j.setDateDoc(p_DateAcct);
j.setDescription(journalGenerator.getDescription());
j.setDocumentNo(p_DocumentNo);

View File

@ -408,7 +408,7 @@ public class Allocation
// selection of payment row
if (((Boolean)payment.getValueAt(row, 0)).booleanValue())
{
applied = open; // Open Amount
applied = open.signum() > 0 ? open : BigDecimal.ZERO; // Open Amount
if (totalDiff.abs().compareTo(applied.abs()) < 0 // where less is available to allocate than open
&& totalDiff.signum() == -applied.signum() ) // and the available amount has the opposite sign
applied = totalDiff.negate(); // reduce the amount applied to what's available
@ -421,7 +421,7 @@ public class Allocation
if (col == i_payment)
{
if ( applied.signum() == -open.signum() )
if ( open.signum() > 0 && applied.signum() == -open.signum() )
applied = applied.negate();
if (! MSysConfig.getBooleanValue("ALLOW_OVER_APPLIED_PAYMENT", false, Env.getAD_Client_ID(Env.getCtx())))
if ( open.abs().compareTo( applied.abs() ) < 0 )