1,5 → 1,6 |
package ak.kickup.core.model; |
|
import java.math.BigDecimal; |
import java.util.Date; |
import java.util.Map; |
import java.util.HashMap; |
17,6 → 18,12 |
public class Participant |
extends GeneralModelObject |
{ |
public static final int PAYED_NULL = 0; // event price is nto defined |
public static final int PAYED_NONE = 1; // noit yet payed |
public static final int PAYED_LESS = 2; // payed but less then needed |
public static final int PAYED_EXACTLY = 3; // payed exactly as needed |
public static final int PAYED_MORE = 4; // payed more then needed |
|
private String ident; |
private String nick; |
private String email; |
32,7 → 39,7 |
private String transportComment; |
private Integer freeSleep; |
private String sleepComment; |
private Boolean payed; |
private BigDecimal payed; |
private String comment; |
private String privateComment; |
private Collection acts; // Collection(ParticipantAct) |
261,16 → 268,36 |
* |
* @hibernate.property |
*/ |
public Boolean getPayed() |
public BigDecimal getPayed() |
{ |
return payed; |
} |
|
public void setPayed(Boolean payed) |
public void setPayed(BigDecimal payed) |
{ |
this.payed = payed; |
} |
|
public BigDecimal getMustPay() |
{ |
if(event.getPrice() == null || persons == null) return null; |
|
return new BigDecimal(event.getPrice().doubleValue() * persons.intValue()); |
} |
|
public int getPayedStatus() |
{ |
if(event.getPrice() == null || persons == null) return PAYED_NULL; |
if(payed == null) return PAYED_NONE; |
|
double needed = event.getPrice().doubleValue() * persons.intValue(); |
double p = payed.doubleValue(); |
|
if(Math.abs(needed - p) < 0.001) return PAYED_EXACTLY; |
else if(needed < p) return PAYED_MORE; |
else return PAYED_LESS; |
} |
|
/** |
* |
* @hibernate.property |