/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.rjconsultores.ventaboletos.web.utilerias.render;

import com.rjconsultores.ventaboletos.entidad.Redondeo;
import java.math.BigDecimal;
import org.zkoss.zul.Listcell;
import org.zkoss.zul.Listitem;
import org.zkoss.zul.ListitemRenderer;

/**
 *
 * @author Administrador
 */
public class RenderRedondeo implements ListitemRenderer {

    public void render(Listitem lstm, Object o) throws Exception {
        Redondeo permiso = (Redondeo) o;

        Listcell lc = new Listcell();

        BigDecimal valorInicial = permiso.getValorinicial();
        if (valorInicial != null) {
            lc = new Listcell(valorInicial.setScale(2).toString());
        } else {
            lc = new Listcell("");
        }
        lc.setParent(lstm);

        BigDecimal valorFinal = permiso.getValorfinal();
        if (valorFinal != null) {
            lc = new Listcell(valorFinal.setScale(2).toString());
        } else {
            lc = new Listcell("");
        }
        lc.setParent(lstm);

        BigDecimal valorRedondeo = permiso.getValorredondeo();
        if (valorRedondeo != null) {
            lc = new Listcell(valorRedondeo.setScale(2).toString());
        } else {
            lc = new Listcell("");
        }
        lc.setParent(lstm);

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