
<script type="text/javascript">
guardarImagen = function()
{
    x = confirm( "Esta seguro de agregar la Imagen?" );
    if( x )
    {
        $( "#TypeSubForm2" ).val( "add_img" );
    	//var strFormSerialize = $( 'form' ).serialize();
    	var strFormSerialize = $( "#content_img" ).find( "select, textarea, input" ).serialize()
        var formData = new FormData( document.getElementById( "form1" ) );
        $.ajax
        (
            {
                url: '<?php echo buildUrl( 'item/guardarImagen', "" ) ?>',
                type: 'POST',
                data: formData,
                async: false,
                cache: false,
                contentType: false,
                enctype: 'multipart/form-data',
                processData: false,
                success: function ( response )
                {
                    var o_json = jQuery.parseJSON( response );
                    console.log( o_json );
                    if( o_json.error )
                    {
                        showAlertBootStrap( 'content_alert', 'alert-danger', o_json.mensaje_error );
                        return false;
                    }
                    location.reload();
                }
            }
        );
    }
}
eliminarImagen = function()
{
	x = confirm( "Esta seguro de eliminar la Imagen?" );
    if( x )
    {
    	$( "#TypeSubForm2" ).val( "del_img" );
    	var str_serialize = $( '#form1' ).serialize();
    	executeAjaxJson
        ( 
            "<?php echo buildUrl( 'item/guardarImagen' ) ?>", 
            str_serialize,
            function( o_json )
            {
                if( o_json.error )
                {
                	unBlockContent( 'content_result_grid1' );
                    showAlertBootStrap( 'content_alert', 'alert-danger', o_json.mensaje_error );
                    return false;
                }
                location.reload();
            } 
        );
    }
}
</script>

