1 14 package org.compiere.wstore; 15 16 import java.util.*; 17 import java.math.*; 18 19 import org.apache.log4j.Logger; 20 21 import org.compiere.util.Env; 22 import org.compiere.www.*; 23 24 25 31 public class WebBasket 32 { 33 36 public WebBasket() 37 { 38 } 40 41 public static final String NAME = "webBasket"; 42 43 44 private Logger log = Logger.getLogger(getClass()); 45 46 private ArrayList m_lines = new ArrayList(); 47 48 private BigDecimal m_total; 49 50 private int m_lineNo = 0; 51 private int m_PriceList_Version_ID = -1; 52 private int m_PriceList_ID = -1; 53 54 58 public String toString() 59 { 60 StringBuffer sb = new StringBuffer ("WebBasket["); 61 sb.append(m_lines.size()).append("-").append(m_total) 62 .append(",M_PriceList_ID=" + m_PriceList_ID) 63 .append("]"); 64 return sb.toString(); 65 } 67 71 public BigDecimal getTotal() 72 { 73 if (m_total == null) 74 return Env.ZERO; 75 return m_total; 76 } 78 82 public int getLineCount() 83 { 84 return m_lines.size(); 85 } 87 91 public ArrayList getLines() 92 { 93 return m_lines; 94 } 96 100 public void add (WebBasketLine wbl) 101 { 102 wbl.setLine (m_lineNo++); 103 m_lines.add(wbl); 104 m_total = getTotal().add(wbl.getTotal()); 105 } 107 111 public void delete (int no) 112 { 113 for (int i = 0; i < m_lines.size(); i++) 114 { 115 WebBasketLine wbl = (WebBasketLine)m_lines.get(i); 116 if (wbl.getLine() == no) 117 { 118 m_total = getTotal().subtract(wbl.getTotal()); 119 m_lines.remove(i); 120 break; 121 } 122 } 123 } 125 public int getM_PriceList_Version_ID() 126 { 127 return m_PriceList_Version_ID; 128 } 129 public void setM_PriceList_Version_ID(int PriceList_Version_ID) 130 { 131 if (PriceList_Version_ID > 0) 132 m_PriceList_Version_ID = PriceList_Version_ID; 133 } 134 public int getM_PriceList_ID() 135 { 136 return m_PriceList_ID; 137 } 138 public void setM_PriceList_ID(int PriceList_ID) 139 { 140 if (PriceList_ID > 0) 141 m_PriceList_ID = PriceList_ID; 142 } 143 144 } | Popular Tags |