package com.fitbank.hb.persistence.trans;

import java.io.Serializable;
import java.lang.reflect.Field;
import java.math.BigDecimal;
import com.fitbank.common.TransportBean;

/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TFEFACTURAPAGOS*/
public class Tfeinvoicepayment implements Serializable,TransportBean,Cloneable{
/** Nombre de la Tabla TFEFACTURAPAGOS */
public static final String TABLE_NAME = "TFEFACTURAPAGOS";
/** HashCode asociado con la Instancia*/
private int hashValue = 0;
/** Version de la Clase*/
private static final long serialVersionUID = 1L;
/**
* Clave primaria de la Entidad Tfeinvoicepayment
*/
private TfeinvoicepaymentKey pk;
/**
* Codigo de la forma de pago.
*/
private String formapago;

/**
* Monto que se cubrio con esta forma de pago.
*/
private BigDecimal total;

/**
* Plazo durante el cual se efectuo el pago. La unidad se describe en el campo UNIDADTIEMPO.
*/
private Integer plazo;

/**
* Unidad de tiempo usada en el plazo. El valor mas comon es dias.
*/
private String unidadtiempo;

/**Contructor por defecto*/
public Tfeinvoicepayment(){}
/**Contructor de Tfeinvoicepayment
@param pPk Clave Primaria del entity
@param pFormapago Codigo de la forma de pago.
@param pTotal Monto que se cubrio con esta forma de pago.
*/
public Tfeinvoicepayment(TfeinvoicepaymentKey pPk,String pFormapago,BigDecimal pTotal){
 pk=pPk;
 formapago=pFormapago;
 total=pTotal;
}
/**Entrega la Clave primaria de Tfeinvoicepayment
@return El objeto que referencia a la Clave primaria de Tfeinvoicepayment
*/
public TfeinvoicepaymentKey getPk(){
  return pk;
}
/**Fija un nuevo valor a la Clave primaria de Tfeinvoicepayment
@param pPk El objeto que referencia a la nueva Clave primaria de Tfeinvoicepayment
*/
public void setPk(TfeinvoicepaymentKey pPk){
  pk=pPk;
}
public static final String FORMAPAGO="FORMAPAGO";
/**Obtiene el valor de formapago
@return valor de formapago*/
public String getFormapago(){
  return formapago;
}
/**Fija el valor de formapago
@param pFormapago nuevo Valor de formapago*/
public void setFormapago(String pFormapago){
  formapago=pFormapago;
}

public static final String TOTAL="TOTAL";
/**Obtiene el valor de total
@return valor de total*/
public BigDecimal getTotal(){
  return total;
}
/**Fija el valor de total
@param pTotal nuevo Valor de total*/
public void setTotal(BigDecimal pTotal){
  total=pTotal;
}

public static final String PLAZO="PLAZO";
/**Obtiene el valor de plazo
@return valor de plazo*/
public Integer getPlazo(){
  return plazo;
}
/**Fija el valor de plazo
@param pPlazo nuevo Valor de plazo*/
public void setPlazo(Integer pPlazo){
  plazo=pPlazo;
}

public static final String UNIDADTIEMPO="UNIDADTIEMPO";
/**Obtiene el valor de unidadtiempo
@return valor de unidadtiempo*/
public String getUnidadtiempo(){
  return unidadtiempo;
}
/**Fija el valor de unidadtiempo
@param pUnidadtiempo nuevo Valor de unidadtiempo*/
public void setUnidadtiempo(String pUnidadtiempo){
  unidadtiempo=pUnidadtiempo;
}

/**Implementacion de la comparacion de la entidad Tfeinvoicepayment
@param rhs Elemento de Comparacion
@return el resultado de la comparacion
*/
public boolean equals(Object rhs){
    if (rhs == null){return false;}
    if (! (rhs instanceof Tfeinvoicepayment)){return false;}
    Tfeinvoicepayment that = (Tfeinvoicepayment) rhs;
    if (this.getPk() == null || that.getPk() == null){
        return false;}
    return (this.getPk().equals(that.getPk()));
}
/**Implementaciï¿½n del metodo hashCode de la la entidad Tfeinvoicepayment
@return el hashCode la instancia
*/
public int hashCode()    {
    if (this.hashValue == 0){
        int result = 17;
        if (this.getPk() == null){
            result = super.hashCode();
        }else{
            result = this.getPk().hashCode();
        }
        this.hashValue = result;
    }
    return this.hashValue;
}
/**Implementaci�n toString
*/
public String toString() {
	Field[]fs=this.getClass().getDeclaredFields();
	String data="";
	for(Field f:fs){
	 try{	
	 String name=f.getName();
	 if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0){continue;}
		data+=name+"="+f.get(this)+";";
	 }catch(Exception e){
		 continue;
	 }
		}
		if(data.compareTo("")==0){
		data=super.toString();
		}
	return data;
	}
/**Implementaci�n de la creaci�n de un bean en blancoTfeinvoicepayment
*/
public Object createInstance() throws Exception{
 Tfeinvoicepayment instance=new Tfeinvoicepayment();	
 instance.setPk(new TfeinvoicepaymentKey());
 return instance;
}
public Object cloneMe() throws Exception{
  Tfeinvoicepayment p=(Tfeinvoicepayment)this.clone();
  p.setPk((TfeinvoicepaymentKey)this.pk.cloneMe());
  return p;
}
}
