/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.arrebol.taxiservicios.model.payroll;

import com.arrebol.taxiservicios.model.catalog.Location;
import com.arrebol.taxiservicios.model.core.User;
import java.io.Serializable;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Oscar
 */
public class Payroll implements Serializable{
    
    private String id;
    private User user;
    private double salary;
    private double imss;
    private double bono1;
    private double bono2;
    private double bono3;
    private double abono;
    private double increase;
    private String descriptionIncrease;
    private double discount;
    private String descriptionDiscount;
    private double cajeado;
    private double adelanto;
    private double total;
    private boolean active;
    private User createdBy;
    private Date createdOn;
    private User lastUpdatedBy;
    private Date lastUpdatedOn;
    private Location location;
    private double saving;
    
    private Date initDate;
    private Date endDate;

    public Payroll() {
    }

    public Payroll(String id) {
        this.id = id;
    }

    public Payroll(String id, User user, double salary, double imss, double increase, double discount, String descriptionIncrease, String descriptionDiscount, double cajeado, double adelanto, double total, Date createdOn, User createdBy, Location location) {
        this.id = id;
        this.user = user;
        this.salary = salary;
        this.imss = imss;
        this.increase = increase;
        this.descriptionIncrease = descriptionIncrease;
        this.discount = discount;
        this.descriptionDiscount = descriptionDiscount;
        this.cajeado = cajeado;
        this.adelanto = adelanto;
        this.total = total;
        this.createdBy = createdBy;
        this.createdOn = createdOn;
        this.location = location;
    }
    
    public Payroll(String id, User user, double salary, double imss, double increase, double discount, String descriptionIncrease, String descriptionDiscount, double cajeado, double adelanto, double total, Date createdOn, User createdBy, Location location, Date initDate, Date endDate) {
        this.id = id;
        this.user = user;
        this.salary = salary;
        this.imss = imss;
        this.increase = increase;
        this.descriptionIncrease = descriptionIncrease;
        this.discount = discount;
        this.descriptionDiscount = descriptionDiscount;
        this.cajeado = cajeado;
        this.adelanto = adelanto;
        this.total = total;
        this.createdBy = createdBy;
        this.createdOn = createdOn;
        this.location = location;
        this.initDate = initDate;
        this.endDate = endDate;
    }
    
    public Payroll(String id, User user, double salary, double imss, double increase, double discount, String descriptionIncrease, String descriptionDiscount, double cajeado, double adelanto, double total, Date createdOn, User createdBy, Location location, Date initDate, Date endDate, double saving, boolean active) {
        this.id = id;
        this.user = user;
        this.salary = salary;
        this.imss = imss;
        this.increase = increase;
        this.descriptionIncrease = descriptionIncrease;
        this.discount = discount;
        this.descriptionDiscount = descriptionDiscount;
        this.cajeado = cajeado;
        this.adelanto = adelanto;
        this.total = total;
        this.createdBy = createdBy;
        this.createdOn = createdOn;
        this.location = location;
        this.initDate = initDate;
        this.endDate = endDate;
        this.saving = saving;
        this.active = active;
    }

    public Payroll(String id, User user, double salary, double imss, double bono1, double bono2, double bono3, double abono, double increase, String descriptionIncrease, double discount, String descriptionDiscount, double cajeado, double adelanto, double total, boolean active, User createdBy, Date createdOn, User lastUpdatedBy, Date lastUpdatedOn, Location location) {
        this.id = id;
        this.user = user;
        this.salary = salary;
        this.imss = imss;
        this.bono1 = bono1;
        this.bono2 = bono2;
        this.bono3 = bono3;
        this.abono = abono;
        this.increase = increase;
        this.descriptionIncrease = descriptionIncrease;
        this.discount = discount;
        this.descriptionDiscount = descriptionDiscount;
        this.cajeado = cajeado;
        this.adelanto = adelanto;
        this.total = total;
        this.active = active;
        this.createdBy = createdBy;
        this.createdOn = createdOn;
        this.lastUpdatedBy = lastUpdatedBy;
        this.lastUpdatedOn = lastUpdatedOn;
        this.location = location;
    }
    