<div class="card" style="background-color: aliceblue;">
    <div class="card-body p-2 m-2"> <!-- <div class="container"> -->
        <div class="form-row mx-0">
            <div class="col-md-6 mb-1">
            
                <div class="form-row mx-0">
                    <div class="col-md-12 mb-1">
                        <label class="col-form-label" for="Codigo">C&oacute;digo</label>
                        <input type="text" class="form-control" name="Codigo" id="Codigo" readonly="" placeholder="Codigo de Producto" value="<?=$o_ALM_ItemMastBN->getIdItem()?>">
                        <?php //crearPopupResumenStock( array( "ItemId"=>$o_ALM_ItemMastBN->getIdItem() ) ) ?>
                    </div>
                    <!-- 
                    <div class="col-md-6 mb-1">
                        <input type="hidden" name="CodigoInterno" id="CodigoInterno" placeholder="" value="<?=$o_ALM_ItemMastBN->getCodigoInterno()?>">
                        <label class="col-form-label" for="NumeroDeParte">Numero de Parte</label>
                        <input type="text" class="form-control" name="NumeroDeParte" id="NumeroDeParte" placeholder="Numero de Parte" value="<?=$o_ALM_ItemMastBN->getNumeroDeParte()?>" >
                    </div>
                    -->
                </div>
                
                <div class="form-row mx-0">
                    <div class="col-md-12 mb-1">
                        <label class="col-form-label" for="DescripcionCompleta">Descripcion</label>
                        <input type="text" class="form-control" name="DescripcionCompleta" id="DescripcionCompleta" placeholder="Descripcion de Producto" value="<?=$o_ALM_ItemMastBN->getDescripcionCompleta()?>" required>
                    </div>
                    
                    <!-- 
                    <div class="col-md-4 mb-1">
                        <label class="col-form-label" for="Estado">Estado</label>
                        <select class="form-control form-control-sm custom-select my-0 " name="Estado" id="Estado" required>
                            <option value=""> - SELECCIONE - </option>
                            <option value="A" <?php if( $o_ALM_ItemMastBN->getEstado()=="A" ){ echo "SELECTED"; } ?>> ACTIVO </option>
                            <option value="I" <?php if( $o_ALM_ItemMastBN->getEstado()=="I" ){ echo "SELECTED"; } ?>> INACTIVO </option>
                        </select>
                    </div>
                    -->
                </div>
                
            </div>
            
            <div class="col-md-6 mb-1">
            
                <div class="form-group" id="content_img">

                    <?php if( $o_ALM_ItemMastBN->getIdItem() ){ ?>
                    <input type="hidden" name="TypeSubForm2" id="TypeSubForm2" value=""/>
                    <input type="file" style="padding: .200rem .50rem;" class="form-control form-control-file" id="img_producto" name="img_producto">
                    <div style="text-align: center; margin-top: 5px;">
                        <?php if( $o_ALM_ItemMastBN->getIdItem() ){ ?>
                        <img src="<?=$o_ALM_ItemMastBN->getUbicacionURL()?>" border="1" style="width: 200px; height: 100px; border-style: solid;" >
                        <button type="button" style="margin-top: 5px;" class="btn btn-primary btn-sm" onclick="guardarImagen();">GUARDAR</button>
                        <button type="button" style="margin-top: 5px;" class="btn btn-primary btn-sm" onclick="eliminarImagen();">ELIMINAR</button>
                        <?php }else{ ?>
                        <img src="<?=Constantes::ROOT_DIR_IMG."no_disponible.png"?>" border="1" style="width: 200px; height: 100px; border-style: solid;" >
                        <?php } ?>
                    </div>
                    <?php } ?>
                  
              </div>
            
            </div>
            
        </div>
        
        <div class="form-row mx-0">
            <div class="col-md-3 mb-1">
                <label class="col-form-label" for="IdItemTipo">Tipo de Producto</label>
                <select class="form-control form-control-sm custom-select my-0 " name="IdItemTipo" id="IdItemTipo" 
                        onchange="evaluarVerSemana( this ); validacionPorTipoItem()" 
                        required style="background-color: khaki;">
                    <option value="" mostrarsemana='N'> - SELECCIONE - </option>
                    <?php foreach ( $a_ALM_ItemTipo as $i_Key => $o_ALM_ItemTipoBN ){ ?>
                    <option value="<?=$o_ALM_ItemTipoBN->getIdItemTipo()?>" <?php if( $o_ALM_ItemMastBN->getIdItemTipo()==$o_ALM_ItemTipoBN->getIdItemTipo() ){ echo "SELECTED"; } ?> 
                            <?php if( $o_ALM_ItemTipoBN->getVerDiaSemanaFlag()=="S" ){ echo "mostrarsemana='S'"; }else{ echo "mostrarsemana='N'"; } ?>
                            >
                        <?=$o_ALM_ItemTipoBN->getDescripcionLocal()?> 
                    </option>
                    <?php } ?>
                </select>
            </div>
            
            <div class="col-md-3 mb-1 align-self-center">
                <label class="col-form-label" for="IdItemFiscal">Codigo Cubso ( SUNAT )</label>
                <select class="form-control form-control-sm custom-select my-0 " name="IdItemFiscal" id="IdItemFiscal" style="background-color: khaki;">
                    <option value=""> - SELECCIONE - </option>
                    <?php foreach ( MST_ItemFiscalFN::selectActivos() as $i_Key => $o_MST_ItemFiscalBN ){ ?>
                    <option value="<?=$o_MST_ItemFiscalBN->getIdItemFiscal()?>" <?php if( $o_ALM_ItemMastBN->getCodigoSunat()==$o_MST_ItemFiscalBN->getCodigoFiscal() ){ echo "SELECTED"; } ?> >
                        <?=$o_MST_ItemFiscalBN->getCodigoFiscal()?> - <?=$o_MST_ItemFiscalBN->getDescripcion()?> 
                    </option>
                    <?php } ?>
                </select>
                
                <div class="container" id="content_diasemana" style="display: none;">

                    <div class="form-row mx-0" style="margin: 0 auto;">

                        <div class="table-responsive">
                            <div class="container">
                                <table class="table" style="margin-bottom:0;">
                                    <tbody>
                                        <tr>
                                            <?php foreach ( $a_MST_DiaSemana as $i_Key => $o_MST_DiaSemanaBN ){ ?>
                                            <td>
                                                <input type="checkbox" class="custom-control-input" name="DiaSemana[]" 
                                                        id="chk_<?=$o_MST_DiaSemanaBN->getIdDiaSem()?>" value="<?=$o_MST_DiaSemanaBN->getIdDiaSem()?>_<?=$o_MST_DiaSemanaBN->getDiaNumero()?>" 
                                                        <?php if( $o_ALM_ItemMastBN->getIdItem() ){ ?>
                                                            <?php if( $o_MST_DiaSemanaBN->getDiaSemanaPorIdItem( $o_ALM_ItemMastBN->getIdItem() ) ){ echo "checked"; } ?>
                                                        <?php } ?>
                                                        >
                                                <label class="custom-control-label text-body" for="chk_<?=$o_MST_DiaSemanaBN->getIdDiaSem()?>" title="<?=$o_MST_DiaSemanaBN->getNombre()?>"><?=$o_MST_DiaSemanaBN->getPrefijo()?></label>
                                            </td>
                                            <?php } ?>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>

                        <!-- aqui tambien se tiene que complementar la asociacion con ubicacion -->
                        <div class="col-md-6 mb-1">
                            <select class="form-control form-control-sm custom-select my-0 " name="IdTipoUbicacion" id="IdTipoUbicacion"  style="background-color: khaki;"
                                    onchange="$('#IdUbicacion')[0].options.length = 1; publicForSelectAjaxJSON('<?php echo buildUrl( 'item/request' ) ?>', 'TipoProc=BuscarUbicacion&IdTipoUbicacion=' + this.value, 'IdUbicacion');"
                                    >
                                <option value=""> - Tipo Ubicacion - </option>
                                <?php foreach ( MST_TipoUbicacionFN::selectActivos( 1 ) as $o_MST_TipoUbicacionBN ) { ?>
                                    <option value="<?=$o_MST_TipoUbicacionBN->getIdTipoUbicacion()?>" <?php if( $o_MST_TipoUbicacionBN->getIdTipoUbicacion()==$s_IdTipoUbicacion ){ echo "selected"; } ?> >
                                        <?=$o_MST_TipoUbicacionBN->getNombre()?>
                                    </option>
                                <?php } ?>
                            </select>
                            <select class="form-control form-control-sm custom-select my-0 " name="IdCategoria" id="IdCategoria"  style="background-color: khaki;">
                                <option value=""> - Categoria - </option>
                                <?php foreach ( MST_CategoriaHabitacionMastFN::selectActivos( 1 ) as $o_MST_CategoriaHabitacionMastBN ) { ?>
                                    <option value="<?=$o_MST_CategoriaHabitacionMastBN->getIdCategoria()?>" <?php if( $o_MST_CategoriaHabitacionMastBN->getIdCategoria()==$s_IdCategoria ){ echo "selected"; } ?> >
                                        <?=$o_MST_CategoriaHabitacionMastBN->getDescripcion()?>
                                    </option>
                                <?php } ?>
                            </select>
                        </div>
                        
                        <div class="col-md-6 mb-1">
                            <input type="text" class="form-control" name="HoraHabitacion" id="HoraHabitacion" placeholder="Hora" value="<?=$s_HoraHabitacion?>" >
                        </div>

                    </div>
                </div>
            </div>
            
            <div class="col-md-3 mb-1">
                <label class="col-form-label" for="Estado">Estado</label>
                <select class="form-control form-control-sm custom-select my-0 " name="Estado" id="Estado" required style="background-color: khaki;">
                    <option value=""> - SELECCIONE - </option>
                    <option value="A" <?php if( $o_ALM_ItemMastBN->getEstado()=="A" ){ echo "SELECTED"; } ?>> ACTIVO </option>
                    <option value="I" <?php if( $o_ALM_ItemMastBN->getEstado()=="I" ){ echo "SELECTED"; } ?>> INACTIVO </option>
                </select>
            </div>
            
            <div class="col-md-3 mb-1">
                <label class="col-form-label" for="IdTipoOperatividad">Tipo Operatividad</label>
                <select class="form-control form-control-sm custom-select my-0 " name="IdTipoOperatividad" id="IdTipoOperatividad" required style="background-color: khaki;">
                    <option value=""> - SELECCIONE - </option>
                    <?php foreach ( ALM_ItemMastBN::getArrayTipoOperatividad() as $s_Key => $s_Valor ){ ?>
                    <option value="<?=$s_Key?>" <?php if( $o_ALM_ItemMastBN->getIdTipoOperatividad()==$s_Key ){ echo "SELECTED"; } ?> ><?=$s_Valor?></option>
                    <?php } ?>
                </select>
            </div>
            
        </div>
    </div>
