/*
 * 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.PricingImporte;
import java.math.RoundingMode;
import org.zkoss.zul.Listcell;
import org.zkoss.zul.Listitem;
import org.zkoss.zul.ListitemRenderer;

/**
 *
 * @author Rafius
 */
public class RenderPricingImporte implements ListitemRenderer {

    public void render(Listitem lstm, Object o) throws Exception {
        PricingImporte pi = (PricingImporte) o;

        Listcell lc = new Listcell();

        if (pi.getImporte() != null) {
            lc = new Listcell(pi.getImporte().setScale(2, RoundingMode.HALF_UP).toString());
        } else {
            lc = new Listcell("-");
        }
        lc.setParent(lstm);

        if (pi.getMoneda() != null) {
            lc = new Listcell(pi.getMoneda().getDescmoneda());
        } else {
            lc = new Listcell("-");
        }
        lc.setParent(lstm);

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