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

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

import com.rjconsultores.ventaboletos.entidad.ConvenioDet;

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

    public void render(Listitem lstm, Object objectSelected) throws Exception {
    	Listcell lc = new Listcell();
    	
    	if(objectSelected != null) {
    		ConvenioDet convenioDet = (ConvenioDet) objectSelected;
    		
    		// Porcentagem Tarifa
    		lc = new Listcell(convenioDet.getPorcdescuento() != null ? convenioDet.getPorcdescuento().setScale(2).toString() : "");
    		lc.setParent(lstm);
    		// Porcentagem Taxa de Embarque
    		lc = new Listcell(convenioDet.getPorcDescuentoTaxaEmbarque() != null ? convenioDet.getPorcDescuentoTaxaEmbarque().setScale(2).toString() : "");
    		lc.setParent(lstm);
    		// Porcentagem Pedágio
    		lc = new Listcell(convenioDet.getPorcDescuentoPedagio() != null ? convenioDet.getPorcDescuentoPedagio().setScale(2).toString() : "");
    		lc.setParent(lstm);
    		// Porcentagem Seguro
    		lc = new Listcell(convenioDet.getPorcDescuentoSeguro() != null ? convenioDet.getPorcDescuentoSeguro().setScale(2).toString() : "");
    		lc.setParent(lstm);   
    		// Folio Inicial
    		lc = new Listcell(convenioDet.getNumfolioinicial() != null ? convenioDet.getNumfolioinicial().toString() : "-");
    		lc.setParent(lstm);
    		// Folio Final
    		lc = new Listcell(convenioDet.getNumfoliofinal() != null ? convenioDet.getNumfoliofinal().toString() : "-");
    		lc.setParent(lstm);
    		// Quantidade
    		lc = new Listcell(convenioDet.getQuantidade() != null ? convenioDet.getQuantidade().toString() : "-");
    		lc.setParent(lstm);
    		
    		lstm.setAttribute("data", convenioDet);
    	}        
    }
}
