package cn.ysk.cashier.vo;


import java.math.BigDecimal;

public class TbOrderSalesCountByDayVo {
    private String productName;
    private String productSkuName;
    private String cateName;
    private String unitName;
    private BigDecimal price;
    private Long salesNum;
    private Long refNum;
    private BigDecimal salesAmount;
    private BigDecimal refAmount;
    private Long num;
    private Integer productId;
    private Integer productSkuId;

    public Integer getProductId() {
        return productId;
    }

    public void setProductId(Integer productId) {
        this.productId = productId;
    }

    public Integer getProductSkuId() {
        return productSkuId;
    }

    public void setProductSkuId(Integer productSkuId) {
        this.productSkuId = productSkuId;
    }

    public String getProductName() {
        return productName;
    }

    public void setProductName(String productName) {
        this.productName = productName;
    }

    public String getProductSkuName() {
        return productSkuName;
    }

    public void setProductSkuName(String productSkuName) {
        this.productSkuName = productSkuName;
    }

    public String getCateName() {
        return cateName;
    }

    public void setCateName(String cateName) {
        this.cateName = cateName;
    }

    public Long getSalesNum() {
        return salesNum;
    }

    public void setSalesNum(Long salesNum) {
        this.salesNum = salesNum;
    }

    public Long getRefNum() {
        return refNum;
    }

    public void setRefNum(Long refNum) {
        this.refNum = refNum;
    }

    public Long getNum() {
        return num;
    }

    public void setNum(Long num) {
        this.num = num;
    }

    public BigDecimal getSalesAmount() {
        return salesAmount;
    }

    public void setSalesAmount(BigDecimal salesAmount) {
        this.salesAmount = salesAmount;
    }

    public BigDecimal getRefAmount() {
        return refAmount;
    }

    public void setRefAmount(BigDecimal refAmount) {
        this.refAmount = refAmount;
    }

    public String getUnitName() {
        return unitName;
    }

    public void setUnitName(String unitName) {
        this.unitName = unitName;
    }


    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    public TbOrderSalesCountByDayVo(Long salesNum, Long refNum) {
        this.salesNum = salesNum;
        this.refNum = refNum;
    }

    public TbOrderSalesCountByDayVo(String productName, String productSkuName, String cateName,String unitName,BigDecimal price,
                                    Long salesNum, Long refNum, Long num, BigDecimal salesAmount, BigDecimal refAmount) {
        this.productName = productName;
        this.productSkuName = productSkuName;
        this.cateName = cateName;
        this.unitName = unitName;
        this.price = price;
        this.salesNum = salesNum;
        this.refNum = refNum;
        this.salesAmount = salesAmount;
        this.refAmount = refAmount;
        this.num = num;
        count();
    }

    public TbOrderSalesCountByDayVo(String productName, String productSkuName,
                                    String cateName,String unitName,BigDecimal price,
                                    Long salesNum, Long refNum, Long num, BigDecimal salesAmount, BigDecimal refAmount, Integer productId, Integer productSkuId) {
        this.productName = productName;
        this.productSkuName = productSkuName;
        this.cateName = cateName;
        this.unitName = unitName;
        this.price = price;
        this.salesNum = salesNum;
        this.refNum = refNum;
        this.salesAmount = salesAmount;
        this.refAmount = refAmount;
        this.num = num;
        this.productId = productId;
        this.productSkuId = productSkuId;
        count();
    }

    public TbOrderSalesCountByDayVo(Long salesNum, Long refNum, Long num, BigDecimal salesAmount, BigDecimal refAmount) {
        this.salesNum = salesNum;
        this.refNum = refNum;
        this.salesAmount =  salesAmount;
        this.refAmount = refAmount;
        this.num = num;
        count();
    }

    public void count(){
        if (salesNum == null) salesNum = 0l;
        if (refNum == null) refNum = 0l;
        salesNum = salesNum - refNum;
        if (salesAmount == null) salesAmount = BigDecimal.ZERO;
        if (refAmount == null) refAmount = BigDecimal.ZERO;
        salesAmount = salesAmount.subtract(refAmount);
    }
}
