package cn.ysk.cashier.vo;

import lombok.Data;

import java.math.BigDecimal;

/**
 * @author GYJ
 */
@Data
public class TbOrderSalesCountByTable {
    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;
    private String tableId;

    public TbOrderSalesCountByTable(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 TbOrderSalesCountByTable(String productName, String productSkuName, String cateName,String unitName,BigDecimal price,
                                    Long salesNum, Long refNum, Long num, BigDecimal salesAmount, BigDecimal refAmount,
                                    Integer productId, Integer productSkuId, String tableId) {
        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;
        this.tableId = tableId;
        count();
    }

    public void count(){
        salesNum=salesNum-refNum;
        salesAmount=salesAmount.subtract(refAmount);
    }
}
