/** * TNTConcept Easy Enterprise Management by Autentia Real Bussiness Solution S.L. * Copyright (C) 2007 Autentia Real Bussiness Solution S.L. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package com.autentia.tnt.businessobject; import java.io.Serializable; import java.math.BigDecimal; import java.math.RoundingMode; import java.util.Date; import java.util.List; import com.autentia.tnt.dao.ITransferObject; public class BillBreakDown implements Serializable, ITransferObject, TaxableObject { public static final int MAX_LENGTH = 4096; private boolean selected; /* BillBreakDown - generated by stajanov (do not edit/delete) */ // Fields private Integer id; private String concept; private BigDecimal units; private BigDecimal amount; private BigDecimal iva; private Integer ownerId; private Integer departmentId; private Date insertDate; private Date updateDate; private Bill bill; private Integer place = 1; // Setters and getters public Integer getId() { return id; } private void setId( Integer id ) { this.id = id; } public String getConcept() { return concept; } public void setConcept( String concept ) { if (concept != null && concept.length() > MAX_LENGTH) { concept = concept.substring(0, MAX_LENGTH); } this.concept = concept; } public BigDecimal getUnits() { return units; } public void setUnits( BigDecimal units ) { this.units = units; } public BigDecimal getAmount() { return amount; } public void setAmount( BigDecimal amount ) { this.amount = amount; } public BigDecimal getIva() { return iva; } public void setIva( BigDecimal iva ) { this.iva = iva; } public Integer getOwnerId() { return ownerId; } public void setOwnerId( Integer ownerId ) { this.ownerId = ownerId; } public Integer getDepartmentId() { return departmentId; } public void setDepartmentId( Integer departmentId ) { this.departmentId = departmentId; } public Date getInsertDate() { return insertDate; } public void setInsertDate( Date insertDate ) { this.insertDate = insertDate; } public Date getUpdateDate() { return updateDate; } public void setUpdateDate( Date updateDate ) { this.updateDate = updateDate; } public Bill getBill() { return bill; } public void setBill( Bill bill ) { this.bill = bill; } public boolean equals( Object that ) { try { if (that == null) return false; else return this.getId().equals( ((BillBreakDown)that).getId() ); } catch (Exception e) { return false; } } public int hashCode() { if(this.getId()==null) return super.hashCode(); else return this.getId().intValue(); } /* BillBreakDown - generated by stajanov (do not edit/delete) */ public BigDecimal getTotal() { try { BigDecimal amountTotal = amount.multiply(units); BigDecimal ivaTotal = amountTotal.multiply(iva); ivaTotal = ivaTotal.divide(new BigDecimal(100), 2, RoundingMode.HALF_EVEN); amountTotal = amountTotal.add(ivaTotal); return amountTotal.setScale(2,RoundingMode.HALF_EVEN); } catch (Exception e) { return new BigDecimal(0); } //result.setScale(2); } public boolean isSelected() { return selected; } public void setSelected(boolean selected) { this.selected = selected; } public List<Integer> getOwnersId() { // TODO Auto-generated method stub return null; } public Integer getPlace() { return place; } public void setPlace(Integer place) { this.place = place; } }