/*
 * Arrebol Consultancy copyright.
 * 
 * This code belongs to Arrebol Consultancy
 * its use, redistribution or modification are prohibited 
 * without written authorization from Arrebol Consultancy.
 */
package com.arrebol.apc.model.views;

import java.io.Serializable;
import java.math.BigDecimal;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import org.hibernate.annotations.Immutable;

/**
 *
 * @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
 */
@Entity
@Immutable
@Table(name = "APC_TOTAL_CASH_BY_CURDATE_DASHBOARD_VIEW")
public class TotalCashByCurdateDashboardView implements Serializable {

    private static final long serialVersionUID = 617629469188727880L;

    @Id
    @Column(name = "id", length = 36)
    private String id;

    @Column(name = "id_office")
    private String idOffice;

    @Column(name = "total_amount_payment")
    private BigDecimal paymentDaily;
    
    @Column(name = "total_amount_deposit")
    private BigDecimal depositDaily;

    @Column(name = "transfer_sender")
    private BigDecimal transferSender;

    @Column(name = "transfer_receiver")
    private BigDecimal transferReceiver;

    @Column(name = "money_daily")
    private BigDecimal moneyDaily;

    @Column(name = "other_expense")
    private BigDecimal otherExpense;

    @Column(name = "delivery")
    private BigDecimal delivery;
    
    @Column(name = "transfer_pending")
    private BigDecimal transferPending;

    @Transient
    private BigDecimal total;

    public TotalCashByCurdateDashboardView() {
    }

    public String getId() {
        return id;
    }

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

    public BigDecimal getPaymentDaily() {
        return paymentDaily;
    }

    public void setPaymentDaily(BigDecimal paymentDaily) {
        this.paymentDaily = paymentDaily;
    }

    public BigDecimal getTransferSender() {
        return transferSender;
    }

    public void setTransferSender(BigDecimal transferSender) {
        this.transferSender = transferSender;
    }

    public BigDecimal getTransferReceiver() {
        return transferReceiver;
    }

    public void setTransferReceiver(BigDecimal transferReceiver) {
        this.transferReceiver = transferReceiver;
    }

    public BigDecimal getMoneyDaily() {
        return moneyDaily;
    }

    public void setMoneyDaily(BigDecimal moneyDaily) {
        this.moneyDaily = moneyDaily;
    }

    public BigDecimal getOtherExpense() {
        return otherExpense;
    }

    public void setOtherExpense(BigDecimal otherExpense) {
        this.otherExpense = otherExpense;
    }

    public BigDecimal getDelivery() {
        return delivery;
    }

    public void setDelivery(BigDecimal delivery) {
        this.delivery = delivery;
    }

    public String getIdOffice() {
        return idOffice;
    }

    public void setIdOffice(String idOffice) {
        this.idOffice = idOffice;
    }

    public BigDecimal getTransferPending() {
        return transferPending;
    }

    public void setTransferPending(BigDecimal transferPending) {
        this.transferPending = transferPending;
    }

    public BigDecimal getDepositDaily() {
        return depositDaily;
    }

    public void setDepositDaily(BigDecimal depositDaily) {
        this.depositDaily = depositDaily;
    }
    
    public BigDecimal getTotal() {
        if (null == total) {
            total = BigDecimal.ZERO;
        }
        total = BigDecimal.ZERO;
        total = total
                .add(getPaymentDaily())
                .add(getDepositDaily())
                .add(getTransferReceiver())
                .subtract(getTransferSender())
                .add(getMoneyDaily())
                .subtract(getOtherExpense())
                .subtract(getDelivery());

        return total;
    }

    public void setTotal(BigDecimal total) {
        this.total = total;
    }

    @Override
    public String toString() {
        return "TotalCashByCurdateView{" + "id=" + id + '}';
    }

}