    public Payroll(String id, User user, double salary, double imss, double increase, double discount, String descriptionIncrease, String descriptionDiscount, double cajeado, double adelanto, double total, Date createdOn, User createdBy, Location location, Date initDate, Date endDate, double saving, boolean active, double abono) {
        this.id = id;
        this.user = user;
        this.salary = salary;
        this.imss = imss;
        this.increase = increase;
        this.descriptionIncrease = descriptionIncrease;
        this.discount = discount;
        this.descriptionDiscount = descriptionDiscount;
        this.cajeado = cajeado;
        this.adelanto = adelanto;
        this.total = total;
        this.createdBy = createdBy;
        this.createdOn = createdOn;
        this.location = location;
        this.initDate = initDate;
        this.endDate = endDate;
        this.saving = saving;
        this.active = active;
        this.abono = abono;
    }
    
    

    public String getId() {
        return id;
    }

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

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public double getSalary() {
        return salary;
    }

    public void setSalary(double salary) {
        this.salary = salary;
    }

    public double getImss() {
        return imss;
    }

    public void setImss(double imss) {
        this.imss = imss;
    }

    public double getBono1() {
        return bono1;
    }

    public void setBono1(double bono1) {
        this.bono1 = bono1;
    }

    public double getBono2() {
        return bono2;
    }

    public void setBono2(double bono2) {
        this.bono2 = bono2;
    }

    public double getBono3() {
        return bono3;
    }

    public void setBono3(double bono3) {
        this.bono3 = bono3;
    }

    public double getIncrease() {
        return increase;
    }

    public void setIncrease(double increase) {
        this.increase = increase;
    }

    public String getDescriptionIncrease() {
        return descriptionIncrease;
    }

    public void setDescriptionIncrease(String descriptionIncrease) {
        this.descriptionIncrease = descriptionIncrease;
    }

    public double getDiscount() {
        return discount;
    }

    public void setDiscount(double discount) {
        this.discount = discount;
    }

    public String getDescriptionDiscount() {
        return descriptionDiscount;
    }

    public void setDescriptionDiscount(String descriptionDiscount) {
        this.descriptionDiscount = descriptionDiscount;
    }

    public double getCajeado() {
        return cajeado;
    }

    public void setCajeado(double cajeado) {
        this.cajeado = cajeado;
    }

    public double getAdelanto() {
        return adelanto;
    }

    public void setAdelanto(double adelanto) {
        this.adelanto = adelanto;
    }

    public double getTotal() {
        return total;
    }

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

    public boolean isActive() {
        return active;
    }

    public void setActive(boolean active) {
        this.active = active;
    }

    public User getCreatedBy() {
        return createdBy;
    }

    public void setCreatedBy(User createdBy) {
        this.createdBy = createdBy;
    }

    public Date getCreatedOn() {
        return createdOn;
    }

    public void setCreatedOn(Date createdOn) {
        this.createdOn = createdOn;
    }

    public User getLastUpdatedBy() {
        return lastUpdatedBy;
    }

    public void setLastUpdatedBy(User lastUpdatedBy) {
        this.lastUpdatedBy = lastUpdatedBy;
    }

    public Date getLastUpdatedOn() {
        return lastUpdatedOn;
    }

    public void setLastUpdatedOn(Date lastUpdatedOn) {
        this.lastUpdatedOn = lastUpdatedOn;
    }

    public Location getLocation() {
        return location;
    }

    public void setLocation(Location location) {
        this.location = location;
    }

    public double getAbono() {
        return abono;
    }

    public void setAbono(double abono) {
        this.abono = abono;
    }

    public Date getInitDate() {
        return initDate;
    }

    public void setInitDate(Date initDate) {
        this.initDate = initDate;
    }

    public Date getEndDate() {
        return endDate;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    public double getSaving() {
        return saving;
    }

    public void setSaving(double saving) {
        this.saving = saving;
    }
    
    public boolean getAction(Date lastStableGeneralBox) {
        Date date = createdOn;
        boolean action = true;
        try {
            SimpleDateFormat dt1 = new SimpleDateFormat("yyyy-MM-dd");

            String dateStr = dt1.format(date);
            date = dt1.parse(dateStr);

            action = date.after(lastStableGeneralBox);

        } catch (ParseException ex) {
            Logger.getLogger(Payroll.class.getName()).log(Level.SEVERE, null, ex);
        }
        return action;
    }
}
