<%@ page import="com.fenalco.entities.User"%>
<%@ page import="com.fenalco.entities.DataAccess"%>
<%@ page import="com.fenalco.entities.SupplierProduct"%>
<%@ page import="java.sql.Date"%>
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<html>
<head>
<link rel='stylesheet' style='text/css' href='../css/tablas.css'>
<title>Detalle del producto</title>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
    <%
       SupplierProduct product = (SupplierProduct)request.getAttribute("product");
    %>
    <table width='400' border='0' cellpadding='5'>
        <!--<tr><td colspan='4'align='center'><em><strong>Informaci&oacute;n General</strong></em></td></tr>-->
        <tr><td colspan='4'align='center'>
        <%
            String tittle = "Información General";
        %>
        <%@ include file="/titulo.jsp" %>
        </td></tr>
        <tr>
            <td colspan='2' align='center'><img src='<%String image = product.getImage();
                                                       String alt = "";
                                                       boolean hasImage = ((Boolean)request.getAttribute("hasImage")).booleanValue();
                                                        if(hasImage){
                                                            %><%=image%><%
                                                        }else{
                                                            %><%="/images/products/0.gif"%><% 
                                                            alt = "No disponible";
                                                        }%>' alt="<%=alt%>" height='100' width='100'></td>
            <td><strong>Descripci&oacute;n corta</td>
            <td><% String shortDescription = product.getShortDescription();
                   if(shortDescription!=null && !shortDescription.equals("") && !shortDescription.equals("null")){
                        %><%=shortDescription%><%
                   }else{
                        %><%="No disponible"%><%
                   }%></td>
        </tr>
        <tr>
            <td><strong>C&oacute;digo de barras</td>
            <td><% String code = product.getCode();
                   if(code!=null && !code.equals("") && !code.equals("null")){
                        %><%=code%><%
                   }else{
                        %><%="No disponible"%><%
                   }%></td>
            <td><strong>Descripci&oacute;n larga</td>
            <td><% String longDescription = product.getLongDescription();
                   if(longDescription!=null && !longDescription.equals("") && !longDescription.equals("null")){
                        %><%=longDescription%><%
                   }else{
                        %><%="No disponible"%><%
                   }%></td>
        </tr>
        <tr>
            <td><strong>Categor&iacute;a</td>
            <td><% String categoryName = product.getCategoryName();
                   if(categoryName!=null && !categoryName.equals("") && !categoryName.equals("null")){
                        %><%=categoryName%><%
                   }else{
                        %><%="No disponible"%><%
                   }%></td>
            <td><strong>Marca</td>
            <td><% String brand = product.getBrand();
                   if(brand!=null && !brand.equals("") && !brand.equals("null")){
                        %><%=brand%><%
                   }else{
                        %><%="No disponible"%><%
                   }%></td>
        </tr>
        <tr><td colspan='4'align='center'>
        <%
            tittle = "Información Comercial";
        %>
        <%@ include file="/titulo.jsp" %>
        </td></tr>
        <tr>
            <td colspan='2'><strong>Impuesto Valor Agregado IVA</td>
            <td colspan='2'><% float tax = product.getTax();
                               if(tax != 0 ){
                                    %><%=tax + "%"%><%
                               }else{
                                    %><%="No disponible"%><%
                               }%></td>
        </tr>
        <tr>
            <td colspan='2'><strong>Proveedor</td>
            <td colspan='2'><% String supplierName = product.getSupplierName();
                               if(supplierName!=null && !supplierName.equals("") && !supplierName.equals("null")){
                                    %><%=supplierName%><%
                               }else{
                                    %><%="No disponible"%><%
                               }%></td>
        </tr>
        <tr><td colspan='4'align='center'>
        <%
            tittle = "Información Técnica";
        %>
        <%@ include file="/titulo.jsp" %>
        </td></tr>
        <tr>
            <td><strong>Nombre Funcional</td>
            <td><% String functionalName = product.getFunctionalName();
                   if(functionalName!=null && !functionalName.equals("") && !functionalName.equals("null")){
                        %><%=functionalName%><%
                   }else{
                        %><%="No disponible"%><%
                   }%></td>
            <td><strong>Fabricante</td>
            <td><% String manufacturerName = product.getManufacturerName();
                   if(manufacturerName!=null && !manufacturerName.equals("") && !manufacturerName.equals("null")){
                        %><%=manufacturerName%><%
                   }else{
                        %><%="No disponible"%><%
                   }%></td>
        </tr>
        <tr>
            <td><strong>Contenido Neto</td>
            <td><% float netContent  = product.getNetContent();
                   String netContentUnit = product.getNetContentUnit();
                   if(netContent!=0 && netContentUnit!=null && !netContentUnit.equals("") && !netContentUnit.equals("null")){
                        %><%=netContent + " " + netContentUnit%><%
                   }else{
                        %><%="No disponible"%><%
                   }%></td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
        </tr>
        <tr>
            <td><strong>Registro Sanitario</td>
            <td><% String sanitaryRegistry = product.getSanitaryRegistry();
                   if(sanitaryRegistry!=null && !sanitaryRegistry.equals("") && !sanitaryRegistry.equals("null")){
                        %><%=sanitaryRegistry%><%
                   }else{
                        %><%="No disponible"%><%
                   }%></td>
            <td><strong>Fecha Registro Sanitario</td>
            <td><% Date sanitaryRegistryDate = product.getSanitaryRegistryDate();
                   if(sanitaryRegistryDate!=null && !(sanitaryRegistryDate.toString()).equals("") && !(sanitaryRegistryDate.toString()).equals("null")){
                        %><%=sanitaryRegistryDate.toString()%><%
                   }else{
                        %><%="No disponible"%><%
                   }%></td>      
        </tr>
        <tr>
            <td><strong>Alto</td>
            <td><% float height  = product.getHeight();
                   String heightUnit = product.getHeightUnit();
                   if(height!=0 && heightUnit!=null && !heightUnit.equals("") && !heightUnit.equals("null")){
                        %><%=height + " " + heightUnit%><%
                   }else{
                        %><%="No disponible"%><%
                   }%></td>
            <td><strong>Ancho</td>
            <td><% float width  = product.getWidth();
                   String widthUnit = product.getWidthUnit();
                   if(width!=0 && widthUnit!=null && !widthUnit.equals("") && !widthUnit.equals("null")){
                        %><%=width + " " + widthUnit%><%
                   }else{
                        %><%="No disponible"%><%
                   }%></td>
        </tr>
        <tr>
            <td><strong>Profundidad</td>
            <td><% float depth  = product.getDepth();
                   String depthUnit = product.getDepthUnit();
                   if(depth!=0 && depthUnit!=null && !depthUnit.equals("") && !depthUnit.equals("null")){
                        %><%=depth + " " + depthUnit%><%
                   }else{
                        %><%="No disponible"%><%
                   }%></td>
            <td><strong>Peso Neto</td>
            <td><% float netWeight  = product.getNetWeight();
                   String netWeightUnit = product.getNetWeightUnit();
                   if(netWeight!=0 && netWeightUnit!=null && !netWeightUnit.equals("") && !netWeightUnit.equals("null")){
                        %><%=netWeight + " " + netWeightUnit%><%
                   }else{
                        %><%="No disponible"%><%
                   }%></td>
        </tr>
        <tr>
            <td><strong>Temperatura M&iacute;nima</td>
            <td><% float minimumTemperature  = product.getMinimumTemperature();
                   String temperatureUnit = product.getTemperatureUnit();
                   if(minimumTemperature!=0 && temperatureUnit!=null && !temperatureUnit.equals("")){
                        %><%=minimumTemperature + " " + temperatureUnit%><%
                   }else{
                        %><%="No disponible"%><%
                   }%></td>
            <td><strong>Temperatura M&aacute;xima</td>
            <td><% float maximumTemperature  = product.getMaximumTemperature();
                   if(maximumTemperature!=0 && temperatureUnit!=null && !temperatureUnit.equals("") && !temperatureUnit.equals("null")){
                        %><%=maximumTemperature + " " + temperatureUnit%><%
                   }else{
                        %><%="No disponible"%><%
                   }%></td>
        </tr>
        <tr>
            <td><strong>Color</td>
            <td><% String color = product.getColor();
                   if(color!=null && !color.equals("") && !color.equals("null")){
                        %><%=color%><%
                   }else{
                        %><%="No disponible"%><%
                   }%></td>
            <td><strong>Principio Activo</td>
            <td><% String activePrinciple = product.getActivePrinciple();
                   if(activePrinciple!=null && !activePrinciple.equals("") && !activePrinciple.equals("null")){
                        %><%=activePrinciple%><%
                   }else{
                        %><%="No disponible"%><%
                   }%></td>
        </tr>
        <tr>
            <td><strong>Tipo de empaque</td>
            <td><% String packagingType = product.getPackagingType();
                   if(packagingType!=null && !packagingType.equals("") && !packagingType.equals("null")){
                        %><%=packagingType%><%
                   }else{
                        %><%="No disponible"%><%
                   }%></td>
            <td><strong>Piezas</td>
            <td><% int pieces = product.getPieces();
                   if(pieces!=0){
                        %><%=pieces%><%
                   }else{
                        %><%="No disponible"%><%
                   }%></td>
        </tr>
        <tr>
            <td><strong>Estilo</td>
            <td><% String style = product.getStyle();
                   if(style!=null && !style.equals("") && !style.equals("null")){
                        %><%=style%><%
                   }else{
                        %><%="No disponible"%><%
                   }%></td>
            <td><strong>Talla</td>
            <td><% String size = product.getSize();
                   if(size!=null && !size.equals("") && !size.equals("null")){
                        %><%=size%><%
                   }else{
                        %><%="No disponible"%><%
                   }%></td>
        </tr>
        <tr>
            <td><strong>Variante</td>
            <td><% String variant = product.getVariant();
                   if(variant!=null && !variant.equals("") && !variant.equals("null")){
                        %><%=variant%><%
                   }else{
                        %><%="No disponible"%><%
                   }%></td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
        </tr>
        <tr>
            <td><strong>F&oacute;rmula Farmace&uacute;tica</td>
            <td><% String pharmaceuticalForm = product.getPharmaceuticalForm();
                   if(pharmaceuticalForm!=null && !pharmaceuticalForm.equals("") && !pharmaceuticalForm.equals("null")){
                        %><%=pharmaceuticalForm%><%
                   }else{
                        %><%="No disponible"%><%
                   }%></td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
        </tr>
        <tr><td colspan='4'align='center'>
        <%
            tittle = "Información Logística";
        %>
        <%@ include file="/titulo.jsp" %>
        </td></tr>
        <tr>
            <td colspan='2'><strong>M&aacute;ximo Unidades Apilables</td>
            <td colspan='2'><% int stackingWeightMaximum = product.getStackingWeightMaximum();
                   if(stackingWeightMaximum!=0){
                        %><%=stackingWeightMaximum%><%
                   }else{
                        %><%="No disponible"%><%
                   }%></td>
        </tr>
        <tr>
            <td colspan='2'><strong>Capas por Unidad Log&iacute;stica</td>
            <td colspan='2'><% int completeLayers = product.getCompleteLayers();
                   if(completeLayers!=0){
                        %><%=completeLayers%><%
                   }else{
                        %><%="No disponible"%><%
                   }%></td>
        </tr>
        <tr>
            <td colspan='2'><strong>Productos por Capa</td>
            <td colspan='2'><% int itemsContainedInALayer = product.getItemsContainedInALayer();
                   if(itemsContainedInALayer!=0){
                        %><%=itemsContainedInALayer%><%
                   }else{
                        %><%="No disponible"%><%
                   }%></td>
        </tr>
    </table>
</body>
</html>
