package com.uas.platform.b2b.model;

import java.io.Serializable;
import java.util.Date;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.OrderBy;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 * 卖家应收（买家应付）对账单
 * 
 * @author suntg
 * @date 2015年10月10日16:42:27
 */
@Table(name = "sale$archeck")
@Entity
public class SaleARCheck implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

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

	/**
	 * 单号
	 */
	@Column(name = "sac_code")
	private String code;

	/**
	 * 日期
	 */
	@Column(name = "sac_date")
	private Date date;
	
	/**
	 * 应收日期
	 */
	@Column(name = "sac_ardate")
	private Date arDate;

	/**
	 * 币别
	 */
	@Column(name = "sac_currency")
	private String currency;

	/**
	 * 汇率
	 */
	@Column(name = "sac_rate")
	private Double rate;
	
	/**
	 * 客户企业UU
	 */
	@Column(name = "sac_enuu")
	private Long enUU;

	/**
	 * 采购企业
	 */
	@OneToOne(cascade = { CascadeType.REFRESH })
	@JoinColumn(name = "sac_venduu", insertable = false, updatable = false)
	private EnterpriseInfo vendor;
	
	/**
	 * 供应商所属企业UU
	 */
	@Column(name = "sac_venduu")
	private Long vendUU;
	
	/**
	 * 录单人（对账人）
	 */
	@Column(name = "sac_recorder")
	private String recorder;
	
	/**
	 * 审核人
	 */
	@Column(name = "sac_auditor")
	private String auditor;
	
	/**
	 * 审核日期
	 */
	@Column(name = "sac_auditdate")
	private Date aduitDate;
	
	/**
	 * 对账起始日期
	 */
	@Column(name = "sac_fromdate")
	private Date fromDate;
	
	/**
	 * 对账截止日期
	 */
	@Column(name = "sac_todate")
	private Date toDate;

	/**
	 * 业务员名字
	 */
	@Column(name = "sac_sellername")
	private String sellerName;

	/**
	 * 付款方式
	 */
	@Column(name = "sac_payments")
	private String payments;
	
	/**
	 * 对账金额
	 */
	@Column(name = "sac_checkamount")
	private Double checkAmount;
	
	/**
	 * 期初金额
	 */
	@Column(name = "sac_beginamount")
	private Double beginAmount;
	
	/**
	 * 本期收款金额
	 */
	@Column(name = "sac_payamount")
	private Double payAmount;
	
	/**
	 * 备注(来自卖方ERP传过来)
	 */
	@Column(name = "sac_remark")
	private String remark;

	/**
	 * 状态
	 * 200-还没开始回复对账
	 * 201-已开始回复对账
	 */
	@Column(name = "sac_status")
	private Short status;
	
	/**
	 * 已同意的明细数
	 */
	@Column(name = "sac_agree")
	private Integer agree;
	
	/**
	 * 不同意的明细数
	 */
	@Column(name = "sac_disagree")
	private Integer disagree;
	
	/**
	 * 来源单据id
	 */
	@Column(name = "sac_sourceid")
	private Long sourceId;

	/**
	 * 对账的单明细行
	 */
	@OneToMany(mappedBy = "arCheck", cascade = { CascadeType.REFRESH, CascadeType.PERSIST, CascadeType.REMOVE, CascadeType.MERGE }, fetch = FetchType.EAGER)
	@OrderBy("number")
	private Set<SaleARCheckItem> items;

	public Long getId() {
		return id;
	}

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

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public Date getArDate() {
		return arDate;
	}

	public void setArDate(Date arDate) {
		this.arDate = arDate;
	}

	public String getCurrency() {
		return currency;
	}

	public void setCurrency(String currency) {
		this.currency = currency;
	}

	public Double getRate() {
		return rate;
	}

	public void setRate(Double rate) {
		this.rate = rate;
	}

	public Long getEnUU() {
		return enUU;
	}

	public void setEnUU(Long enUU) {
		this.enUU = enUU;
	}

	public EnterpriseInfo getVendor() {
		return vendor;
	}

	public void setVendor(EnterpriseInfo vendor) {
		this.vendor = vendor;
	}

	public Long getVendUU() {
		return vendUU;
	}

	public void setVendUU(Long vendUU) {
		this.vendUU = vendUU;
	}

	public String getRecorder() {
		return recorder;
	}

	public void setRecorder(String recorder) {
		this.recorder = recorder;
	}

	public String getAuditor() {
		return auditor;
	}

	public void setAuditor(String auditor) {
		this.auditor = auditor;
	}

	public Date getAduitDate() {
		return aduitDate;
	}

	public void setAduitDate(Date aduitDate) {
		this.aduitDate = aduitDate;
	}

	public Date getFromDate() {
		return fromDate;
	}

	public void setFromDate(Date fromDate) {
		this.fromDate = fromDate;
	}

	public Date getToDate() {
		return toDate;
	}

	public void setToDate(Date toDate) {
		this.toDate = toDate;
	}

	public String getSellerName() {
		return sellerName;
	}

	public void setSellerName(String sellerName) {
		this.sellerName = sellerName;
	}

	public String getPayments() {
		return payments;
	}

	public void setPayments(String payments) {
		this.payments = payments;
	}

	public Double getCheckAmount() {
		return checkAmount;
	}

	public void setCheckAmount(Double checkAmount) {
		this.checkAmount = checkAmount;
	}

	public Double getBeginAmount() {
		return beginAmount;
	}

	public void setBeginAmount(Double beginAmount) {
		this.beginAmount = beginAmount;
	}

	public Double getPayAmount() {
		return payAmount;
	}

	public void setPayAmount(Double payAmount) {
		this.payAmount = payAmount;
	}

	public Short getStatus() {
		return status;
	}

	public void setStatus(Short status) {
		this.status = status;
	}

	public Set<SaleARCheckItem> getItems() {
		return items;
	}

	public void setItems(Set<SaleARCheckItem> items) {
		this.items = items;
	}

	public Long getSourceId() {
		return sourceId;
	}

	public void setSourceId(Long sourceId) {
		this.sourceId = sourceId;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public Integer getAgree() {
		return agree;
	}

	public void setAgree(Integer agree) {
		this.agree = agree;
	}

	public Integer getDisagree() {
		return disagree;
	}

	public void setDisagree(Integer disagree) {
		this.disagree = disagree;
	}
	
	
	
}