</div>

<ul class="nav nav-tabs m-1" id="myTab" role="tablist" style="margin-bottom: 0px !important;">
    <li class="nav-item">
        <a class="nav-link active" id="home-tab" data-toggle="tab" href="#home" role="tab" aria-controls="home" aria-selected="true">Principal</a>
    </li>
    <li class="nav-item">
        <a class="nav-link" id="profile-tab" data-toggle="tab" href="#profile" role="tab" aria-controls="profile" aria-selected="false">Inventario</a>
    </li>
    <li class="nav-item">
        <a class="nav-link" id="contact-tab" data-toggle="tab" href="#contact" role="tab" aria-controls="contact" aria-selected="false">Compra</a>
    </li>
    <li class="nav-item">
        <a class="nav-link" id="fisico-tab" data-toggle="tab" href="#fisico" role="tab" aria-controls="fisico" aria-selected="false">Fisico</a>
    </li>
</ul>
<div class="tab-content card" id="myTabContent">
    <div class="tab-pane fade show active" id="home" role="tabpanel" aria-labelledby="home-tab" style="background-color: seashell;">
        <div class="form-row mx-0">
            <div class="col-md-6 mb-1">
                <label class="col-form-label" for="TipoGarantiaId">Tipo de Garant&iacute;a</label>
                <select class="form-control form-control-sm custom-select my-0 " name="TipoGarantiaId" id="TipoGarantiaId" style="background-color: khaki;">
                    <option value=""> - SELECCIONE - </option>
                    <?php foreach ( MST_TipoGarantiaFN::select_all() as $o_MST_TipoGarantiaBN ){ ?>
                    <option value="<?=$o_MST_TipoGarantiaBN->getTipoGarantiaId()?>" <?php if( $o_ALM_ItemMastBN->getTipoGarantiaId()==$o_MST_TipoGarantiaBN->getTipoGarantiaId() ){ echo "SELECTED"; } ?> > <?=$o_MST_TipoGarantiaBN->getNombre()?> </option>
                    <?php } ?>
                </select>
            </div>
            <div class="col-md-6 mb-1">
                <div class="form-row mx-0">
                    <div class="col-md-6 mb-1">
                        <label class="col-form-label" for="Codigo">Unidad de Medida - Venta</label>
                        <select class="form-control form-control-sm custom-select my-0 " id="UnidadVenta" name="UnidadVenta" onchange="activarPorConfiguracion( this, 'CantidadUnidad' );" required style="background-color: khaki;">
                            <?php foreach ( $a_UnidadVenta as $i_Key => $o_UnidadVentaBN ){ ?>
                            <option value="<?=$o_UnidadVentaBN->getIdUnidad()?>" <?php if( $o_ALM_ItemMastBN->getUnidadVenta()==$o_UnidadVentaBN->getIdUnidad() ){ echo "SELECTED"; } ?>> <?=$o_UnidadVentaBN->getDescripcionCorta()?> </option>
                            <?php } ?>
                        </select>
                    </div>
                    <div class="col-md-6 mb-1">
                        <label class="col-form-label" for="CantidadUnidad">Cantidad Equivalente</label>
                        <input type="text" class="form-control" name="CantidadUnidad" id="CantidadUnidad" maxlength="4" 
                                        value="<?=$o_ALM_ItemMastBN->getCantidadUnidad()?>" style="text-align: center;"   autocomplete="off"
                                        onkeypress="return NumCheckEntero( event, this );"
                                        />
                    </div>
                </div>
            </div>
            
        </div>

        <div class="form-group p-1">
            <label for="DescripcionLarga" class="col-form-label">Descripci&oacute;n Larga:</label>
            <textarea class="form-control" name="DescripcionLarga" id="DescripcionLarga" rows="1"><?=$o_ALM_ItemMastBN->getDescripcionLarga()?></textarea>
        </div>
        
        <div class="form-row mx-0">
            <div class="col-md-4 mb-1">
                <div class="custom-control custom-checkbox ">
                    <input type="checkbox" class="custom-control-input" name="NoAfectoImpuestoVentasFlag" id="NoAfectoImpuestoVentasFlag" value="S" <?php if( $o_ALM_ItemMastBN->getNoAfectoImpuestoVentasFlag()=="S" ){ echo "CHECKED"; } ?>>
                    <label class="custom-control-label text-body " for="NoAfectoImpuestoVentasFlag">Es Inafecto al IGV</label>
                </div>
            </div>
            
            <div class="col-md-4 mb-1">
                <div class="custom-control custom-checkbox ">
                    <input type="checkbox" class="custom-control-input" name="EsParaAlquiler" id="EsParaAlquiler" value="SI" <?php if( $o_ALM_ItemMastBN->getEsParaAlquiler()=="SI" ){ echo "CHECKED"; } ?>>
                    <label class="custom-control-label text-body" for="EsParaAlquiler">Para Alquiler</label>
                </div>
            </div>
            <div class="col-md-4 mb-1">
                <div class="custom-control custom-checkbox ">
                    <input type="checkbox" class="custom-control-input" name="EsParaVenta" id="EsParaVenta" value="SI" <?php if( $o_ALM_ItemMastBN->getEsParaVenta()=="SI" ){ echo "CHECKED"; } ?>>
                    <label class="custom-control-label text-body" for="EsParaVenta">Para Venta</label>
                </div>
            </div>

        </div>
        
        <div class="form-row mx-0">
            <div class="col-md-4 mb-1">
                
            </div>
            <div class="col-md-4 mb-1">
                <select class="form-control form-control-sm custom-select my-0 " name="IdRangoAlquiler" id="IdRangoAlquiler"  style="background-color: khaki;">
                <option value="" > - SELECCIONE - </option>
                <?php foreach ( $a_MST_RangoAlq as $o_MST_RangoVtaBN ){ ?>
                <option value="<?=$o_MST_RangoVtaBN->getIdRango()?>" <?php if( $o_ALM_ItemMastBN->getIdRangoAlquiler()==$o_MST_RangoVtaBN->getIdRango() ){ echo "selected"; } ?> > <?=strtoupper( $o_MST_RangoVtaBN->getDescripcion() )?> </option>
                <?php } ?>
                </select>
            </div>
            <div class="col-md-4 mb-1">
                <select class="form-control form-control-sm custom-select my-0 " name="IdRangoVenta" id="IdRangoVenta" style="background-color: khaki;">
                <option value=""> - SELECCIONE - </option>
                <?php foreach ( $a_MST_RangoVta as $o_MST_RangoVtaBN ){ ?>
                <option value="<?=$o_MST_RangoVtaBN->getIdRango()?>" <?php if( $o_ALM_ItemMastBN->getIdRangoVenta()==$o_MST_RangoVtaBN->getIdRango() ){ echo "selected"; } ?>> <?=strtoupper( $o_MST_RangoVtaBN->getDescripcion() )?> </option>
                <?php } ?>
                </select>
            </div>
        </div>

    </div>
    
    <div class="dropdown-divider"></div>
        
