📄 webbasket.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 and ComPiere, Inc.
* Portions created by Jorg Janke are Copyright (C) 1999-2003 Jorg Janke, parts
* created by ComPiere are Copyright (C) ComPiere, Inc.; All Rights Reserved.
* Contributor(s): ______________________________________.
*****************************************************************************/
package org.compiere.wstore;
import java.util.*;
import java.math.*;
import org.apache.log4j.Logger;
import org.compiere.util.Env;
import org.compiere.www.*;
/**
* Web Basket
*
* @author Jorg Janke
* @version $Id: WebBasket.java,v 1.3 2003/04/11 05:50:48 jjanke Exp $
*/
public class WebBasket
{
/**
* Constructor
*/
public WebBasket()
{
} // WebBasket
/** Attribute Name - also in JSPs */
public static final String NAME = "webBasket";
/** Logging */
private Logger log = Logger.getLogger(getClass());
/** Lines */
private ArrayList m_lines = new ArrayList();
/** Total w/o tax */
private BigDecimal m_total;
/** Line (max) counter */
private int m_lineNo = 0;
private int m_PriceList_Version_ID = -1;
private int m_PriceList_ID = -1;
/**
* String Representation
* @return info
*/
public String toString()
{
StringBuffer sb = new StringBuffer("WebBasket[");
sb.append(m_lines.size()).append("-").append(m_total)
.append(",M_PriceList_ID=" + m_PriceList_ID)
.append("]");
return sb.toString();
} // toString
/**
* Get Total
* @return total
*/
public BigDecimal getTotal()
{
if (m_total == null)
return Env.ZERO;
return m_total;
} // getTotal
/**
* Get Line Count
* @return line count
*/
public int getLineCount()
{
return m_lines.size();
} // getLineCount
/**
* Get Lines
* @return lines
*/
public ArrayList getLines()
{
return m_lines;
} // getLines
/**
* Add Line
* @param wbl line
*/
public void add (WebBasketLine wbl)
{
wbl.setLine (m_lineNo++);
m_lines.add(wbl);
m_total = getTotal().add(wbl.getTotal());
} // add
/**
* Delete Line
* @param no line no
*/
public void delete (int no)
{
for (int i = 0; i < m_lines.size(); i++)
{
WebBasketLine wbl = (WebBasketLine)m_lines.get(i);
if (wbl.getLine() == no)
{
m_total = getTotal().subtract(wbl.getTotal());
m_lines.remove(i);
break;
}
}
} // delete
public int getM_PriceList_Version_ID()
{
return m_PriceList_Version_ID;
}
public void setM_PriceList_Version_ID(int PriceList_Version_ID)
{
if (PriceList_Version_ID > 0)
m_PriceList_Version_ID = PriceList_Version_ID;
}
public int getM_PriceList_ID()
{
return m_PriceList_ID;
}
public void setM_PriceList_ID(int PriceList_ID)
{
if (PriceList_ID > 0)
m_PriceList_ID = PriceList_ID;
}
} // WebBasket
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -