package com.rjconsultores.ventaboletos.web.utilerias.render;

import java.math.BigDecimal;

import org.zkoss.zul.Listcell;
import org.zkoss.zul.Listitem;
import org.zkoss.zul.ListitemRenderer;

import com.rjconsultores.ventaboletos.entidad.TarjetaCredito;

public class RenderTarjetaCredito implements ListitemRenderer {

	public void render(Listitem lstm, Object o) throws Exception {
		TarjetaCredito tarjetaCredito = (TarjetaCredito) o;

		Listcell lc = new Listcell(tarjetaCredito.getTarjetaCreditoId().toString());
		lc.setParent(lstm);

		lc = new Listcell(tarjetaCredito.getDescTarjetaCredito());
		lc.setParent(lstm);

		Integer cantMaxSinTasa = tarjetaCredito.getCantMaxSinTasa();
		if (cantMaxSinTasa != null) {
			lc = new Listcell(cantMaxSinTasa.toString());
		} else {
			lc = new Listcell("");
		}
		lc.setParent(lstm);

		Integer cantMaxConTasa = tarjetaCredito.getCanMaxConTasa();
		if (cantMaxConTasa != null) {
			lc = new Listcell(cantMaxConTasa.toString());
		} else {
			lc = new Listcell("");
		}
		lc.setParent(lstm);

		BigDecimal tasa = tarjetaCredito.getTasa();
		if (tasa != null) {
			lc = new Listcell(tasa.setScale(2).toString());
		} else {
			lc = new Listcell("");
		}
		lc.setParent(lstm);

		lstm.setAttribute("data", tarjetaCredito);
	}
}
