package com.trade.service.trade.salescontract.dto;

import com.trade.service.trade.salescontract.domain.SalesCommodity;
import lombok.Data;

/**
 * @description:
 * @Author: wanglang
 * @Date: 2024/9/28 9:14
 * @Version: 1.0
 */
@Data
public class ContractCommodityDto {

    // 序号
    private String xh;
    // 商品名称
    private String goodsName;
    // 型号
    private String model;
    // 计量单位
    private String unit;
    // 包装规格
    private String packages;
    // 数量
    private String count;
    // 单价
    private String price;
    // 总价
    private String amount;
    // 税率(增值税) 单位%
    private String taxRate;

    public ContractCommodityDto(){
    }

    public ContractCommodityDto(SalesCommodity salesCommodity){
        // this.goodsName = salesCommodity.getName();
        this.goodsName = salesCommodity.getDeclarationName();
        this.model = salesCommodity.getModel();
        this.unit = salesCommodity.getMeasurementUnit();
        this.packages = salesCommodity.getPackSpec();
        this.count = String.valueOf(salesCommodity.getNumber());
        this.price = salesCommodity.getPriceUnit().toPlainString();
        this.amount = salesCommodity.getAmount().toPlainString();
        this.taxRate = salesCommodity.getAddedTaxRate();
    }
}
