119 lines
2.5 KiB
Java
119 lines
2.5 KiB
Java
|
|
package cn.palmte.work.model;
|
|||
|
|
|
|||
|
|
import org.hibernate.annotations.GenericGenerator;
|
|||
|
|
|
|||
|
|
import javax.persistence.*;
|
|||
|
|
import java.math.BigDecimal;
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 项目预算收入明细表
|
|||
|
|
*/
|
|||
|
|
@Entity
|
|||
|
|
@Table(name = "project_budget_income_detail")
|
|||
|
|
public class ProjectBudgetIncomeDetail {
|
|||
|
|
public static final int TYPE_DEVICE = 1;
|
|||
|
|
public static final int TYPE_ENGINEER = 2;
|
|||
|
|
public static final int TYPE_SERVICE = 3;
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* id
|
|||
|
|
*/
|
|||
|
|
@Id
|
|||
|
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|||
|
|
@GenericGenerator(name = "persistenceGenerator", strategy = "increment")
|
|||
|
|
private Integer id;
|
|||
|
|
|
|||
|
|
@Column(name = "project_id")
|
|||
|
|
private int projectId;
|
|||
|
|
|
|||
|
|
private int type;
|
|||
|
|
|
|||
|
|
private String name;
|
|||
|
|
|
|||
|
|
private String unit;
|
|||
|
|
private int amount;
|
|||
|
|
private BigDecimal price;
|
|||
|
|
|
|||
|
|
@Column(name = "tax_rate")
|
|||
|
|
private BigDecimal taxRate;
|
|||
|
|
|
|||
|
|
public Integer getId() {
|
|||
|
|
return id;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public void setId(Integer id) {
|
|||
|
|
this.id = id;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public int getProjectId() {
|
|||
|
|
return projectId;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public void setProjectId(int projectId) {
|
|||
|
|
this.projectId = projectId;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public int getType() {
|
|||
|
|
return type;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public void setType(int type) {
|
|||
|
|
this.type = type;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public String getName() {
|
|||
|
|
return name;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public void setName(String name) {
|
|||
|
|
this.name = name;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public String getUnit() {
|
|||
|
|
return unit;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public void setUnit(String unit) {
|
|||
|
|
this.unit = unit;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public int getAmount() {
|
|||
|
|
return amount;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public void setAmount(int amount) {
|
|||
|
|
this.amount = amount;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public BigDecimal getPrice() {
|
|||
|
|
return price;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public void setPrice(BigDecimal price) {
|
|||
|
|
this.price = price;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public BigDecimal getTaxRate() {
|
|||
|
|
return taxRate;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public void setTaxRate(BigDecimal taxRate) {
|
|||
|
|
this.taxRate = taxRate;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public BigDecimal getTotalTaxInclude(){
|
|||
|
|
if(null == price){
|
|||
|
|
return null;
|
|||
|
|
}
|
|||
|
|
return price.multiply(new BigDecimal(amount));
|
|||
|
|
}
|
|||
|
|
public BigDecimal getTotalTaxExclude(){
|
|||
|
|
BigDecimal totalTaxInclude = getTotalTaxInclude();
|
|||
|
|
if(null == totalTaxInclude || taxRate == null){
|
|||
|
|
return null;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//不含税总金额=含税总金额/(1+税率)
|
|||
|
|
return totalTaxInclude.divide(taxRate.divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP), 2, BigDecimal.ROUND_HALF_UP);
|
|||
|
|
}
|
|||
|
|
}
|