package thyyxxk.webserver.entity.reports.medicinestockcount;

import lombok.Data;
import thyyxxk.webserver.utils.DecimalUtil;

import java.util.Date;

// lastCurrStockAmount + inYf - zyTotal = stockAmount
// currStockAmount = a.stock_amount - a.out_amt
// 上期存量 + 本期入库量 - 本期住院总量 = 本期账存量
// 本期实盘量 = 本期账存量 - a.out_amt
@Data
public class StockDetail {
    private String drawNo;
    private String lastDrawNo;
    private Integer groupNo;
    private Date outDate;
    private String location;
    private String chargeCode;
    private String serial;
    private String inYf;
    private String name;
    private String specification;
    private String packRetprice;
    private String stockAmount;
    private String currStockAmount;
    private String lastCurrStockAmount;
    private String lastStockAmountInTheory;
    private String outAmt;
    private String amountPd;
    private String chargePd;
    private Date confirmDate;
    private Integer confirmFlag;
    private String confirmId;
    private String inputId;
    private String categoriesFlag;
    private String buyPrice;
    private String grje;
    private String lsje;
    private String sortNo;
    private String drugKind;
    private String manuCode;
    private String chargeCodeMx;
    private String amount1;
    private String amount2;
    private String amount3;
    private String amount4;
    private String zyTotal;
    private Double diff1;
    private Double diff2;

    public String getInYf() {
        return (null == inYf) ? "0" : inYf;
    }

    public String getStockAmount() {
        return (null == stockAmount) ? "0" : stockAmount;
    }

    public String getAmount1() {
        return (null == amount1) ? "0" : amount1;
    }

    public String getAmount2() {
        return (null == amount2) ? "0" : amount2;
    }

    public String getAmount3() {
        return (null == amount3) ? "0" : amount3;
    }

    public String getAmount4() {
        return (null == amount4) ? "0" : amount4;
    }

    public String getZyTotal() {
        return (null == zyTotal) ? "0" : zyTotal;
    }

    public String getLastCurrStockAmount() {
        return (null == lastCurrStockAmount) ? "无" : lastCurrStockAmount;
    }

    public String getLastStockAmountInTheory() {
        String a = DecimalUtil.add(getStockAmount(), getZyTotal());
        return DecimalUtil.minus(a, getInYf());
    }
}
