hg merge release-1.0c (forward-porting)
This commit is contained in:
commit
7e974b0535
|
@ -0,0 +1,11 @@
|
||||||
|
SET SQLBLANKLINES ON
|
||||||
|
SET DEFINE OFF
|
||||||
|
|
||||||
|
UPDATE M_CostDetail SET M_MatchInv_ID=NULL WHERE M_MatchInv_ID IS NOT NULL AND NOT EXISTS (SELECT a.M_MatchInv_ID FROM M_MatchInv a WHERE a.M_MatchInv_ID=M_CostDetail.M_MatchInv_ID)
|
||||||
|
;
|
||||||
|
|
||||||
|
ALTER TABLE M_CostDetail ADD CONSTRAINT MCostDetail_MatchInv FOREIGN KEY(M_MatchInv_ID) REFERENCES M_MatchInv(M_MatchInv_ID) ON DELETE RESTRICT
|
||||||
|
;
|
||||||
|
|
||||||
|
SELECT register_migration_script('201309250432_IDEMPIERE-1188.sql') FROM dual
|
||||||
|
;
|
|
@ -0,0 +1,8 @@
|
||||||
|
UPDATE M_CostDetail SET M_MatchInv_ID=NULL WHERE M_MatchInv_ID IS NOT NULL AND NOT EXISTS (SELECT a.M_MatchInv_ID FROM M_MatchInv a WHERE a.M_MatchInv_ID=M_CostDetail.M_MatchInv_ID)
|
||||||
|
;
|
||||||
|
|
||||||
|
ALTER TABLE M_CostDetail ADD CONSTRAINT MCostDetail_MatchInv FOREIGN KEY(M_MatchInv_ID) REFERENCES M_MatchInv(M_MatchInv_ID) ON DELETE RESTRICT DEFERRABLE INITIALLY DEFERRED
|
||||||
|
;
|
||||||
|
|
||||||
|
SELECT register_migration_script('201309250432_IDEMPIERE-1188.sql') FROM dual
|
||||||
|
;
|
|
@ -78,6 +78,7 @@ public class Doc_MatchInv extends Doc
|
||||||
private MInOutLine m_receiptLine = null;
|
private MInOutLine m_receiptLine = null;
|
||||||
|
|
||||||
private ProductCost m_pc = null;
|
private ProductCost m_pc = null;
|
||||||
|
private MMatchInv m_matchInv;
|
||||||
|
|
||||||
/** Commitments */
|
/** Commitments */
|
||||||
// private DocLine[] m_commitments = null;
|
// private DocLine[] m_commitments = null;
|
||||||
|
@ -89,21 +90,21 @@ public class Doc_MatchInv extends Doc
|
||||||
protected String loadDocumentDetails ()
|
protected String loadDocumentDetails ()
|
||||||
{
|
{
|
||||||
setC_Currency_ID (Doc.NO_CURRENCY);
|
setC_Currency_ID (Doc.NO_CURRENCY);
|
||||||
MMatchInv matchInv = (MMatchInv)getPO();
|
m_matchInv = (MMatchInv)getPO();
|
||||||
setDateDoc(matchInv.getDateTrx());
|
setDateDoc(m_matchInv.getDateTrx());
|
||||||
setQty (matchInv.getQty());
|
setQty (m_matchInv.getQty());
|
||||||
// Invoice Info
|
// Invoice Info
|
||||||
int C_InvoiceLine_ID = matchInv.getC_InvoiceLine_ID();
|
int C_InvoiceLine_ID = m_matchInv.getC_InvoiceLine_ID();
|
||||||
m_invoiceLine = new MInvoiceLine (getCtx(), C_InvoiceLine_ID, getTrxName());
|
m_invoiceLine = new MInvoiceLine (getCtx(), C_InvoiceLine_ID, getTrxName());
|
||||||
// BP for NotInvoicedReceipts
|
// BP for NotInvoicedReceipts
|
||||||
int C_BPartner_ID = m_invoiceLine.getParent().getC_BPartner_ID();
|
int C_BPartner_ID = m_invoiceLine.getParent().getC_BPartner_ID();
|
||||||
setC_BPartner_ID(C_BPartner_ID);
|
setC_BPartner_ID(C_BPartner_ID);
|
||||||
//
|
//
|
||||||
int M_InOutLine_ID = matchInv.getM_InOutLine_ID();
|
int M_InOutLine_ID = m_matchInv.getM_InOutLine_ID();
|
||||||
m_receiptLine = new MInOutLine (getCtx(), M_InOutLine_ID, getTrxName());
|
m_receiptLine = new MInOutLine (getCtx(), M_InOutLine_ID, getTrxName());
|
||||||
//
|
//
|
||||||
m_pc = new ProductCost (Env.getCtx(),
|
m_pc = new ProductCost (Env.getCtx(),
|
||||||
getM_Product_ID(), matchInv.getM_AttributeSetInstance_ID(), getTrxName());
|
getM_Product_ID(), m_matchInv.getM_AttributeSetInstance_ID(), getTrxName());
|
||||||
m_pc.setQty(getQty());
|
m_pc.setQty(getQty());
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -177,18 +178,26 @@ public class Doc_MatchInv extends Doc
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
dr.setQty(getQty());
|
dr.setQty(getQty());
|
||||||
// dr.setM_Locator_ID(m_receiptLine.getM_Locator_ID());
|
|
||||||
// MInOut receipt = m_receiptLine.getParent();
|
|
||||||
// dr.setLocationFromBPartner(receipt.getC_BPartner_Location_ID(), true); // from Loc
|
|
||||||
// dr.setLocationFromLocator(m_receiptLine.getM_Locator_ID(), false); // to Loc
|
|
||||||
BigDecimal temp = dr.getAcctBalance();
|
BigDecimal temp = dr.getAcctBalance();
|
||||||
// Set AmtAcctCr/Dr from Receipt (sets also Project)
|
// Set AmtAcctCr/Dr from Receipt (sets also Project)
|
||||||
if (!dr.updateReverseLine (MInOut.Table_ID, // Amt updated
|
if (m_matchInv.getReversal_ID() > 0)
|
||||||
m_receiptLine.getM_InOut_ID(), m_receiptLine.getM_InOutLine_ID(),
|
|
||||||
multiplier))
|
|
||||||
{
|
{
|
||||||
p_Error = "Mat.Receipt not posted yet";
|
if (!dr.updateReverseLine (MMatchInv.Table_ID, // Amt updated
|
||||||
return null;
|
m_matchInv.getReversal_ID(), 0, BigDecimal.ONE))
|
||||||
|
{
|
||||||
|
p_Error = "Failed to create reversal entry";
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!dr.updateReverseLine (MInOut.Table_ID, // Amt updated
|
||||||
|
m_receiptLine.getM_InOut_ID(), m_receiptLine.getM_InOutLine_ID(),
|
||||||
|
multiplier))
|
||||||
|
{
|
||||||
|
p_Error = "Mat.Receipt not posted yet";
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (log.isLoggable(Level.FINE)) log.fine("CR - Amt(" + temp + "->" + dr.getAcctBalance()
|
if (log.isLoggable(Level.FINE)) log.fine("CR - Amt(" + temp + "->" + dr.getAcctBalance()
|
||||||
+ ") - " + dr.toString());
|
+ ") - " + dr.toString());
|
||||||
|
@ -220,14 +229,26 @@ public class Doc_MatchInv extends Doc
|
||||||
cr.setAmtAcctCr(BigDecimal.ZERO);
|
cr.setAmtAcctCr(BigDecimal.ZERO);
|
||||||
cr.setAmtSourceCr(BigDecimal.ZERO);
|
cr.setAmtSourceCr(BigDecimal.ZERO);
|
||||||
}
|
}
|
||||||
cr.setQty(getQty().negate());
|
|
||||||
temp = cr.getAcctBalance();
|
temp = cr.getAcctBalance();
|
||||||
// Set AmtAcctCr/Dr from Invoice (sets also Project)
|
if (m_matchInv.getReversal_ID() > 0)
|
||||||
if (as.isAccrual() && !cr.updateReverseLine (MInvoice.Table_ID, // Amt updated
|
|
||||||
m_invoiceLine.getC_Invoice_ID(), m_invoiceLine.getC_InvoiceLine_ID(), multiplier))
|
|
||||||
{
|
{
|
||||||
p_Error = "Invoice not posted yet";
|
if (!cr.updateReverseLine (MMatchInv.Table_ID, // Amt updated
|
||||||
return null;
|
m_matchInv.getReversal_ID(), 0, BigDecimal.ONE))
|
||||||
|
{
|
||||||
|
p_Error = "Failed to create reversal entry";
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cr.setQty(getQty().negate());
|
||||||
|
// Set AmtAcctCr/Dr from Invoice (sets also Project)
|
||||||
|
if (!cr.updateReverseLine (MInvoice.Table_ID, // Amt updated
|
||||||
|
m_invoiceLine.getC_Invoice_ID(), m_invoiceLine.getC_InvoiceLine_ID(), multiplier))
|
||||||
|
{
|
||||||
|
p_Error = "Invoice not posted yet";
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (log.isLoggable(Level.FINE)) log.fine("DR - Amt(" + temp + "->" + cr.getAcctBalance()
|
if (log.isLoggable(Level.FINE)) log.fine("DR - Amt(" + temp + "->" + cr.getAcctBalance()
|
||||||
+ ") - " + cr.toString());
|
+ ") - " + cr.toString());
|
||||||
|
@ -242,9 +263,35 @@ public class Doc_MatchInv extends Doc
|
||||||
invoice.getAD_Client_ID(), invoice.getAD_Org_ID());
|
invoice.getAD_Client_ID(), invoice.getAD_Org_ID());
|
||||||
cr = fact.createLine (null, expense,
|
cr = fact.createLine (null, expense,
|
||||||
as.getC_Currency_ID(), null, LineNetAmt);
|
as.getC_Currency_ID(), null, LineNetAmt);
|
||||||
cr.setQty(getQty().multiply(multiplier).negate());
|
if (m_matchInv.getReversal_ID() > 0)
|
||||||
|
{
|
||||||
|
if (!cr.updateReverseLine (MMatchInv.Table_ID, // Amt updated
|
||||||
|
m_matchInv.getReversal_ID(), 0, BigDecimal.ONE))
|
||||||
|
{
|
||||||
|
p_Error = "Failed to create reversal entry";
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cr.setQty(getQty().multiply(multiplier).negate());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (m_matchInv.getReversal_ID() == 0)
|
||||||
|
{
|
||||||
|
cr.setC_Activity_ID(m_invoiceLine.getC_Activity_ID());
|
||||||
|
cr.setC_Campaign_ID(m_invoiceLine.getC_Campaign_ID());
|
||||||
|
cr.setC_Project_ID(m_invoiceLine.getC_Project_ID());
|
||||||
|
cr.setC_ProjectPhase_ID(m_invoiceLine.getC_ProjectPhase_ID());
|
||||||
|
cr.setC_ProjectTask_ID(m_invoiceLine.getC_ProjectTask_ID());
|
||||||
|
cr.setC_UOM_ID(m_invoiceLine.getC_UOM_ID());
|
||||||
|
cr.setUser1_ID(m_invoiceLine.getUser1_ID());
|
||||||
|
cr.setUser2_ID(m_invoiceLine.getUser2_ID());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
updateFactLine(cr);
|
||||||
}
|
}
|
||||||
updateFactLine(cr);
|
|
||||||
|
|
||||||
//AZ Goodwill
|
//AZ Goodwill
|
||||||
//Desc: Source Not Balanced problem because Currency is Difference - PO=CNY but AP=USD
|
//Desc: Source Not Balanced problem because Currency is Difference - PO=CNY but AP=USD
|
||||||
|
|
|
@ -75,6 +75,7 @@ public class Doc_MatchPO extends Doc
|
||||||
|
|
||||||
private ProductCost m_pc;
|
private ProductCost m_pc;
|
||||||
private int m_M_AttributeSetInstance_ID = 0;
|
private int m_M_AttributeSetInstance_ID = 0;
|
||||||
|
private MMatchPO m_matchPO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load Specific Document Details
|
* Load Specific Document Details
|
||||||
|
@ -83,19 +84,19 @@ public class Doc_MatchPO extends Doc
|
||||||
protected String loadDocumentDetails ()
|
protected String loadDocumentDetails ()
|
||||||
{
|
{
|
||||||
setC_Currency_ID (Doc.NO_CURRENCY);
|
setC_Currency_ID (Doc.NO_CURRENCY);
|
||||||
MMatchPO matchPO = (MMatchPO)getPO();
|
m_matchPO = (MMatchPO)getPO();
|
||||||
setDateDoc(matchPO.getDateTrx());
|
setDateDoc(m_matchPO.getDateTrx());
|
||||||
//
|
//
|
||||||
m_M_AttributeSetInstance_ID = matchPO.getM_AttributeSetInstance_ID();
|
m_M_AttributeSetInstance_ID = m_matchPO.getM_AttributeSetInstance_ID();
|
||||||
setQty (matchPO.getQty());
|
setQty (m_matchPO.getQty());
|
||||||
//
|
//
|
||||||
m_C_OrderLine_ID = matchPO.getC_OrderLine_ID();
|
m_C_OrderLine_ID = m_matchPO.getC_OrderLine_ID();
|
||||||
m_oLine = new MOrderLine (getCtx(), m_C_OrderLine_ID, getTrxName());
|
m_oLine = new MOrderLine (getCtx(), m_C_OrderLine_ID, getTrxName());
|
||||||
//
|
//
|
||||||
m_M_InOutLine_ID = matchPO.getM_InOutLine_ID();
|
m_M_InOutLine_ID = m_matchPO.getM_InOutLine_ID();
|
||||||
m_ioLine = new MInOutLine (getCtx(), m_M_InOutLine_ID, getTrxName());
|
m_ioLine = new MInOutLine (getCtx(), m_M_InOutLine_ID, getTrxName());
|
||||||
|
|
||||||
m_C_InvoiceLine_ID = matchPO.getC_InvoiceLine_ID();
|
m_C_InvoiceLine_ID = m_matchPO.getC_InvoiceLine_ID();
|
||||||
|
|
||||||
//
|
//
|
||||||
m_pc = new ProductCost (Env.getCtx(),
|
m_pc = new ProductCost (Env.getCtx(),
|
||||||
|
@ -252,79 +253,105 @@ public class Doc_MatchPO extends Doc
|
||||||
|
|
||||||
if (MAcctSchema.COSTINGMETHOD_StandardCosting.equals(costingMethod))
|
if (MAcctSchema.COSTINGMETHOD_StandardCosting.equals(costingMethod))
|
||||||
{
|
{
|
||||||
// No Costs yet - no PPV
|
if (m_matchPO.getReversal_ID() > 0)
|
||||||
if (costs == null || costs.signum() == 0)
|
|
||||||
{
|
{
|
||||||
p_Error = "Resubmit - No Costs for " + product.getName();
|
// Product PPV
|
||||||
log.log(Level.SEVERE, p_Error);
|
FactLine cr = fact.createLine(null,
|
||||||
return null;
|
m_pc.getAccount(ProductCost.ACCTTYPE_P_PPV, as),
|
||||||
}
|
as.getC_Currency_ID(), Env.ONE);
|
||||||
|
if (!cr.updateReverseLine(MMatchPO.Table_ID, m_matchPO.getM_MatchPO_ID(), 0, Env.ONE))
|
||||||
// Difference
|
{
|
||||||
BigDecimal difference = totalCost.subtract(costs);
|
|
||||||
// Nothing to post
|
|
||||||
if (difference.signum() == 0)
|
|
||||||
{
|
|
||||||
if (log.isLoggable(Level.FINE))log.log(Level.FINE, "No Cost Difference for M_Product_ID=" + getM_Product_ID());
|
|
||||||
return facts;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Product PPV
|
|
||||||
FactLine cr = fact.createLine(null,
|
|
||||||
m_pc.getAccount(ProductCost.ACCTTYPE_P_PPV, as),
|
|
||||||
as.getC_Currency_ID(), isReturnTrx ? difference.negate() : difference);
|
|
||||||
MAccount acct_cr = null;
|
|
||||||
if (cr != null)
|
|
||||||
{
|
|
||||||
cr.setQty(isReturnTrx ? getQty().negate() : getQty());
|
|
||||||
cr.setC_BPartner_ID(m_oLine.getC_BPartner_ID());
|
|
||||||
cr.setC_Activity_ID(m_oLine.getC_Activity_ID());
|
|
||||||
cr.setC_Campaign_ID(m_oLine.getC_Campaign_ID());
|
|
||||||
cr.setC_Project_ID(m_oLine.getC_Project_ID());
|
|
||||||
cr.setC_ProjectPhase_ID(m_oLine.getC_ProjectPhase_ID());
|
|
||||||
cr.setC_ProjectTask_ID(m_oLine.getC_ProjectTask_ID());
|
|
||||||
cr.setC_UOM_ID(m_oLine.getC_UOM_ID());
|
|
||||||
cr.setUser1_ID(m_oLine.getUser1_ID());
|
|
||||||
cr.setUser2_ID(m_oLine.getUser2_ID());
|
|
||||||
acct_cr = cr.getAccount(); // PPV Offset
|
|
||||||
}
|
|
||||||
|
|
||||||
// PPV Offset
|
|
||||||
FactLine dr = fact.createLine(null,
|
|
||||||
getAccount(Doc.ACCTTYPE_PPVOffset, as),
|
|
||||||
as.getC_Currency_ID(), isReturnTrx ? difference : difference.negate());
|
|
||||||
MAccount acct_db = null;
|
|
||||||
if (dr != null)
|
|
||||||
{
|
|
||||||
dr.setQty(isReturnTrx ? getQty() : getQty().negate());
|
|
||||||
dr.setC_BPartner_ID(m_oLine.getC_BPartner_ID());
|
|
||||||
dr.setC_Activity_ID(m_oLine.getC_Activity_ID());
|
|
||||||
dr.setC_Campaign_ID(m_oLine.getC_Campaign_ID());
|
|
||||||
dr.setC_Project_ID(m_oLine.getC_Project_ID());
|
|
||||||
dr.setC_ProjectPhase_ID(m_oLine.getC_ProjectPhase_ID());
|
|
||||||
dr.setC_ProjectTask_ID(m_oLine.getC_ProjectTask_ID());
|
|
||||||
dr.setC_UOM_ID(m_oLine.getC_UOM_ID());
|
|
||||||
dr.setUser1_ID(m_oLine.getUser1_ID());
|
|
||||||
dr.setUser2_ID(m_oLine.getUser2_ID());
|
|
||||||
acct_db = dr.getAccount(); // PPV
|
|
||||||
}
|
|
||||||
|
|
||||||
// Avoid usage of clearing accounts
|
|
||||||
// If both accounts Purchase Price Variance and Purchase Price Variance Offset are equal
|
|
||||||
// then remove the posting
|
|
||||||
|
|
||||||
if ((!as.isPostIfClearingEqual()) && acct_db!=null && acct_db.equals(acct_cr) && (!isInterOrg)) {
|
|
||||||
|
|
||||||
BigDecimal debit = dr.getAmtSourceDr();
|
|
||||||
BigDecimal credit = cr.getAmtSourceCr();
|
|
||||||
|
|
||||||
if (debit.compareTo(credit) == 0) {
|
|
||||||
fact.remove(dr);
|
|
||||||
fact.remove(cr);
|
fact.remove(cr);
|
||||||
|
cr = null;
|
||||||
|
}
|
||||||
|
if (cr != null)
|
||||||
|
{
|
||||||
|
// PPV Offset
|
||||||
|
FactLine dr = fact.createLine(null,
|
||||||
|
getAccount(Doc.ACCTTYPE_PPVOffset, as), as.getC_Currency_ID(), Env.ONE);
|
||||||
|
if (!dr.updateReverseLine(MMatchPO.Table_ID, m_matchPO.getM_MatchPO_ID(), 0, Env.ONE))
|
||||||
|
{
|
||||||
|
p_Error = "Failed to create reversal entry for ACCTTYPE_PPVOffset";
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// No Costs yet - no PPV
|
||||||
|
if (costs == null || costs.signum() == 0)
|
||||||
|
{
|
||||||
|
p_Error = "Resubmit - No Costs for " + product.getName();
|
||||||
|
log.log(Level.SEVERE, p_Error);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Difference
|
||||||
|
BigDecimal difference = totalCost.subtract(costs);
|
||||||
|
// Nothing to post
|
||||||
|
if (difference.signum() == 0)
|
||||||
|
{
|
||||||
|
if (log.isLoggable(Level.FINE))log.log(Level.FINE, "No Cost Difference for M_Product_ID=" + getM_Product_ID());
|
||||||
|
return facts;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Product PPV
|
||||||
|
FactLine cr = fact.createLine(null,
|
||||||
|
m_pc.getAccount(ProductCost.ACCTTYPE_P_PPV, as),
|
||||||
|
as.getC_Currency_ID(), isReturnTrx ? difference.negate() : difference);
|
||||||
|
MAccount acct_cr = null;
|
||||||
|
if (cr != null)
|
||||||
|
{
|
||||||
|
cr.setQty(isReturnTrx ? getQty().negate() : getQty());
|
||||||
|
cr.setC_BPartner_ID(m_oLine.getC_BPartner_ID());
|
||||||
|
cr.setC_Activity_ID(m_oLine.getC_Activity_ID());
|
||||||
|
cr.setC_Campaign_ID(m_oLine.getC_Campaign_ID());
|
||||||
|
cr.setC_Project_ID(m_oLine.getC_Project_ID());
|
||||||
|
cr.setC_ProjectPhase_ID(m_oLine.getC_ProjectPhase_ID());
|
||||||
|
cr.setC_ProjectTask_ID(m_oLine.getC_ProjectTask_ID());
|
||||||
|
cr.setC_UOM_ID(m_oLine.getC_UOM_ID());
|
||||||
|
cr.setUser1_ID(m_oLine.getUser1_ID());
|
||||||
|
cr.setUser2_ID(m_oLine.getUser2_ID());
|
||||||
|
acct_cr = cr.getAccount(); // PPV Offset
|
||||||
|
}
|
||||||
|
|
||||||
|
// PPV Offset
|
||||||
|
FactLine dr = fact.createLine(null,
|
||||||
|
getAccount(Doc.ACCTTYPE_PPVOffset, as),
|
||||||
|
as.getC_Currency_ID(), isReturnTrx ? difference : difference.negate());
|
||||||
|
MAccount acct_db = null;
|
||||||
|
if (dr != null)
|
||||||
|
{
|
||||||
|
dr.setQty(isReturnTrx ? getQty() : getQty().negate());
|
||||||
|
dr.setC_BPartner_ID(m_oLine.getC_BPartner_ID());
|
||||||
|
dr.setC_Activity_ID(m_oLine.getC_Activity_ID());
|
||||||
|
dr.setC_Campaign_ID(m_oLine.getC_Campaign_ID());
|
||||||
|
dr.setC_Project_ID(m_oLine.getC_Project_ID());
|
||||||
|
dr.setC_ProjectPhase_ID(m_oLine.getC_ProjectPhase_ID());
|
||||||
|
dr.setC_ProjectTask_ID(m_oLine.getC_ProjectTask_ID());
|
||||||
|
dr.setC_UOM_ID(m_oLine.getC_UOM_ID());
|
||||||
|
dr.setUser1_ID(m_oLine.getUser1_ID());
|
||||||
|
dr.setUser2_ID(m_oLine.getUser2_ID());
|
||||||
|
acct_db = dr.getAccount(); // PPV
|
||||||
|
}
|
||||||
|
|
||||||
|
// Avoid usage of clearing accounts
|
||||||
|
// If both accounts Purchase Price Variance and Purchase Price Variance Offset are equal
|
||||||
|
// then remove the posting
|
||||||
|
|
||||||
|
if ((!as.isPostIfClearingEqual()) && acct_db!=null && acct_db.equals(acct_cr) && (!isInterOrg)) {
|
||||||
|
|
||||||
|
BigDecimal debit = dr.getAmtSourceDr();
|
||||||
|
BigDecimal credit = cr.getAmtSourceCr();
|
||||||
|
|
||||||
|
if (debit.compareTo(credit) == 0) {
|
||||||
|
fact.remove(dr);
|
||||||
|
fact.remove(cr);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
// End Avoid usage of clearing accounts
|
||||||
}
|
}
|
||||||
// End Avoid usage of clearing accounts
|
|
||||||
|
|
||||||
//
|
//
|
||||||
facts.add(fact);
|
facts.add(fact);
|
||||||
|
|
|
@ -1074,7 +1074,15 @@ public final class FactLine extends X_Fact_Acct
|
||||||
StringBuilder sql = new StringBuilder("SELECT * ")
|
StringBuilder sql = new StringBuilder("SELECT * ")
|
||||||
.append("FROM Fact_Acct ")
|
.append("FROM Fact_Acct ")
|
||||||
.append("WHERE C_AcctSchema_ID=? AND AD_Table_ID=? AND Record_ID=?")
|
.append("WHERE C_AcctSchema_ID=? AND AD_Table_ID=? AND Record_ID=?")
|
||||||
.append(" AND Line_ID=? AND Account_ID=?");
|
.append(" AND Account_ID=?");
|
||||||
|
if (Line_ID > 0)
|
||||||
|
{
|
||||||
|
sql.append(" AND Line_ID=? ");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sql.append(" AND Line_ID IS NULL ");
|
||||||
|
}
|
||||||
// MZ Goodwill
|
// MZ Goodwill
|
||||||
// for Inventory Move
|
// for Inventory Move
|
||||||
if (MMovement.Table_ID == AD_Table_ID)
|
if (MMovement.Table_ID == AD_Table_ID)
|
||||||
|
@ -1084,16 +1092,20 @@ public final class FactLine extends X_Fact_Acct
|
||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
int pindex=1;
|
||||||
pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
|
pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
|
||||||
pstmt.setInt(1, getC_AcctSchema_ID());
|
pstmt.setInt(pindex++, getC_AcctSchema_ID());
|
||||||
pstmt.setInt(2, AD_Table_ID);
|
pstmt.setInt(pindex++, AD_Table_ID);
|
||||||
pstmt.setInt(3, Record_ID);
|
pstmt.setInt(pindex++, Record_ID);
|
||||||
pstmt.setInt(4, Line_ID);
|
pstmt.setInt(pindex++, m_acct.getAccount_ID());
|
||||||
pstmt.setInt(5, m_acct.getAccount_ID());
|
if (Line_ID > 0)
|
||||||
|
{
|
||||||
|
pstmt.setInt(pindex++, Line_ID);
|
||||||
|
}
|
||||||
// MZ Goodwill
|
// MZ Goodwill
|
||||||
// for Inventory Move
|
// for Inventory Move
|
||||||
if (MMovement.Table_ID == AD_Table_ID)
|
if (MMovement.Table_ID == AD_Table_ID)
|
||||||
pstmt.setInt(6, getM_Locator_ID());
|
pstmt.setInt(pindex++, getM_Locator_ID());
|
||||||
// end MZ
|
// end MZ
|
||||||
rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
|
|
|
@ -1299,59 +1299,15 @@ public class MCostDetail extends X_M_CostDetail
|
||||||
history.setNewCostPrice(cost.getCurrentCostPrice());
|
history.setNewCostPrice(cost.getCurrentCostPrice());
|
||||||
history.setNewCAmt(cost.getCumulatedAmt());
|
history.setNewCAmt(cost.getCumulatedAmt());
|
||||||
history.setNewCQty(cost.getCumulatedQty());
|
history.setNewCQty(cost.getCumulatedQty());
|
||||||
if (!history.save())
|
//save history if there are movement of qty or costprice
|
||||||
return false;
|
if (history.getNewQty().compareTo(history.getOldQty()) != 0
|
||||||
|
|| history.getNewCostPrice().compareTo(history.getOldCostPrice()) != 0)
|
||||||
|
{
|
||||||
|
if (!history.save())
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return cost.save();
|
return cost.save();
|
||||||
} // process
|
} // process
|
||||||
|
|
||||||
// Elaine 2008/6/20
|
|
||||||
protected boolean afterDelete (boolean success)
|
|
||||||
{
|
|
||||||
if(success)
|
|
||||||
{
|
|
||||||
// recalculate MCost
|
|
||||||
boolean ok = false;
|
|
||||||
// get costing level for product
|
|
||||||
MAcctSchema as = new MAcctSchema (getCtx(), getC_AcctSchema_ID(), null);
|
|
||||||
MProduct product = MProduct.get(getCtx(), getM_Product_ID());
|
|
||||||
String CostingLevel = product.getCostingLevel(as);
|
|
||||||
// Org Element
|
|
||||||
int Org_ID = getAD_Org_ID();
|
|
||||||
int M_ASI_ID = getM_AttributeSetInstance_ID();
|
|
||||||
if (MAcctSchema.COSTINGLEVEL_Client.equals(CostingLevel))
|
|
||||||
{
|
|
||||||
Org_ID = 0;
|
|
||||||
M_ASI_ID = 0;
|
|
||||||
}
|
|
||||||
else if (MAcctSchema.COSTINGLEVEL_Organization.equals(CostingLevel))
|
|
||||||
M_ASI_ID = 0;
|
|
||||||
else if (MAcctSchema.COSTINGLEVEL_BatchLot.equals(CostingLevel))
|
|
||||||
Org_ID = 0;
|
|
||||||
|
|
||||||
// Create Material Cost elements
|
|
||||||
if (getM_CostElement_ID() == 0)
|
|
||||||
{
|
|
||||||
MCostElement[] ces = MCostElement.getCostingMethods(this);
|
|
||||||
for (int i = 0; i < ces.length; i++)
|
|
||||||
{
|
|
||||||
MCostElement ce = ces[i];
|
|
||||||
ok = process (as, product, ce, Org_ID, M_ASI_ID);
|
|
||||||
if (!ok)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} // Material Cost elements
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MCostElement ce = MCostElement.get(getCtx(), getM_CostElement_ID());
|
|
||||||
ok = process (as, product, ce, Org_ID, M_ASI_ID);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
return super.afterDelete(success);
|
|
||||||
}
|
|
||||||
//
|
|
||||||
|
|
||||||
} // MCostDetail
|
} // MCostDetail
|
||||||
|
|
|
@ -2152,29 +2152,8 @@ public class MInOut extends X_M_InOut implements DocAction
|
||||||
// Reverse/Delete Matching
|
// Reverse/Delete Matching
|
||||||
if (!isSOTrx())
|
if (!isSOTrx())
|
||||||
{
|
{
|
||||||
if (accrual)
|
if (!reverseMatching(reversalDate))
|
||||||
{
|
return null;
|
||||||
if (!reverseMatching(reversalDate))
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MMatchInv[] mInv = MMatchInv.getInOut(getCtx(), getM_InOut_ID(), get_TrxName());
|
|
||||||
for (int i = 0; i < mInv.length; i++)
|
|
||||||
mInv[i].deleteEx(true);
|
|
||||||
MMatchPO[] mPO = MMatchPO.getInOut(getCtx(), getM_InOut_ID(), get_TrxName());
|
|
||||||
for (int i = 0; i < mPO.length; i++)
|
|
||||||
{
|
|
||||||
if (mPO[i].getC_InvoiceLine_ID() == 0)
|
|
||||||
mPO[i].deleteEx(true);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mPO[i].setM_InOutLine_ID(0);
|
|
||||||
mPO[i].saveEx();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deep Copy
|
// Deep Copy
|
||||||
|
@ -2263,6 +2242,9 @@ public class MInOut extends X_M_InOut implements DocAction
|
||||||
MMatchInv[] mInv = MMatchInv.getInOut(getCtx(), getM_InOut_ID(), get_TrxName());
|
MMatchInv[] mInv = MMatchInv.getInOut(getCtx(), getM_InOut_ID(), get_TrxName());
|
||||||
for (MMatchInv mMatchInv : mInv)
|
for (MMatchInv mMatchInv : mInv)
|
||||||
{
|
{
|
||||||
|
if (mMatchInv.getReversal_ID() > 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
String description = mMatchInv.getDescription();
|
String description = mMatchInv.getDescription();
|
||||||
if (description == null || !description.endsWith("<-)"))
|
if (description == null || !description.endsWith("<-)"))
|
||||||
{
|
{
|
||||||
|
@ -2276,6 +2258,9 @@ public class MInOut extends X_M_InOut implements DocAction
|
||||||
MMatchPO[] mMatchPOList = MMatchPO.getInOut(getCtx(), getM_InOut_ID(), get_TrxName());
|
MMatchPO[] mMatchPOList = MMatchPO.getInOut(getCtx(), getM_InOut_ID(), get_TrxName());
|
||||||
for (MMatchPO mMatchPO : mMatchPOList)
|
for (MMatchPO mMatchPO : mMatchPOList)
|
||||||
{
|
{
|
||||||
|
if (mMatchPO.getReversal_ID() > 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
String description = mMatchPO.getDescription();
|
String description = mMatchPO.getDescription();
|
||||||
if (description == null || !description.endsWith("<-)"))
|
if (description == null || !description.endsWith("<-)"))
|
||||||
{
|
{
|
||||||
|
|
|
@ -835,6 +835,8 @@ public class MInventory extends X_M_Inventory implements DocAction
|
||||||
rLine.setQtyBook (oLine.getQtyCount()); // switch
|
rLine.setQtyBook (oLine.getQtyCount()); // switch
|
||||||
rLine.setQtyCount (oLine.getQtyBook());
|
rLine.setQtyCount (oLine.getQtyBook());
|
||||||
rLine.setQtyInternalUse (oLine.getQtyInternalUse().negate());
|
rLine.setQtyInternalUse (oLine.getQtyInternalUse().negate());
|
||||||
|
rLine.setNewCostPrice(oLine.getCurrentCostPrice());
|
||||||
|
rLine.setCurrentCostPrice(oLine.getNewCostPrice());
|
||||||
|
|
||||||
rLine.saveEx();
|
rLine.saveEx();
|
||||||
|
|
||||||
|
|
|
@ -2238,6 +2238,11 @@ public class MInvoice extends X_C_Invoice implements DocAction
|
||||||
accrual = true;
|
accrual = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!accrual)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (accrual)
|
if (accrual)
|
||||||
return reverseAccrualIt();
|
return reverseAccrualIt();
|
||||||
else
|
else
|
||||||
|
@ -2331,52 +2336,36 @@ public class MInvoice extends X_C_Invoice implements DocAction
|
||||||
// Reverse/Delete Matching
|
// Reverse/Delete Matching
|
||||||
if (!isSOTrx())
|
if (!isSOTrx())
|
||||||
{
|
{
|
||||||
if (accrual)
|
MMatchInv[] mInv = MMatchInv.getInvoice(getCtx(), getC_Invoice_ID(), get_TrxName());
|
||||||
|
for (int i = 0; i < mInv.length; i++)
|
||||||
{
|
{
|
||||||
MMatchInv[] mInv = MMatchInv.getInvoice(getCtx(), getC_Invoice_ID(), get_TrxName());
|
if (mInv[i].getReversal_ID() > 0)
|
||||||
for (int i = 0; i < mInv.length; i++)
|
continue;
|
||||||
|
|
||||||
|
if (!mInv[i].reverse(reversalDate))
|
||||||
{
|
{
|
||||||
if (!mInv[i].reverse(reversalDate))
|
m_processMsg = "Could not Reverse MatchInv";
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
MMatchPO[] mPO = MMatchPO.getInvoice(getCtx(), getC_Invoice_ID(), get_TrxName());
|
||||||
|
for (int i = 0; i < mPO.length; i++)
|
||||||
|
{
|
||||||
|
if (mPO[i].getReversal_ID() > 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (mPO[i].getM_InOutLine_ID() == 0)
|
||||||
|
{
|
||||||
|
if (!mPO[i].reverse(reversalDate))
|
||||||
{
|
{
|
||||||
m_processMsg = "Could not Reverse MatchInv";
|
m_processMsg = "Could not Reverse MatchPO";
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MMatchPO[] mPO = MMatchPO.getInvoice(getCtx(), getC_Invoice_ID(), get_TrxName());
|
else
|
||||||
for (int i = 0; i < mPO.length; i++)
|
|
||||||
{
|
{
|
||||||
if (mPO[i].getM_InOutLine_ID() == 0)
|
mPO[i].setC_InvoiceLine_ID(null);
|
||||||
{
|
mPO[i].saveEx(get_TrxName());
|
||||||
if (!mPO[i].reverse(reversalDate))
|
|
||||||
{
|
|
||||||
m_processMsg = "Could not Reverse MatchPO";
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mPO[i].setC_InvoiceLine_ID(null);
|
|
||||||
mPO[i].saveEx(get_TrxName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MMatchInv[] mInv = MMatchInv.getInvoice(getCtx(), getC_Invoice_ID(), get_TrxName());
|
|
||||||
for (int i = 0; i < mInv.length; i++)
|
|
||||||
{
|
|
||||||
mInv[i].deleteEx(true);
|
|
||||||
}
|
|
||||||
MMatchPO[] mPO = MMatchPO.getInvoice(getCtx(), getC_Invoice_ID(), get_TrxName());
|
|
||||||
for (int i = 0; i < mPO.length; i++)
|
|
||||||
{
|
|
||||||
if (mPO[i].getM_InOutLine_ID() == 0)
|
|
||||||
mPO[i].deleteEx(true);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mPO[i].setC_InvoiceLine_ID(null);
|
|
||||||
mPO[i].saveEx(get_TrxName());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,6 @@ import java.util.Properties;
|
||||||
|
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
import org.compiere.util.DB;
|
import org.compiere.util.DB;
|
||||||
import org.compiere.util.Env;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Match Invoice (Receipt<>Invoice) Model.
|
* Match Invoice (Receipt<>Invoice) Model.
|
||||||
|
@ -305,34 +304,6 @@ public class MMatchInv extends X_M_MatchInv
|
||||||
// AZ Goodwill
|
// AZ Goodwill
|
||||||
deleteMatchInvCostDetail();
|
deleteMatchInvCostDetail();
|
||||||
// end AZ
|
// end AZ
|
||||||
|
|
||||||
// delete m_matchinv doesn't auto make m_matchpo invalid
|
|
||||||
// Get Order and decrease invoices
|
|
||||||
/*
|
|
||||||
MInvoiceLine iLine = new MInvoiceLine (getCtx(), getC_InvoiceLine_ID(), get_TrxName());
|
|
||||||
int C_OrderLine_ID = iLine.getC_OrderLine_ID();
|
|
||||||
if (C_OrderLine_ID == 0)
|
|
||||||
{
|
|
||||||
MInOutLine ioLine = new MInOutLine (getCtx(), getM_InOutLine_ID(), get_TrxName());
|
|
||||||
C_OrderLine_ID = ioLine.getC_OrderLine_ID();
|
|
||||||
}
|
|
||||||
// No Order Found
|
|
||||||
if (C_OrderLine_ID == 0)
|
|
||||||
return success;
|
|
||||||
// Find MatchPO
|
|
||||||
MMatchPO[] mPO = MMatchPO.get(getCtx(), C_OrderLine_ID,
|
|
||||||
getC_InvoiceLine_ID(), get_TrxName());
|
|
||||||
for (int i = 0; i < mPO.length; i++)
|
|
||||||
{
|
|
||||||
if (mPO[i].getM_InOutLine_ID() == 0)
|
|
||||||
mPO[i].delete(true);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mPO[i].setC_InvoiceLine_ID(null);
|
|
||||||
mPO[i].saveEx();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
return success;
|
return success;
|
||||||
} // afterDelete
|
} // afterDelete
|
||||||
|
@ -352,43 +323,11 @@ public class MMatchInv extends X_M_MatchInv
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// update/delete Cost Detail and recalculate Current Cost
|
MCostDetail cd = MCostDetail.get (getCtx(), "M_MatchInv_ID=?",
|
||||||
MCostDetail cd = MCostDetail.get (getCtx(), "C_InvoiceLine_ID=?",
|
getM_MatchInv_ID(), getM_AttributeSetInstance_ID(), as.getC_AcctSchema_ID(), get_TrxName());
|
||||||
getC_InvoiceLine_ID(), getM_AttributeSetInstance_ID(), as.getC_AcctSchema_ID(), get_TrxName());
|
|
||||||
if (cd != null)
|
if (cd != null)
|
||||||
{
|
{
|
||||||
if (cd.isProcessed())
|
cd.deleteEx(true);
|
||||||
{
|
|
||||||
MInOut receipt = (new MInOutLine(getCtx(),getM_InOutLine_ID(),get_TrxName())).getParent();
|
|
||||||
BigDecimal qty = getQty();
|
|
||||||
if (receipt.getMovementType().equals(MInOut.MOVEMENTTYPE_VendorReturns))
|
|
||||||
qty = getQty().negate();
|
|
||||||
//
|
|
||||||
BigDecimal price = null;
|
|
||||||
if (cd.getQty().compareTo(Env.ZERO) == 0) // avoid division by zero
|
|
||||||
price = Env.ZERO;
|
|
||||||
else
|
|
||||||
price = cd.getAmt().divide(cd.getQty(),12,BigDecimal.ROUND_HALF_UP);
|
|
||||||
cd.setDeltaAmt(price.multiply(qty.negate()));
|
|
||||||
cd.setDeltaQty(qty.negate());
|
|
||||||
cd.setProcessed(false);
|
|
||||||
//
|
|
||||||
cd.setAmt(price.multiply(cd.getQty().subtract(qty)));
|
|
||||||
cd.setQty(cd.getQty().subtract(qty));
|
|
||||||
if (!cd.isProcessed())
|
|
||||||
{
|
|
||||||
cd.process();
|
|
||||||
}
|
|
||||||
if (cd.getQty().compareTo(Env.ZERO) == 0)
|
|
||||||
{
|
|
||||||
cd.setProcessed(false);
|
|
||||||
cd.delete(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cd.delete(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1032,10 +1032,6 @@ public class MMatchPO extends X_M_MatchPO
|
||||||
// (Reserved in VMatch and MInOut.completeIt)
|
// (Reserved in VMatch and MInOut.completeIt)
|
||||||
if (success && getC_OrderLine_ID() != 0)
|
if (success && getC_OrderLine_ID() != 0)
|
||||||
{
|
{
|
||||||
// AZ Goodwill
|
|
||||||
deleteMatchPOCostDetail();
|
|
||||||
// end AZ
|
|
||||||
|
|
||||||
MOrderLine orderLine = new MOrderLine (getCtx(), getC_OrderLine_ID(), get_TrxName());
|
MOrderLine orderLine = new MOrderLine (getCtx(), getC_OrderLine_ID(), get_TrxName());
|
||||||
if (getM_InOutLine_ID() != 0)
|
if (getM_InOutLine_ID() != 0)
|
||||||
orderLine.setQtyDelivered(orderLine.getQtyDelivered().subtract(getQty()));
|
orderLine.setQtyDelivered(orderLine.getQtyDelivered().subtract(getQty()));
|
||||||
|
@ -1136,58 +1132,6 @@ public class MMatchPO extends X_M_MatchPO
|
||||||
if (s_log.isLoggable(Level.INFO)) s_log.info("Success #" + success + " - Error #" + errors);
|
if (s_log.isLoggable(Level.INFO)) s_log.info("Success #" + success + " - Error #" + errors);
|
||||||
} // consolidate
|
} // consolidate
|
||||||
|
|
||||||
//AZ Goodwill
|
|
||||||
private String deleteMatchPOCostDetail()
|
|
||||||
{
|
|
||||||
// Get Account Schemas to delete MCostDetail
|
|
||||||
MAcctSchema[] acctschemas = MAcctSchema.getClientAcctSchema(getCtx(), getAD_Client_ID());
|
|
||||||
for(int asn = 0; asn < acctschemas.length; asn++)
|
|
||||||
{
|
|
||||||
MAcctSchema as = acctschemas[asn];
|
|
||||||
|
|
||||||
if (as.isSkipOrg(getAD_Org_ID()))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// update/delete Cost Detail and recalculate Current Cost
|
|
||||||
MCostDetail cd = MCostDetail.get (getCtx(), "C_OrderLine_ID=?",
|
|
||||||
getC_OrderLine_ID(), getM_AttributeSetInstance_ID(), as.getC_AcctSchema_ID(), get_TrxName());
|
|
||||||
if (cd != null)
|
|
||||||
{
|
|
||||||
if (cd.isProcessed())
|
|
||||||
{
|
|
||||||
if (cd.getQty().compareTo(Env.ZERO) > 0)
|
|
||||||
{
|
|
||||||
BigDecimal price = cd.getAmt().divide(cd.getQty(),12,BigDecimal.ROUND_HALF_UP);
|
|
||||||
cd.setDeltaAmt(price.multiply(getQty().negate()));
|
|
||||||
cd.setDeltaQty(getQty().negate());
|
|
||||||
cd.setProcessed(false);
|
|
||||||
//
|
|
||||||
cd.setAmt(price.multiply(cd.getQty().subtract(getQty())));
|
|
||||||
cd.setQty(cd.getQty().subtract(getQty()));
|
|
||||||
if (!cd.isProcessed())
|
|
||||||
{
|
|
||||||
cd.process();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//after process clean-up
|
|
||||||
if (cd.getQty().compareTo(Env.ZERO) == 0)
|
|
||||||
{
|
|
||||||
cd.setProcessed(false);
|
|
||||||
cd.delete(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cd.delete(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse MatchPO.
|
* Reverse MatchPO.
|
||||||
* @param reversalDate
|
* @param reversalDate
|
||||||
|
|
|
@ -64,6 +64,7 @@ import org.zkoss.zk.ui.event.Events;
|
||||||
import org.zkoss.zul.A;
|
import org.zkoss.zul.A;
|
||||||
import org.zkoss.zul.Borderlayout;
|
import org.zkoss.zul.Borderlayout;
|
||||||
import org.zkoss.zul.Center;
|
import org.zkoss.zul.Center;
|
||||||
|
import org.zkoss.zul.Hbox;
|
||||||
import org.zkoss.zul.Hlayout;
|
import org.zkoss.zul.Hlayout;
|
||||||
import org.zkoss.zul.North;
|
import org.zkoss.zul.North;
|
||||||
import org.zkoss.zul.Separator;
|
import org.zkoss.zul.Separator;
|
||||||
|
@ -200,8 +201,10 @@ public class WAllocation extends Allocation
|
||||||
row.appendCellChild(bpartnerLabel.rightAlign());
|
row.appendCellChild(bpartnerLabel.rightAlign());
|
||||||
bpartnerSearch.getComponent().setHflex("true");
|
bpartnerSearch.getComponent().setHflex("true");
|
||||||
row.appendCellChild(bpartnerSearch.getComponent(),2);
|
row.appendCellChild(bpartnerSearch.getComponent(),2);
|
||||||
row.appendCellChild(dateLabel.rightAlign());
|
Hbox box = new Hbox();
|
||||||
row.appendCellChild(dateField.getComponent());
|
box.appendChild(dateLabel.rightAlign());
|
||||||
|
box.appendChild(dateField.getComponent());
|
||||||
|
row.appendCellChild(box);
|
||||||
row.appendCellChild(organizationLabel.rightAlign());
|
row.appendCellChild(organizationLabel.rightAlign());
|
||||||
organizationPick.getComponent().setHflex("true");
|
organizationPick.getComponent().setHflex("true");
|
||||||
row.appendCellChild(organizationPick.getComponent(),1);
|
row.appendCellChild(organizationPick.getComponent(),1);
|
||||||
|
@ -210,7 +213,7 @@ public class WAllocation extends Allocation
|
||||||
row.appendCellChild(currencyLabel.rightAlign(),1);
|
row.appendCellChild(currencyLabel.rightAlign(),1);
|
||||||
currencyPick.getComponent().setHflex("true");
|
currencyPick.getComponent().setHflex("true");
|
||||||
row.appendCellChild(currencyPick.getComponent(),1);
|
row.appendCellChild(currencyPick.getComponent(),1);
|
||||||
row.appendCellChild(multiCurrency,2);
|
row.appendCellChild(multiCurrency,1);
|
||||||
row.appendCellChild(autoWriteOff,2);
|
row.appendCellChild(autoWriteOff,2);
|
||||||
row.appendCellChild(new Space(),1);
|
row.appendCellChild(new Space(),1);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue