1 14 package org.compiere.wstore; 15 16 import java.util.*; 17 import java.sql.*; 18 import java.math.*; 19 20 import org.apache.log4j.Logger; 21 22 import org.compiere.model.*; 23 import org.compiere.util.DB; 24 import org.compiere.util.Env; 25 import org.compiere.www.*; 26 27 33 public class WebBasketLine 34 { 35 42 public WebBasketLine (int M_Product_ID, String Name, BigDecimal Qty, BigDecimal Price) 43 { 44 setM_Product_ID(M_Product_ID); 45 setName(Name); 46 setQuantity(Qty); 47 setPrice(Price); 48 } 50 private int m_line; 51 private int m_M_Product_ID; 52 private String m_Name; 53 private BigDecimal m_Price; 54 private BigDecimal m_Quantity; 55 private BigDecimal m_Total; 56 57 public static BigDecimal ONE = new BigDecimal(1); 58 59 63 public String toString() 64 { 65 StringBuffer sb = new StringBuffer ("WebBasketLine["); 66 sb.append(m_line).append("-M_Product_ID=") .append(m_M_Product_ID) 67 .append(",Qty=").append(m_Quantity).append(",Price=").append(m_Price) 68 .append(",Total=").append(m_Total) 69 .append("]"); 70 return sb.toString(); 71 } 73 74 public int getLine() 75 { 76 return m_line; 77 } 78 public void setLine (int line) 79 { 80 m_line = line; 81 } 82 83 public int getM_Product_ID() 84 { 85 return m_M_Product_ID; 86 } 87 public void setM_Product_ID (int M_Product_ID) 88 { 89 m_M_Product_ID = M_Product_ID; 90 } 91 92 public String getName() 93 { 94 if (m_Name == null) 95 return "-"; 96 return m_Name; 97 } 98 public void setName(String name) 99 { 100 m_Name = name; 101 } 102 103 public BigDecimal getPrice() 104 { 105 if (m_Price == null) 106 return ONE; 107 return m_Price; 108 } 109 public void setPrice(BigDecimal price) 110 { 111 m_Price = price; 112 m_Total = null; 113 } 114 115 public BigDecimal getQuantity() 116 { 117 if (m_Quantity == null) 118 return ONE; 119 return m_Quantity; 120 } 121 public void setQuantity(BigDecimal quantity) 122 { 123 m_Quantity = quantity; 124 m_Total = null; 125 } 126 127 public BigDecimal getTotal() 128 { 129 if (m_Total == null) 130 m_Total = getQuantity().multiply(getPrice()); 131 return m_Total; 132 } 133 134 } | Popular Tags |