<script type="text/javascript">
validacionPorTipoItem = function()
{
	if( $( "#IdItemTipo" ).val() == "01" || $( "#IdItemTipo" ).val() == "04" )
	{
		$( "#EsInventariableFlag" ).val( "S" );
	}
	else
	{
		$( "#EsInventariableFlag" ).val( "N" );		
	}
	validacionInv();
}

validacionInv = function()
{
    if( $( "#EsInventariableFlag" ).val() == "S" )
    {
        $( "#UsarDisponibleStock" ).prop( "checked", true );
        $( "#UsarResevableStock" ).prop( "checked", true );
        $( "#EsParaVenta" ).prop( "checked", true );
        $( "#IdRangoVenta" ).val( 1 );
        $( "#IdTipoOperatividad" ).val( "NVO" );
    }
    if( $( "#EsInventariableFlag" ).val() == "N" )
    {
        $( "#UsarDisponibleStock" ).prop( "checked", false );
        $( "#UsarResevableStock" ).prop( "checked", false );
    }
}
</script>
        
        <div class="tab-pane fade" id="profile" role="tabpanel" aria-labelledby="profile-tab" style="background-color: floralwhite;">

            <div class="form-row mx-0">
                <div class="col-md-6 mb-1">
                    <label class="col-form-label" for="EsInventariableFlag">Art Inventariable</label>
                    <select class="form-control form-control-sm custom-select my-0 " name="EsInventariableFlag" id="EsInventariableFlag" onchange="validacionInv();" style="background-color: khaki;">
                        <option value="S" <?php if( $o_ALM_ItemMastBN->getEsInventariableFlag()=="S" ){ echo "SELECTED"; } ?> > SI </option>
                        <option value="N" <?php if( $o_ALM_ItemMastBN->getEsInventariableFlag()=="N" ){ echo "SELECTED"; } ?> > NO </option>
                    </select>
                </div>
                <div class="col-md-6 mb-1">
                    <label class="col-form-label" for="IdMarca">Marca</label>
                    <select class="form-control form-control-sm custom-select my-0 " name="IdMarca" id="IdMarca" required style="background-color: khaki;">
                        <option value=""> - SELECCIONE - </option>
                        <?php foreach ( $a_ALM_Marca as $i_Key => $a_ALM_MarcaBN ){ ?>
                        <option value="<?=$a_ALM_MarcaBN->getIdMarca()?>" <?php if( $o_ALM_ItemMastBN->getIdMarca()==$a_ALM_MarcaBN->getIdMarca() ){ echo "SELECTED"; } ?> > <?=$a_ALM_MarcaBN->getDescripcionLocal()?> </option>
                        <?php } ?>
                    </select>
                </div>
            </div>

            <div class="form-row mx-0">
                <div class="col-md-4 mb-1">
                    <label class="col-form-label" for="IdLinea">Linea</label>
                    <select class="form-control form-control-sm custom-select my-0 " name="IdLinea" id="IdLinea" required style="background-color: khaki;"
                            onchange="$('#IdFamilia')[0].options.length = 1; publicForSelectAjaxJSON('<?php echo buildUrl( 'item/request' ) ?>', $( 'form' ).serialize() + '&TipoProc=Familia', 'IdFamilia');"
                            >
                        <option value=""> - SELECCIONE - </option>
                        <?php foreach ( $a_MST_ClaseLinea as $i_Key => $o_MST_ClaseLineaBN ){ ?>
                        <option value="<?=$o_MST_ClaseLineaBN->getIdLinea()?>" <?php if( $o_MST_ClaseLineaBN->getIdLinea()===$o_ALM_ItemMastBN->getIdLinea() ){ echo "SELECTED"; } ?>> <?=$o_MST_ClaseLineaBN->getDescripcion()?> </option>
                        <?php } ?>
                    </select>
                </div>
                <div class="col-md-4 mb-1">
                    <label class="col-form-label" for="IdFamilia">Familia</label>
                    <select class="form-control form-control-sm custom-select my-0 " name="IdFamilia" id="IdFamilia" style="background-color: khaki;"
                        onchange="$('#IdSubFamilia')[0].options.length = 1; publicForSelectAjaxJSON('<?php echo buildUrl( 'item/request' ) ?>', $( 'form' ).serialize() + '&TipoProc=SubFamilia', 'IdSubFamilia');"
                        >
                        <option value=""> - SELECCIONE - </option>
                        <?php if( $o_ALM_ItemMastBN->getIdItem() ){ ?>
                            <?php foreach ( $a_MST_ClaseFamilia as $i_Key => $o_MST_ClaseFamiliaBN ){ ?>
                        <option value="<?=$o_MST_ClaseFamiliaBN->getIdFamilia()?>" <?php if( $o_MST_ClaseFamiliaBN->getIdFamilia()==$o_ALM_ItemMastBN->getIdFamilia() ){ echo "SELECTED"; } ?>> <?=$o_MST_ClaseFamiliaBN->getDescripcion()?> </option>
                            <?php } ?>
                        <?php } ?>
                    </select>
                </div>
                <div class="col-md-4 mb-1">
                    <label class="col-form-label" for="IdSubFamilia">Sub-Familia</label>
                    <select class="form-control form-control-sm custom-select my-0 " name="IdSubFamilia" id="IdSubFamilia" style="background-color: khaki;">
                        <option value=""> - SELECCIONE - </option>
                        <?php if( $o_ALM_ItemMastBN->getIdItem() ){ ?>
                            <?php foreach ( MST_ClaseSubFamiliaFN::selectActivos( $o_ALM_ItemMastBN->getIdLinea(), $o_ALM_ItemMastBN->getIdFamilia() ) as $i_Key => $o_MST_ClaseSubFamiliaBN ){ ?>
                        <option value="<?=$o_MST_ClaseSubFamiliaBN->getIdSubFamilia()?>" <?php if( $o_MST_ClaseSubFamiliaBN->getIdSubFamilia()==$o_ALM_ItemMastBN->getIdSubFamilia() ){ echo "SELECTED"; } ?>> <?=$o_MST_ClaseSubFamiliaBN->getDescripcion()?> </option>
                            <?php } ?>
                        <?php } ?>
                    </select>
                </div>
            </div>

            <div class="form-row mx-0">
                <div class="col-md-6 mb-1">
                    <label class="col-form-label" for="StockMinimo">Cantidad Minimo</label>
                    <input type="text" class="form-control" name="StockMinimo" id="StockMinimo" maxlength="5" value="<?=$o_ALM_ItemMastBN->getStockMinimo()?>" style="text-align: center;" disabled="disabled" />
                </div>
                <div class="col-md-6 mb-1">
                    <label class="col-form-label" for="StockMaximo">Cantidad Maximo</label>
                    <input type="text" class="form-control" name="StockMaximo" id="StockMaximo" maxlength="5" value="<?=$o_ALM_ItemMastBN->getStockMaximo()?>" style="text-align: center;" disabled="disabled" />
                </div>
            </div>

            <div class="dropdown-divider" style="border-top: 1px solid #8c8b8b;"></div>

            <div class="form-row mx-0">
                <div class="col-md-4 mb-1">
                    <div class="custom-control custom-checkbox ">
                        <input type="checkbox" class="custom-control-input" name="UsarDisponibleStock" id="UsarDisponibleStock" value="S" <?php if( $o_ALM_ItemMastBN->getUsarDisponibleStock()=="S" ){ echo "CHECKED"; } ?>>
                        <label class="custom-control-label text-body " for="UsarDisponibleStock">Disponible Stock</label>
                    </div>
                </div>
                <div class="col-md-4 mb-1">
                    <div class="custom-control custom-checkbox ">
                        <input type="checkbox" class="custom-control-input" name="UsarResevableStock" id="UsarResevableStock" value="S" <?php if( $o_ALM_ItemMastBN->getUsarResevableStock()=="S" ){ echo "CHECKED"; } ?>>
                        <label class="custom-control-label text-body" for="UsarResevableStock">Reservable Stock</label>
                    </div>
                </div>


                <div class="col-md-4 mb-1">
                    <div class="custom-control custom-checkbox ">
                        <input type="checkbox" class="custom-control-input" name="ManejoxLoteFlag" id="ManejoxLoteFlag" value="S" <?php if( $o_ALM_ItemMastBN->getManejoxLoteFlag()=="S" ){ echo "CHECKED"; } ?>>
                        <label class="custom-control-label text-body" for="ManejoxLoteFlag">Control Lote</label>
                    </div>
                </div>
                <!--
                <div class="col-md-2 mb-1">
                    <div class="custom-control custom-checkbox ">
                        <input type="checkbox" class="custom-control-input" id="FusionarLoteFlag" name="FusionarLoteFlag" value="S" <?php if( $o_ALM_ItemMastBN->getFusionarLoteFlag()=="S" ){ echo "CHECKED"; } ?>>
                        <label class="custom-control-label text-body" for="FusionarLoteFlag">Fusi&oacute;n Lote</label>
                    </div>
                </div>
                <div class="col-md-2 mb-1">
                    <div class="custom-control custom-checkbox ">
                        <input type="checkbox" class="custom-control-input" name="ManejoxSerieFlag" id="ManejoxSerieFlag" value="S" <?php if( $o_ALM_ItemMastBN->getManejoxSerieFlag()=="S" ){ echo "CHECKED"; } ?>>
                        <label class="custom-control-label text-body" for="ManejoxSerieFlag">Control Serie</label>
                    </div>
                </div>
                -->
                
            </div>
            

            <!--<div class="form-group col-14"><hr style="border-top: 1px solid #8c8b8b;"></div>-->
            <div class="dropdown-divider" style="border-top: 1px solid #8c8b8b;"></div>

        </div>

        <div class="tab-pane fade" id="contact" role="tabpanel" aria-labelledby="contact-tab" style="background-color: ivory;">
            
            <div class="form-row mx-0">
                <div class="col-md-6 mb-1">
                    <label class="col-form-label" for="IdPersona">Proveedor</label>
                    <select class="form-control form-control-sm custom-select my-0 " name="IdPersona" id="IdPersona" style="background-color: khaki;">
                        <option value=""> - SELECCIONE - </option>
                        <?php if( $a_MST_PersonaMast ){ ?>
                            <?php foreach ( $a_MST_PersonaMast as $i_Key => $o_MST_PersonaMastBN ){ ?>
                        <option value="<?=$o_MST_PersonaMastBN->getIdPersona()?>" <?php if( $o_MST_PersonaMastBN->getIdPersona()==$o_ALM_ItemMastBN->getIdPersona() ){ echo "SELECTED"; } ?>> <?=$o_MST_PersonaMastBN->getNombreCompleto()?> </option>
                            <?php } ?>
                        <?php } ?>
                    </select>
                </div>
                <div class="col-md-6 mb-1">
                    <label class="col-form-label" for="IdProcedencia">Procedencia</label>
                    <select class="form-control form-control-sm custom-select my-0 " name="IdProcedencia" id="IdProcedencia" style="background-color: khaki;">
                        <?php foreach ( $a_MST_ItemProcedencia as $i_Key => $o_MST_ItemProcedenciaBN ){ ?>
                        <option value="<?=$o_MST_ItemProcedenciaBN->getIdProcedencia()?>" <?php if( $o_ALM_ItemMastBN->getIdProcedencia()==$o_MST_ItemProcedenciaBN->getIdProcedencia() ){ echo "SELECTED"; } ?> > <?=$o_MST_ItemProcedenciaBN->getDescripcion()?> </option>
                        <?php } ?>
                    </select>
                </div>
            </div>

            <div class="form-row mx-0">
                <div class="col-md-6 mb-1">
                    <label class="col-form-label" for="CodigoBarrasFabricante">Cod Barras Fabricante</label>
                    <input type="text" class="form-control" name="CodigoBarrasFabricante" id="CodigoBarrasFabricante" placeholder="Codigo Barras del Fabricante" value="<?=$o_ALM_ItemMastBN->getCodigoBarrasFabricante()?>">
                </div>
                <div class="col-md-6 mb-1">
                    <div class="form-row mx-0">
                        <div class="col-md-6 mb-1">
                            <label class="col-form-label" for="UnidadCompra">Unidad Medida - Compra</label>
                            <select class="form-control form-control-sm custom-select my-0 " id="UnidadCompra" name="UnidadCompra" onchange="activarPorConfiguracion( this, 'CantidadUnidadCompra' );" required style="background-color: khaki;">
                                <?php foreach ( $a_UnidadCompra as $i_Key => $o_UnidadCompraBN ){ ?>
                                <option value="<?=$o_UnidadCompraBN->getIdUnidad()?>" <?php if( $o_ALM_ItemMastBN->getUnidadCompra()==$o_UnidadCompraBN->getIdUnidad() ){ echo "SELECTED"; } ?>> <?=$o_UnidadCompraBN->getDescripcionCorta()?> </option>
                                <?php } ?>
                            </select>
                        </div>
                        <div class="col-md-6 mb-1">
                            <label class="col-form-label" for="CantidadUnidadCompra">Cantidad Equivalente</label>
                            <input type="text" class="form-control" name="CantidadUnidadCompra" id="CantidadUnidadCompra" 
                                            maxlength="4" value="<?=$o_ALM_ItemMastBN->getCantidadUnidadCompra()?>" style="text-align: center;" 
                                            onkeypress="return NumCheckEntero( event, this );" autocomplete="off"
                                            />
                        </div>
                    </div>
                </div>
            </div>

            <div class="dropdown-divider" style="border-top: 1px solid #8c8b8b;"></div>

        </div>

        <div class="tab-pane fade" id="fisico" role="tabpanel" aria-labelledby="fisico-tab" style="background-color: aliceblue;">
            
            <div class="form-row mx-0">
                <div class="col-md-6 mb-1">
                    <label class="col-form-label" for="PesoGramos">Peso en Kg</label>
                    <input type="text" class="form-control" name="PesoGramos" id="PesoGramos" placeholder="Peso en Kilogramo" value="<?=$o_ALM_ItemMastBN->getPesoGramos()?>">
                </div>
                <div class="col-md-6 mb-1">
                    &nbsp;
                </div>
            </div>

        </div>
    </div>
    
    <div class="dropdown-divider"></div>

