BF [ 2317305 ] Update Invoice header only if doc is not processed
This commit is contained in:
parent
9c1c4ea524
commit
d68654a299
|
@ -851,6 +851,10 @@ public class MInvoiceLine extends X_C_InvoiceLine
|
||||||
*/
|
*/
|
||||||
private boolean updateHeaderTax()
|
private boolean updateHeaderTax()
|
||||||
{
|
{
|
||||||
|
// Update header only if the document is not processed - teo_sarca BF [ 2317305 ]
|
||||||
|
if (isProcessed() && !is_ValueChanged(COLUMNNAME_Processed))
|
||||||
|
return true;
|
||||||
|
|
||||||
// Recalculate Tax for this Tax
|
// Recalculate Tax for this Tax
|
||||||
if (!updateInvoiceTax(false))
|
if (!updateInvoiceTax(false))
|
||||||
return false;
|
return false;
|
||||||
|
@ -859,21 +863,21 @@ public class MInvoiceLine extends X_C_InvoiceLine
|
||||||
String sql = "UPDATE C_Invoice i"
|
String sql = "UPDATE C_Invoice i"
|
||||||
+ " SET TotalLines="
|
+ " SET TotalLines="
|
||||||
+ "(SELECT COALESCE(SUM(LineNetAmt),0) FROM C_InvoiceLine il WHERE i.C_Invoice_ID=il.C_Invoice_ID) "
|
+ "(SELECT COALESCE(SUM(LineNetAmt),0) FROM C_InvoiceLine il WHERE i.C_Invoice_ID=il.C_Invoice_ID) "
|
||||||
+ "WHERE C_Invoice_ID=" + getC_Invoice_ID();
|
+ "WHERE C_Invoice_ID=?";
|
||||||
int no = DB.executeUpdate(sql, get_TrxName());
|
int no = DB.executeUpdateEx(sql, new Object[]{getC_Invoice_ID()}, get_TrxName());
|
||||||
if (no != 1)
|
if (no != 1)
|
||||||
log.warning("(1) #" + no);
|
log.warning("(1) #" + no);
|
||||||
|
|
||||||
if (isTaxIncluded())
|
if (isTaxIncluded())
|
||||||
sql = "UPDATE C_Invoice i "
|
sql = "UPDATE C_Invoice i "
|
||||||
+ " SET GrandTotal=TotalLines "
|
+ " SET GrandTotal=TotalLines "
|
||||||
+ "WHERE C_Invoice_ID=" + getC_Invoice_ID();
|
+ "WHERE C_Invoice_ID=?";
|
||||||
else
|
else
|
||||||
sql = "UPDATE C_Invoice i "
|
sql = "UPDATE C_Invoice i "
|
||||||
+ " SET GrandTotal=TotalLines+"
|
+ " SET GrandTotal=TotalLines+"
|
||||||
+ "(SELECT COALESCE(SUM(TaxAmt),0) FROM C_InvoiceTax it WHERE i.C_Invoice_ID=it.C_Invoice_ID) "
|
+ "(SELECT COALESCE(SUM(TaxAmt),0) FROM C_InvoiceTax it WHERE i.C_Invoice_ID=it.C_Invoice_ID) "
|
||||||
+ "WHERE C_Invoice_ID=" + getC_Invoice_ID();
|
+ "WHERE C_Invoice_ID=?";
|
||||||
no = DB.executeUpdate(sql, get_TrxName());
|
no = DB.executeUpdateEx(sql, new Object[]{getC_Invoice_ID()}, get_TrxName());
|
||||||
if (no != 1)
|
if (no != 1)
|
||||||
log.warning("(2) #" + no);
|
log.warning("(2) #" + no);
|
||||||
m_parent = null;
|
m_parent = null;
|
||||||
|
|
Loading…
Reference in New Issue