Merged release-2.0 into development

This commit is contained in:
Heng Sin Low 2013-12-19 20:59:55 +08:00
commit 654623549c
3 changed files with 19 additions and 17 deletions

View File

@ -852,16 +852,7 @@ public class Doc_Invoice extends Doc
if (X_M_Cost.COSTINGMETHOD_AverageInvoice.equals(costingMethod) || X_M_Cost.COSTINGMETHOD_AveragePO.equals(costingMethod))
{
// Convert to AcctCurrency
BigDecimal allocationAmt = lca.getAmt();
if (getC_Currency_ID() != as.getC_Currency_ID())
allocationAmt = MConversionRate.convert(getCtx(), allocationAmt,
getC_Currency_ID(), as.getC_Currency_ID(),
getDateAcct(), getC_ConversionType_ID(),
getAD_Client_ID(), getAD_Org_ID());
if (allocationAmt.scale() > as.getCostingPrecision())
allocationAmt = allocationAmt.setScale(as.getCostingPrecision(), BigDecimal.ROUND_HALF_UP);
BigDecimal allocationAmt = lca.getAmt();
BigDecimal estimatedAmt = BigDecimal.ZERO;
if (lca.getM_InOutLine_ID() > 0)
{
@ -921,11 +912,20 @@ public class Doc_Invoice extends Doc
boolean zeroQty = false;
try {
savepoint = trx.setSavepoint(null);
BigDecimal costDetailAmt = costAdjustmentAmt;
//convert to accounting schema currency
if (getC_Currency_ID() != as.getC_Currency_ID())
costDetailAmt = MConversionRate.convert(getCtx(), costDetailAmt,
getC_Currency_ID(), as.getC_Currency_ID(),
getDateAcct(), getC_ConversionType_ID(),
getAD_Client_ID(), getAD_Org_ID());
if (costDetailAmt.scale() > as.getCostingPrecision())
costDetailAmt = costDetailAmt.setScale(as.getCostingPrecision(), BigDecimal.ROUND_HALF_UP);
if (!MCostDetail.createInvoice(as, lca.getAD_Org_ID(),
lca.getM_Product_ID(), lca.getM_AttributeSetInstance_ID(),
C_InvoiceLine_ID, lca.getM_CostElement_ID(),
costAdjustmentAmt, lca.getQty(),
costDetailAmt, lca.getQty(),
desc, getTrxName())) {
throw new RuntimeException("Failed to create cost detail record.");
}

View File

@ -1096,9 +1096,9 @@ public class MInvoiceLine extends X_C_InvoiceLine
// end MZ
if (base.signum() != 0)
{
BigDecimal result = getLineNetAmt().multiply(base);
result = result.divide(total, BigDecimal.ROUND_HALF_UP);
lca.setAmt(result.doubleValue(), getPrecision());
double result = getLineNetAmt().multiply(base).doubleValue();
result /= total.doubleValue();
lca.setAmt(result, getPrecision());
}
if (!lca.save()){
msgreturn = new StringBuilder("Cannot save line Allocation = ").append(lca);
@ -1221,9 +1221,9 @@ public class MInvoiceLine extends X_C_InvoiceLine
// end MZ
if (base.signum() != 0)
{
BigDecimal result = getLineNetAmt().multiply(base);
result = result.divide(total, BigDecimal.ROUND_HALF_UP);
lca.setAmt(result.doubleValue(), getPrecision());
double result = getLineNetAmt().multiply(base).doubleValue();
result /= total.doubleValue();
lca.setAmt(result, getPrecision());
}
if (!lca.save()){
msgreturn = new StringBuilder("Cannot save line Allocation = ").append(lca);

View File

@ -21,6 +21,7 @@ import org.zkoss.zhtml.Script;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zk.ui.util.Clients;
import org.zkoss.zul.Borderlayout;
import org.zkoss.zul.Center;
import org.zkoss.zul.Div;
@ -143,6 +144,7 @@ public class TimeoutPanel extends Window implements
timer.stop();
SessionManager.logoutSession();
Executions.sendRedirect("/index.zul");
Clients.confirmClose(null);
}
}
}