package com.uas.finance.model;


import com.uas.finance.util.DateUtils;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * created by shicr on 2018/1/25
 * 基础发票信息
 **/
@Entity
@Table(name = "receipt")
public class Receipt implements Serializable{

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    private Long id;

    /**
     * 关联出账表的外键
     */
    @Column(name = "aa_id")
    private Long aa_id;

    /**
     * 发票号码
     */
    @Column(name = "aai_invoiceno")
    private String aai_invoiceno;

    /**
     * 销售方纳税人识别号
     */
    @Column(name = "aai_salesno")
    private String aai_salesno;

    /**
     * 开票日期
     */
    @Column(name = "aai_billdate")
    private Date aai_billdate;

    /**
     * 开票金额(元)
     */
    @Column(name = "aai_amount")
    private Double aai_amount;


    @ManyToOne(cascade = CascadeType.REFRESH)
    @JoinColumn(name = "aa_id",insertable = false,updatable = false)
    private AccountApply accountApply;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getAai_invoiceno() {
        return aai_invoiceno;
    }

    public void setAai_invoiceno(String aai_invoiceno) {
        this.aai_invoiceno = aai_invoiceno;
    }

    public String getAai_salesno() {
        return aai_salesno;
    }

    public void setAai_salesno(String aai_salesno) {
        this.aai_salesno = aai_salesno;
    }

    public String getAai_billdate() {
        return DateUtils.getMinMonthDateS(this.aai_billdate);
    }

    public void setAai_billdate(Date aai_billdate) {
        this.aai_billdate = aai_billdate;
    }

    public Double getAai_amount() {
        return aai_amount;
    }

    public void setAai_amount(Double aai_amount) {
        this.aai_amount = aai_amount;
    }

    public Long getAa_id() {
        return aa_id;
    }

    public void setAa_id(Long aa_id) {
        this.aa_id = aa_id;
    }

/*    public AccountApply getAccountApply() {
        return accountApply;
    }

    public void setAccountApply(AccountApply accountApply) {
        this.accountApply = accountApply;
    }*/
}
