📄 mproductprice.java
字号:
/******************************************************************************
* The contents of this file are subject to the Compiere License Version 1.1
* ("License"); You may not use this file except in compliance with the License
* You may obtain a copy of the License at http://www.compiere.org/license.html
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
* the specific language governing rights and limitations under the License.
* The Original Code is Compiere ERP & CRM Smart Business Solution. The Initial
* Developer of the Original Code is Jorg Janke. Portions created by Jorg Janke
* are Copyright (C) 1999-2005 Jorg Janke.
* All parts are Copyright (C) 1999-2005 ComPiere, Inc. All Rights Reserved.
* Contributor(s): ______________________________________.
*****************************************************************************/
package org.compiere.model;
import java.math.*;
import java.sql.*;
import java.util.*;
import java.util.logging.*;
import org.compiere.util.*;
/**
* Product Price
*
* @author Jorg Janke
* @version $Id: MProductPrice.java,v 1.11 2005/10/26 00:37:42 jjanke Exp $
*/
public class MProductPrice extends X_M_ProductPrice
{
/**
* Get Product Price
* @param ctx ctx
* @param M_PriceList_Version_ID id
* @param M_Product_ID id
* @param trxName trx
* @return product price or null
*/
public static MProductPrice get (Properties ctx, int M_PriceList_Version_ID, int M_Product_ID,
String trxName)
{
MProductPrice retValue = null;
String sql = "SELECT * FROM M_ProductPrice WHERE M_PriceList_Version_ID=? AND M_Product_ID=?";
PreparedStatement pstmt = null;
try
{
pstmt = DB.prepareStatement (sql, trxName);
pstmt.setInt (1, M_PriceList_Version_ID);
pstmt.setInt (2, M_Product_ID);
ResultSet rs = pstmt.executeQuery ();
if (rs.next ())
{
retValue = new MProductPrice (ctx, rs, trxName);
}
rs.close ();
pstmt.close ();
pstmt = null;
}
catch (Exception e)
{
s_log.log (Level.SEVERE, sql, e);
}
try
{
if (pstmt != null)
pstmt.close ();
pstmt = null;
}
catch (Exception e)
{
pstmt = null;
}
return retValue;
} // get
/** Logger */
private static CLogger s_log = CLogger.getCLogger (MProductPrice.class);
/**
* Persistency Constructor
* @param ctx context
* @param ignored ignored
*/
public MProductPrice (Properties ctx, int ignored, String trxName)
{
super(ctx, 0, trxName);
if (ignored != 0)
throw new IllegalArgumentException("Multi-Key");
setPriceLimit (Env.ZERO);
setPriceList (Env.ZERO);
setPriceStd (Env.ZERO);
} // MProductPrice
/**
* Load Constructor
* @param ctx context
* @param rs result set
*/
public MProductPrice (Properties ctx, ResultSet rs, String trxName)
{
super(ctx, rs, trxName);
} // MProductPrice
/**
* New Constructor
* @param ctx context
* @param M_PriceList_Version_ID Price List Version
* @param M_Product_ID product
*/
public MProductPrice (Properties ctx, int M_PriceList_Version_ID, int M_Product_ID, String trxName)
{
this (ctx, 0, trxName);
setM_PriceList_Version_ID (M_PriceList_Version_ID); // FK
setM_Product_ID (M_Product_ID); // FK
} // MProductPrice
/**
* New Constructor
* @param ctx context
* @param M_PriceList_Version_ID Price List Version
* @param M_Product_ID product
* @param PriceList list price
* @param PriceStd standard price
* @param PriceLimit limit price
*/
public MProductPrice (Properties ctx, int M_PriceList_Version_ID, int M_Product_ID,
BigDecimal PriceList, BigDecimal PriceStd, BigDecimal PriceLimit, String trxName)
{
this (ctx, M_PriceList_Version_ID, M_Product_ID, trxName);
setPrices (PriceList, PriceStd, PriceLimit);
} // MProductPrice
/**
* Parent Constructor
* @param plv price list version
* @param M_Product_ID product
* @param PriceList list price
* @param PriceStd standard price
* @param PriceLimit limit price
*/
public MProductPrice (MPriceListVersion plv, int M_Product_ID,
BigDecimal PriceList, BigDecimal PriceStd, BigDecimal PriceLimit)
{
this (plv.getCtx(), 0, plv.get_TrxName());
setClientOrg(plv);
setM_PriceList_Version_ID(plv.getM_PriceList_Version_ID());
setM_Product_ID(M_Product_ID);
setPrices (PriceList, PriceStd, PriceLimit);
} // MProductPrice
/**
* Set Prices
* @param PriceList list price
* @param PriceStd standard price
* @param PriceLimit limit price
*/
public void setPrices (BigDecimal PriceList, BigDecimal PriceStd, BigDecimal PriceLimit)
{
setPriceLimit (PriceLimit);
setPriceList (PriceList);
setPriceStd (PriceStd);
} // setPrice
} // MProductPrice
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -