[ 2528220 ] Posting commitment release issues

https://sourceforge.net/tracker/?func=detail&atid=879332&aid=2528220&group_id=176962

revert revision 8145
This commit is contained in:
teo_sarca 2009-02-11 21:17:15 +00:00
parent 7acdbe56e9
commit 598b8a5f1f
1 changed files with 13 additions and 18 deletions

View File

@ -596,20 +596,15 @@ public class Doc_Order extends Doc
Fact fact = new Fact(doc, as, Fact.POST_Commitment); Fact fact = new Fact(doc, as, Fact.POST_Commitment);
DocLine[] commitments = Doc_Order.getCommitments(doc, Qty, DocLine[] commitments = Doc_Order.getCommitments(doc, Qty,
C_InvoiceLine_ID); C_InvoiceLine_ID);
if (commitments.length == 0)
{
return fact;
}
BigDecimal total = Env.ZERO; BigDecimal total = Env.ZERO;
FactLine fl = null;
int C_Currency_ID = -1; int C_Currency_ID = -1;
for (int i = 0; i < commitments.length; i++) for (int i = 0; i < commitments.length; i++)
{ {
DocLine line = commitments[i]; DocLine line = commitments[i];
if (C_Currency_ID == -1) if (C_Currency_ID == -1)
{
C_Currency_ID = line.getC_Currency_ID(); C_Currency_ID = line.getC_Currency_ID();
}
else if (C_Currency_ID != line.getC_Currency_ID()) else if (C_Currency_ID != line.getC_Currency_ID())
{ {
doc.p_Error = "Different Currencies of Order Lines"; doc.p_Error = "Different Currencies of Order Lines";
@ -621,7 +616,8 @@ public class Doc_Order extends Doc
// Account // Account
MAccount expense = line.getAccount(ProductCost.ACCTTYPE_P_Expense, as); MAccount expense = line.getAccount(ProductCost.ACCTTYPE_P_Expense, as);
fact.createLine (line, expense, C_Currency_ID, null, cost); fl = fact.createLine (line, expense,
C_Currency_ID, null, cost);
} }
// Offset // Offset
MAccount offset = doc.getAccount(ACCTTYPE_CommitmentOffset, as); MAccount offset = doc.getAccount(ACCTTYPE_CommitmentOffset, as);
@ -631,7 +627,8 @@ public class Doc_Order extends Doc
s_log.log(Level.SEVERE, doc.p_Error); s_log.log(Level.SEVERE, doc.p_Error);
return null; return null;
} }
fact.createLine (null, offset, C_Currency_ID, total, null); fact.createLine (null, offset,
C_Currency_ID, total, null);
return fact; return fact;
} // getCommitmentRelease } // getCommitmentRelease
@ -737,21 +734,17 @@ public class Doc_Order extends Doc
BigDecimal Qty, int M_InOutLine_ID, BigDecimal multiplier) BigDecimal Qty, int M_InOutLine_ID, BigDecimal multiplier)
{ {
Fact fact = new Fact(doc, as, Fact.POST_Commitment); Fact fact = new Fact(doc, as, Fact.POST_Commitment);
DocLine[] commitments = Doc_Order.getCommitmentsSales(doc, Qty, M_InOutLine_ID); DocLine[] commitments = Doc_Order.getCommitmentsSales(doc, Qty,
if (commitments.length == 0) M_InOutLine_ID);
{
return fact;
}
BigDecimal total = Env.ZERO; BigDecimal total = Env.ZERO;
FactLine fl = null;
int C_Currency_ID = -1; int C_Currency_ID = -1;
for (int i = 0; i < commitments.length; i++) for (int i = 0; i < commitments.length; i++)
{ {
DocLine line = commitments[i]; DocLine line = commitments[i];
if (C_Currency_ID == -1) if (C_Currency_ID == -1)
{
C_Currency_ID = line.getC_Currency_ID(); C_Currency_ID = line.getC_Currency_ID();
}
else if (C_Currency_ID != line.getC_Currency_ID()) else if (C_Currency_ID != line.getC_Currency_ID())
{ {
doc.p_Error = "Different Currencies of Order Lines"; doc.p_Error = "Different Currencies of Order Lines";
@ -763,7 +756,8 @@ public class Doc_Order extends Doc
// Account // Account
MAccount revenue = line.getAccount(ProductCost.ACCTTYPE_P_Revenue, as); MAccount revenue = line.getAccount(ProductCost.ACCTTYPE_P_Revenue, as);
fact.createLine (line, revenue, C_Currency_ID, cost, null); fl = fact.createLine (line, revenue,
C_Currency_ID, cost, null);
} }
// Offset // Offset
MAccount offset = doc.getAccount(ACCTTYPE_CommitmentOffsetSales, as); MAccount offset = doc.getAccount(ACCTTYPE_CommitmentOffsetSales, as);
@ -773,7 +767,8 @@ public class Doc_Order extends Doc
s_log.log(Level.SEVERE, doc.p_Error); s_log.log(Level.SEVERE, doc.p_Error);
return null; return null;
} }
fact.createLine (null, offset, C_Currency_ID, null, total); fact.createLine (null, offset,
C_Currency_ID, null, total);
return fact; return fact;
} // getCommitmentSalesRelease } // getCommitmentSalesRelease