IDEMPIERE-5602: removing priceEntered and added LineNetAmt on Expense report line. (#2138)
Co-authored-by: Carlos Ruiz <carg67@gmail.com>
This commit is contained in:
parent
6f110b2d2f
commit
f39dfd1dc3
|
@ -0,0 +1,51 @@
|
||||||
|
-- Added Line Amount field in Expense Report Line and removed Price field from Expense Report Line
|
||||||
|
SELECT register_migration_script('202312041613_IDEMPIERE-5602.sql') FROM dual;
|
||||||
|
|
||||||
|
SET SQLBLANKLINES ON
|
||||||
|
SET DEFINE OFF
|
||||||
|
|
||||||
|
--Update Expense Amt
|
||||||
|
UPDATE S_TimeExpenseLine SET ExpenseAmt = PriceEntered WHERE PriceEntered > 0 AND IsTimeReport = 'N';
|
||||||
|
|
||||||
|
--Update Converted Amt
|
||||||
|
UPDATE S_TimeExpenseLine SET ConvertedAmt = currencyconvert(ExpenseAmt,C_Currency_ID,(SELECT pl.C_Currency_ID FROM S_TimeExpense te INNER JOIN M_PriceList pl ON pl.M_PriceList_ID=te.M_PriceList_ID WHERE te.S_TimeExpense_ID=S_TimeExpenseLine.S_TimeExpense_ID),DateExpense,0,AD_Client_ID,AD_Org_ID) WHERE ExpenseAmt > 0 AND IsTimeReport = 'N';
|
||||||
|
|
||||||
|
-- Dec 4, 2023, 4:16:29 PM IST
|
||||||
|
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure,IsHtml) VALUES (216303,0,'Line Amount','Line Extended Amount (Quantity * Actual Price) without Freight and Charges','Indicates the extended line amount based on the quantity and the actual price. Any additional charges or freight are not included. The Amount may or may not include tax. If the price list is inclusive tax, the line amount is the same as the line total.',488,'LineNetAmt',22,'N','N','N','N','N',0,'N',12,0,0,'Y',TO_TIMESTAMP('2023-12-04 16:16:28','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-12-04 16:16:28','YYYY-MM-DD HH24:MI:SS'),100,441,'Y','N','D','N','N','N','Y','e3f82050-95c4-4c53-8e3b-8e9344000ea2','Y',0,'N','N','N')
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Dec 4, 2023, 4:16:47 PM IST
|
||||||
|
ALTER TABLE S_TimeExpenseLine ADD LineNetAmt NUMBER DEFAULT NULL
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Dec 4, 2023, 4:20:04 PM IST
|
||||||
|
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,DisplayLogic,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan) VALUES (208092,'Line Amount','Line Extended Amount (Quantity * Actual Price) without Freight and Charges','Indicates the extended line amount based on the quantity and the actual price. Any additional charges or freight are not included. The Amount may or may not include tax. If the price list is inclusive tax, the line amount is the same as the line total.',413,216303,'Y',22,155,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2023-12-04 16:20:04','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-12-04 16:20:04','YYYY-MM-DD HH24:MI:SS'),100,'Y','Y','@IsTimeReport@=N | @IsInvoiced@=Y','D','fd80a0f0-b3ab-49c4-8020-867a858d6b0f','Y',155,2)
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Dec 4, 2023, 4:25:01 PM IST
|
||||||
|
UPDATE AD_Column SET Callout='org.compiere.model.CalloutTimeExpense.amount',Updated=TO_DATE('2023-12-04 16:25:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=6875
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Dec 4, 2023, 4:30:07 PM IST
|
||||||
|
UPDATE AD_Field SET XPosition=1,Updated=TO_DATE('2023-12-04 16:30:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5463
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Dec 4, 2023, 4:30:07 PM IST
|
||||||
|
UPDATE AD_Field SET IsReadOnly='N',Updated=TO_DATE('2023-12-04 16:30:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5462
|
||||||
|
;
|
||||||
|
|
||||||
|
-- 04-Dec-2023, 4:49:15 PM IST
|
||||||
|
DELETE FROM AD_Field WHERE AD_Field_ID=207572
|
||||||
|
;
|
||||||
|
|
||||||
|
-- 04-Dec-2023, 4:49:32 PM IST
|
||||||
|
DELETE FROM AD_Column WHERE AD_Column_ID=215777
|
||||||
|
;
|
||||||
|
|
||||||
|
-- 04-Dec-2023, 4:49:32 PM IST
|
||||||
|
ALTER TABLE S_TimeExpenseLine DROP COLUMN PriceEntered
|
||||||
|
;
|
||||||
|
|
||||||
|
--Set Line Amount
|
||||||
|
UPDATE S_TimeExpenseLine SET LineNetAmt = ExpenseAmt * Qty WHERE ExpenseAmt > 0 AND IsTimeReport = 'N';
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
-- Added Line Amount field in Expense Report Line and removed Price field from Expense Report Line
|
||||||
|
SELECT register_migration_script('202312041613_IDEMPIERE-5602.sql') FROM dual;
|
||||||
|
|
||||||
|
--Update Expense Amt
|
||||||
|
UPDATE S_TimeExpenseLine SET ExpenseAmt = PriceEntered WHERE PriceEntered > 0 AND IsTimeReport = 'N';
|
||||||
|
|
||||||
|
--Update Converted Amt
|
||||||
|
UPDATE S_TimeExpenseLine SET ConvertedAmt = currencyconvert(ExpenseAmt,C_Currency_ID,(SELECT pl.C_Currency_ID FROM S_TimeExpense te INNER JOIN M_PriceList pl ON pl.M_PriceList_ID=te.M_PriceList_ID WHERE te.S_TimeExpense_ID=S_TimeExpenseLine.S_TimeExpense_ID),DateExpense,0,AD_Client_ID,AD_Org_ID) WHERE ExpenseAmt > 0 AND IsTimeReport = 'N';
|
||||||
|
|
||||||
|
-- Dec 4, 2023, 4:16:29 PM IST
|
||||||
|
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure,IsHtml) VALUES (216303,0,'Line Amount','Line Extended Amount (Quantity * Actual Price) without Freight and Charges','Indicates the extended line amount based on the quantity and the actual price. Any additional charges or freight are not included. The Amount may or may not include tax. If the price list is inclusive tax, the line amount is the same as the line total.',488,'LineNetAmt',22,'N','N','N','N','N',0,'N',12,0,0,'Y',TO_TIMESTAMP('2023-12-04 16:16:28','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-12-04 16:16:28','YYYY-MM-DD HH24:MI:SS'),100,441,'Y','N','D','N','N','N','Y','e3f82050-95c4-4c53-8e3b-8e9344000ea2','Y',0,'N','N','N')
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Dec 4, 2023, 4:16:47 PM IST
|
||||||
|
ALTER TABLE S_TimeExpenseLine ADD COLUMN LineNetAmt NUMERIC DEFAULT NULL
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Dec 4, 2023, 4:20:04 PM IST
|
||||||
|
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,DisplayLogic,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan) VALUES (208092,'Line Amount','Line Extended Amount (Quantity * Actual Price) without Freight and Charges','Indicates the extended line amount based on the quantity and the actual price. Any additional charges or freight are not included. The Amount may or may not include tax. If the price list is inclusive tax, the line amount is the same as the line total.',413,216303,'Y',22,155,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2023-12-04 16:20:04','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-12-04 16:20:04','YYYY-MM-DD HH24:MI:SS'),100,'Y','Y','@IsTimeReport@=N | @IsInvoiced@=Y','D','fd80a0f0-b3ab-49c4-8020-867a858d6b0f','Y',155,2)
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Dec 4, 2023, 4:25:01 PM IST
|
||||||
|
UPDATE AD_Column SET Callout='org.compiere.model.CalloutTimeExpense.amount',Updated=TO_TIMESTAMP('2023-12-04 16:25:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=6875
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Dec 4, 2023, 4:30:07 PM IST
|
||||||
|
UPDATE AD_Field SET XPosition=1,Updated=TO_TIMESTAMP('2023-12-04 16:30:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5463
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Dec 4, 2023, 4:30:07 PM IST
|
||||||
|
UPDATE AD_Field SET IsReadOnly='N',Updated=TO_DATE('2023-12-04 16:30:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5462
|
||||||
|
;
|
||||||
|
|
||||||
|
-- 04-Dec-2023, 4:49:15 PM IST
|
||||||
|
DELETE FROM AD_Field WHERE AD_Field_ID=207572
|
||||||
|
;
|
||||||
|
|
||||||
|
-- 04-Dec-2023, 4:49:32 PM IST
|
||||||
|
DELETE FROM AD_Column WHERE AD_Column_ID=215777
|
||||||
|
;
|
||||||
|
|
||||||
|
-- 04-Dec-2023, 4:49:32 PM IST
|
||||||
|
ALTER TABLE S_TimeExpenseLine DROP COLUMN PriceEntered
|
||||||
|
;
|
||||||
|
|
||||||
|
--Set Line Amount
|
||||||
|
UPDATE S_TimeExpenseLine SET LineNetAmt = ExpenseAmt * Qty WHERE ExpenseAmt > 0 AND IsTimeReport = 'N';
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class CalloutTimeExpense extends CalloutEngine
|
||||||
/**
|
/**
|
||||||
* Expense Report Line
|
* Expense Report Line
|
||||||
* - called from M_Product_ID, S_ResourceAssignment_ID
|
* - called from M_Product_ID, S_ResourceAssignment_ID
|
||||||
* - set Price
|
* - set ExpenseAmt
|
||||||
* @param ctx context
|
* @param ctx context
|
||||||
* @param WindowNo current Window No
|
* @param WindowNo current Window No
|
||||||
* @param mTab Grid Tab
|
* @param mTab Grid Tab
|
||||||
|
@ -165,14 +165,14 @@ public class CalloutTimeExpense extends CalloutEngine
|
||||||
// finish
|
// finish
|
||||||
if (priceActual == null)
|
if (priceActual == null)
|
||||||
priceActual = Env.ZERO;
|
priceActual = Env.ZERO;
|
||||||
mTab.setValue("PriceEntered", priceActual);
|
mTab.setValue("ExpenseAmt", priceActual);
|
||||||
return "";
|
return "";
|
||||||
} // Expense_Product
|
} // Expense_Product
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Expense - Amount.
|
* Expense - Amount.
|
||||||
* - called from ExpenseAmt, C_Currency_ID
|
* - called from ExpenseAmt, C_Currency_ID
|
||||||
* - calculates ConvertedAmt
|
* - calculates ConvertedAmt and Line Net Amount
|
||||||
* @param ctx context
|
* @param ctx context
|
||||||
* @param WindowNo current Window No
|
* @param WindowNo current Window No
|
||||||
* @param mTab Grid Tab
|
* @param mTab Grid Tab
|
||||||
|
@ -204,53 +204,14 @@ public class CalloutTimeExpense extends CalloutEngine
|
||||||
DateExpense, 0, AD_Client_ID, AD_Org_ID);
|
DateExpense, 0, AD_Client_ID, AD_Org_ID);
|
||||||
}
|
}
|
||||||
mTab.setValue("ConvertedAmt", ConvertedAmt);
|
mTab.setValue("ConvertedAmt", ConvertedAmt);
|
||||||
|
|
||||||
|
BigDecimal qty = (BigDecimal)mTab.getValue(MTimeExpenseLine.COLUMNNAME_Qty);
|
||||||
|
BigDecimal lineNetAmt = ExpenseAmt.multiply(qty);
|
||||||
|
mTab.setValue(MTimeExpenseLine.COLUMNNAME_LineNetAmt, lineNetAmt);
|
||||||
|
|
||||||
if (log.isLoggable(Level.FINE)) log.fine("= ConvertedAmt=" + ConvertedAmt);
|
if (log.isLoggable(Level.FINE)) log.fine("= ConvertedAmt=" + ConvertedAmt);
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
} // Expense_Amount
|
} // Expense_Amount
|
||||||
|
|
||||||
/**
|
|
||||||
* Price or Quantity.
|
|
||||||
* - called from Price, Quantity
|
|
||||||
* - calculates Expense Amount
|
|
||||||
* @param ctx context
|
|
||||||
* @param WindowNo current Window No
|
|
||||||
* @param mTab Grid Tab
|
|
||||||
* @param mField Grid Field
|
|
||||||
* @param value New Value
|
|
||||||
* @return null or error message
|
|
||||||
*/
|
|
||||||
public String priceOrQty(Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value)
|
|
||||||
{
|
|
||||||
BigDecimal qty = Env.ZERO;
|
|
||||||
BigDecimal price = Env.ZERO;
|
|
||||||
|
|
||||||
String columnName = mField.getColumnName();
|
|
||||||
if (MTimeExpenseLine.COLUMNNAME_Qty.equals(columnName))
|
|
||||||
{
|
|
||||||
qty = (BigDecimal) value;
|
|
||||||
price = (BigDecimal) mTab.getValue(MTimeExpenseLine.COLUMNNAME_PriceEntered);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
price = (BigDecimal) value;
|
|
||||||
qty = (BigDecimal) mTab.getValue(MTimeExpenseLine.COLUMNNAME_Qty);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(qty == null)
|
|
||||||
{
|
|
||||||
qty = Env.ZERO;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(price == null)
|
|
||||||
{
|
|
||||||
price = Env.ZERO;
|
|
||||||
}
|
|
||||||
|
|
||||||
BigDecimal expenseAmt = price.multiply(qty);
|
|
||||||
mTab.setValue(MTimeExpenseLine.COLUMNNAME_ExpenseAmt, expenseAmt);
|
|
||||||
|
|
||||||
return "";
|
|
||||||
} // Price or Quantity
|
|
||||||
|
|
||||||
} // CalloutTimeExpense
|
} // CalloutTimeExpense
|
||||||
|
|
|
@ -16,14 +16,12 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.compiere.process;
|
package org.compiere.process;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import org.compiere.model.MBPartner;
|
import org.compiere.model.MBPartner;
|
||||||
import org.compiere.model.MConversionRate;
|
|
||||||
import org.compiere.model.MOrder;
|
import org.compiere.model.MOrder;
|
||||||
import org.compiere.model.MOrderLine;
|
import org.compiere.model.MOrderLine;
|
||||||
import org.compiere.model.MProcessPara;
|
import org.compiere.model.MProcessPara;
|
||||||
|
@ -31,7 +29,6 @@ import org.compiere.model.MProject;
|
||||||
import org.compiere.model.MTimeExpense;
|
import org.compiere.model.MTimeExpense;
|
||||||
import org.compiere.model.MTimeExpenseLine;
|
import org.compiere.model.MTimeExpenseLine;
|
||||||
import org.compiere.util.DB;
|
import org.compiere.util.DB;
|
||||||
import org.compiere.util.Env;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create Sales Orders from Expense Reports
|
* Create Sales Orders from Expense Reports
|
||||||
|
@ -238,17 +235,7 @@ public class ExpenseSOrder extends SvrProcess
|
||||||
ol.setC_Activity_ID(tel.getC_Activity_ID());
|
ol.setC_Activity_ID(tel.getC_Activity_ID());
|
||||||
ol.setC_Campaign_ID(tel.getC_Campaign_ID());
|
ol.setC_Campaign_ID(tel.getC_Campaign_ID());
|
||||||
//
|
//
|
||||||
BigDecimal price = tel.getPriceInvoiced(); //
|
ol.setPrice(tel.getPriceReimbursed()); //
|
||||||
if (price != null && price.compareTo(Env.ZERO) != 0)
|
|
||||||
{
|
|
||||||
if (tel.getC_Currency_ID() != m_order.getC_Currency_ID())
|
|
||||||
price = MConversionRate.convert(getCtx(), price,
|
|
||||||
tel.getC_Currency_ID(), m_order.getC_Currency_ID(),
|
|
||||||
m_order.getAD_Client_ID(), m_order.getAD_Org_ID());
|
|
||||||
ol.setPrice(price);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
ol.setPrice();
|
|
||||||
if (tel.getC_UOM_ID() != 0 && ol.getC_UOM_ID() == 0)
|
if (tel.getC_UOM_ID() != 0 && ol.getC_UOM_ID() == 0)
|
||||||
ol.setC_UOM_ID(tel.getC_UOM_ID());
|
ol.setC_UOM_ID(tel.getC_UOM_ID());
|
||||||
ol.setTax();
|
ol.setTax();
|
||||||
|
|
|
@ -373,18 +373,18 @@ public interface I_S_TimeExpenseLine
|
||||||
*/
|
*/
|
||||||
public String getNote();
|
public String getNote();
|
||||||
|
|
||||||
/** Column name PriceEntered */
|
/** Column name LineNetAmt */
|
||||||
public static final String COLUMNNAME_PriceEntered = "PriceEntered";
|
public static final String COLUMNNAME_LineNetAmt = "LineNetAmt";
|
||||||
|
|
||||||
/** Set Price.
|
/** Set Line Amount.
|
||||||
* Price Entered - the price based on the selected/base UoM
|
* Line Extended Amount (Quantity * Actual Price) without Freight and Charges
|
||||||
*/
|
*/
|
||||||
public void setPriceEntered (BigDecimal PriceEntered);
|
public void setLineNetAmt (BigDecimal LineNetAmt);
|
||||||
|
|
||||||
/** Get Price.
|
/** Get Line Amount.
|
||||||
* Price Entered - the price based on the selected/base UoM
|
* Line Extended Amount (Quantity * Actual Price) without Freight and Charges
|
||||||
*/
|
*/
|
||||||
public BigDecimal getPriceEntered();
|
public BigDecimal getLineNetAmt();
|
||||||
|
|
||||||
/** Column name PriceInvoiced */
|
/** Column name PriceInvoiced */
|
||||||
public static final String COLUMNNAME_PriceInvoiced = "PriceInvoiced";
|
public static final String COLUMNNAME_PriceInvoiced = "PriceInvoiced";
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class MTimeExpenseLine extends X_S_TimeExpenseLine
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -815975460880303779L;
|
private static final long serialVersionUID = 3580618153284679385L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UUID based Constructor
|
* UUID based Constructor
|
||||||
|
@ -170,7 +170,7 @@ public class MTimeExpenseLine extends X_S_TimeExpenseLine
|
||||||
*/
|
*/
|
||||||
public BigDecimal getApprovalAmt()
|
public BigDecimal getApprovalAmt()
|
||||||
{
|
{
|
||||||
return getConvertedAmt();
|
return getQty().multiply(getConvertedAmt());
|
||||||
} // getApprovalAmt
|
} // getApprovalAmt
|
||||||
|
|
||||||
|
|
||||||
|
@ -211,19 +211,6 @@ public class MTimeExpenseLine extends X_S_TimeExpenseLine
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//calculate expense amount
|
|
||||||
if(newRecord || is_ValueChanged(COLUMNNAME_Qty) || is_ValueChanged(COLUMNNAME_PriceEntered))
|
|
||||||
{
|
|
||||||
BigDecimal price = getPriceEntered();
|
|
||||||
if(price == null)
|
|
||||||
{
|
|
||||||
price = Env.ZERO;
|
|
||||||
}
|
|
||||||
|
|
||||||
BigDecimal expenseAmt = price.multiply(getQty());
|
|
||||||
setExpenseAmt(expenseAmt);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Calculate Converted Amount
|
// Calculate Converted Amount
|
||||||
if (newRecord || is_ValueChanged("ExpenseAmt") || is_ValueChanged("C_Currency_ID"))
|
if (newRecord || is_ValueChanged("ExpenseAmt") || is_ValueChanged("C_Currency_ID"))
|
||||||
{
|
{
|
||||||
|
@ -236,10 +223,19 @@ public class MTimeExpenseLine extends X_S_TimeExpenseLine
|
||||||
getDateExpense(), 0, getAD_Client_ID(), getAD_Org_ID()) );
|
getDateExpense(), 0, getAD_Client_ID(), getAD_Org_ID()) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// calculate Line Net Amount
|
||||||
|
if (newRecord || is_ValueChanged(COLUMNNAME_Qty) || is_ValueChanged(COLUMNNAME_ExpenseAmt))
|
||||||
|
{
|
||||||
|
BigDecimal lineNetAmt = getExpenseAmt().multiply(getQty());
|
||||||
|
setLineNetAmt(lineNetAmt);
|
||||||
|
}
|
||||||
|
|
||||||
if (isTimeReport())
|
if (isTimeReport())
|
||||||
{
|
{
|
||||||
setExpenseAmt(Env.ZERO);
|
setExpenseAmt(Env.ZERO);
|
||||||
setConvertedAmt(Env.ZERO);
|
setConvertedAmt(Env.ZERO);
|
||||||
|
setLineNetAmt(Env.ZERO);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} // beforeSave
|
} // beforeSave
|
||||||
|
@ -329,7 +325,7 @@ public class MTimeExpenseLine extends X_S_TimeExpenseLine
|
||||||
{
|
{
|
||||||
String sql = "UPDATE S_TimeExpense te"
|
String sql = "UPDATE S_TimeExpense te"
|
||||||
+ " SET ApprovalAmt = "
|
+ " SET ApprovalAmt = "
|
||||||
+ "(SELECT SUM(ConvertedAmt) FROM S_TimeExpenseLine tel "
|
+ "(SELECT SUM(Qty*ConvertedAmt) FROM S_TimeExpenseLine tel "
|
||||||
+ "WHERE te.S_TimeExpense_ID=tel.S_TimeExpense_ID) "
|
+ "WHERE te.S_TimeExpense_ID=tel.S_TimeExpense_ID) "
|
||||||
+ "WHERE S_TimeExpense_ID=" + getS_TimeExpense_ID();
|
+ "WHERE S_TimeExpense_ID=" + getS_TimeExpense_ID();
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class X_S_TimeExpenseLine extends PO implements I_S_TimeExpenseLine, I_Pe
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 20231222L;
|
private static final long serialVersionUID = 20240102L;
|
||||||
|
|
||||||
/** Standard Constructor */
|
/** Standard Constructor */
|
||||||
public X_S_TimeExpenseLine (Properties ctx, int S_TimeExpenseLine_ID, String trxName)
|
public X_S_TimeExpenseLine (Properties ctx, int S_TimeExpenseLine_ID, String trxName)
|
||||||
|
@ -622,20 +622,21 @@ public class X_S_TimeExpenseLine extends PO implements I_S_TimeExpenseLine, I_Pe
|
||||||
return (String)get_Value(COLUMNNAME_Note);
|
return (String)get_Value(COLUMNNAME_Note);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Set Price.
|
/** Set Line Amount.
|
||||||
@param PriceEntered Price Entered - the price based on the selected/base UoM
|
@param LineNetAmt
|
||||||
|
Line Extended Amount (Quantity * Actual Price) without Freight and Charges
|
||||||
*/
|
*/
|
||||||
public void setPriceEntered (BigDecimal PriceEntered)
|
public void setLineNetAmt (BigDecimal LineNetAmt)
|
||||||
{
|
{
|
||||||
set_Value (COLUMNNAME_PriceEntered, PriceEntered);
|
set_Value (COLUMNNAME_LineNetAmt, LineNetAmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get Price.
|
/** Get Line Amount.
|
||||||
@return Price Entered - the price based on the selected/base UoM
|
@return Line Extended Amount (Quantity * Actual Price) without Freight and Charges
|
||||||
*/
|
*/
|
||||||
public BigDecimal getPriceEntered()
|
public BigDecimal getLineNetAmt ()
|
||||||
{
|
{
|
||||||
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_PriceEntered);
|
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_LineNetAmt);
|
||||||
if (bd == null)
|
if (bd == null)
|
||||||
return Env.ZERO;
|
return Env.ZERO;
|
||||||
return bd;
|
return bd;
|
||||||
|
|
Loading…
Reference in New Issue