<?php use_helper( 'UrlFunctions' ); ?>
<?php use_helper( 'IncludePartial' ); ?>
<?php use_helper( 'UtilFunctions' ); ?>
<div class="titleBody descripProy">
    <ul>
        <li style="width:100% !important;">
            <?=$Titulo?>
        </li>
    </ul>
</div>
<div id="resultContent" style=""></div>
<script type="text/javascript">
sincronizar = function()
{
    var item_id = trim( $( "#item_id" ).val() );
    var param = "";
	//window.open( '<?=buildUrlComplet( 'web/tools/import_data_gd.php' ) ?>', '_BLANK' );
    if( item_id != "" )
    {
        param = "?item_id=" + item_id;
    }
    pr( "<?=buildUrlComplet( 'web/tools/import_data_gd.php' ) ?>" + param );
    //$( '#myIframe' ).attr( 'src', '<?=buildUrlComplet( 'web/tools/import_data_gd.php' ) ?>' + param );
    //$( "#myIframe" ).contents().find("body").html( '<div style="height: 100%; background: none repeat scroll 0 0 #aaaaaa; opacity: 0.4;"><img src="<?=Constantes::ROOT_DIR_IMG?>common/indicator_big.gif" style="top: 50%; position: absolute; left: 50%; margin-right: -50%; transform: translate(-50%, -50%);"></div>' )
    //$( '#dialog' ).dialog( 'open' );
}
sincronizarItems = function()
{
    var item_id = trim( $( "#item_id" ).val() );
    var param = "";
    if( item_id != "" )
    {
        param = "?item_id=" + item_id;
    }
    pr( "<?=buildUrlComplet( 'web/tools/import_data_gd_to_local.php' ) ?>" + param );
    //$( '#myIframe' ).attr( 'src', '<?=buildUrlComplet( 'web/tools/import_data_gd_to_local.php' ) ?>' + param );
    //$( "#myIframe" ).contents().find("body").html( '<div style="height: 100%; background: none repeat scroll 0 0 #aaaaaa; opacity: 0.4;"><img src="<?=Constantes::ROOT_DIR_IMG?>common/indicator_big.gif" style="top: 50%; position: absolute; left: 50%; margin-right: -50%; transform: translate(-50%, -50%);"></div>' )
    //$( '#dialog' ).dialog( 'open' );
}
sincronizarStocks = function()
{
    //$( '#myIframe' ).attr( 'src', '<?=buildUrlComplet( 'web/tools/import_data_stock_gd.php' ) ?>' );
    //$( "#myIframe" ).contents().find("body").html( '<div style="height: 100%; background: none repeat scroll 0 0 #aaaaaa; opacity: 0.4;"><img src="<?=Constantes::ROOT_DIR_IMG?>common/indicator_big.gif" style="top: 50%; position: absolute; left: 50%; margin-right: -50%; transform: translate(-50%, -50%);"></div>' )
    //$( '#dialog' ).dialog( 'open' );
}
sincronizarExtData = function()
{
    var item_id = trim( $( "#item_id" ).val() );
    var param = "";
    if( item_id != "" )
    {
        param = "?ItemCode=" + item_id + "&item_id=" + item_id;
    }
    pr( "http://ghardsoft.com/webservice/ext/det_data_ext.php" + param );
    //$( '#myIframe' ).attr( 'src', 'http://ghardsoft.com/webservice/ext/det_data_ext.php' + param );
    //$( "#myIframe" ).contents().find("body").html( '<div style="height: 100%; background: none repeat scroll 0 0 #aaaaaa; opacity: 0.4;"><img src="<?=Constantes::ROOT_DIR_IMG?>common/indicator_big.gif" style="top: 50%; position: absolute; left: 50%; margin-right: -50%; transform: translate(-50%, -50%);"></div>' )
    //$( '#dialog' ).dialog( 'open' );
}
sincronizarExtStock = function()
{
    $( '#myIframe' ).attr( 'src', 'http://ghardsoft.com/webservice/ext/det_stk_ext.php' );
    $( "#myIframe" ).contents().find("body").html( '<div style="height: 100%; background: none repeat scroll 0 0 #aaaaaa; opacity: 0.4;"><img src="<?=Constantes::ROOT_DIR_IMG?>common/indicator_big.gif" style="top: 50%; position: absolute; left: 50%; margin-right: -50%; transform: translate(-50%, -50%);"></div>' )
    $( '#dialog' ).dialog( 'open' );
}
sincronizarExtCaracteristica = function()
{
    var item_id = trim( $( "#item_id" ).val() );
    var param = "";
    if( item_id != "" )
    {
        param = "?item_id=" + item_id;
    }
    $( '#myIframe' ).attr( 'src', 'http://ghardsoft.com/webservice/ext/det_feature_ext.php' + param );
    $( "#myIframe" ).contents().find("body").html( '<div style="height: 100%; background: none repeat scroll 0 0 #aaaaaa; opacity: 0.4;"><img src="<?=Constantes::ROOT_DIR_IMG?>common/indicator_big.gif" style="top: 50%; position: absolute; left: 50%; margin-right: -50%; transform: translate(-50%, -50%);"></div>' )
    $( '#dialog' ).dialog( 'open' );
}
sincronizarExtPrecio = function()
{
    var item_id = trim( $( "#item_id" ).val() );
    var param = "";
    if( item_id != "" )
    {
        param = "?item_id=" + item_id;
    }
    window.open( 'http://ghardsoft.com/webservice/ext/det_price_ext.php' + param, '_BLANK' );
    /*$( '#myIframe' ).attr( 'src', 'http://ghardsoft.com/webservice/ext/det_price_ext.php' );
    $( "#myIframe" ).contents().find("body").html( '<div style="height: 100%; background: none repeat scroll 0 0 #aaaaaa; opacity: 0.4;"><img src="<?=Constantes::ROOT_DIR_IMG?>common/indicator_big.gif" style="top: 50%; position: absolute; left: 50%; margin-right: -50%; transform: translate(-50%, -50%);"></div>' )
    $( '#dialog' ).dialog( 'open' );*/
}
sincronizarExtPromo = function()
{
    window.open( 'https://ghardsoft.com/webservice/ext/det_promo_ext.php', '_BLANK' );
    /*$( '#myIframe' ).attr( 'src', 'http://ghardsoft.com/webservice/ext/det_price_ext.php' );
    $( "#myIframe" ).contents().find("body").html( '<div style="height: 100%; background: none repeat scroll 0 0 #aaaaaa; opacity: 0.4;"><img src="<?=Constantes::ROOT_DIR_IMG?>common/indicator_big.gif" style="top: 50%; position: absolute; left: 50%; margin-right: -50%; transform: translate(-50%, -50%);"></div>' )
    $( '#dialog' ).dialog( 'open' );*/
}
sincronizarExtImagen = function()
{
    window.open( 'http://ghardsoft.com/webservice/ext/create_img_ext.php', '_BLANK' );
}
sincronizarExtMarca = function()
{
    $( '#myIframe' ).attr( 'src', 'http://ghardsoft.com/webservice/ext/create_manufacturer_ext.php' );
    $( "#myIframe" ).contents().find("body").html( '<div style="height: 100%; background: none repeat scroll 0 0 #aaaaaa; opacity: 0.4;"><img src="<?=Constantes::ROOT_DIR_IMG?>common/indicator_big.gif" style="top: 50%; position: absolute; left: 50%; margin-right: -50%; transform: translate(-50%, -50%);"></div>' )
    $( '#dialog' ).dialog( 'open' );
}
sincronizarExtCategoria = function()
{
    $( '#myIframe' ).attr( 'src', 'http://ghardsoft.com/webservice/ext/create_category_ext.php' );
    $( "#myIframe" ).contents().find("body").html( '<div style="height: 100%; background: none repeat scroll 0 0 #aaaaaa; opacity: 0.4;"><img src="<?=Constantes::ROOT_DIR_IMG?>common/indicator_big.gif" style="top: 50%; position: absolute; left: 50%; margin-right: -50%; transform: translate(-50%, -50%);"></div>' )
    $( '#dialog' ).dialog( 'open' );
}
sincronizarExtSubCategoria = function()
{
    $( '#myIframe' ).attr( 'src', 'http://ghardsoft.com/webservice/ext/create_sub_categoria_ext.php' );
    $( "#myIframe" ).contents().find("body").html( '<div style="height: 100%; background: none repeat scroll 0 0 #aaaaaa; opacity: 0.4;"><img src="<?=Constantes::ROOT_DIR_IMG?>common/indicator_big.gif" style="top: 50%; position: absolute; left: 50%; margin-right: -50%; transform: translate(-50%, -50%);"></div>' )
    $( '#dialog' ).dialog( 'open' );
}
sincronizarExtSubirProductos = function()
{
    $( '#myIframe' ).attr( 'src', 'http://ghardsoft.com/webservice/ext/create_product_ext.php' );
    $( "#myIframe" ).contents().find("body").html( '<div style="height: 100%; background: none repeat scroll 0 0 #aaaaaa; opacity: 0.4;"><img src="<?=Constantes::ROOT_DIR_IMG?>common/indicator_big.gif" style="top: 50%; position: absolute; left: 50%; margin-right: -50%; transform: translate(-50%, -50%);"></div>' )
    $( '#dialog' ).dialog( 'open' );
}
</script>
<div style=" margin-top: 10px; margin-bottom: 10px; width: 99%">
    <div style="width: 30%; display: inline-block; text-align: center;">
        <fieldset style="">
            <legend> Sistema Local </legend>
            <input type="text" class="text" name="item_id" id="item_id"><br>
            <input class="ui-button ui-widget ui-corner-all" style="" type="button" value="Sincronizar" onclick="sincronizar();">
            <input class="ui-button ui-widget ui-corner-all" style="" type="button" value="Sinc Items" onclick="sincronizarItems();">
            <input class="ui-button ui-widget ui-corner-all" style="" type="button" value="Sincronizar Stocks" onclick="sincronizarStocks();">

        </fieldset>
    </div>

    <div style="width: 60%; display: inline-block;">
        <fieldset style="">
            <legend> Sistema Ecommerce </legend>

            <input class="ui-button ui-widget ui-corner-all" style="" type="button" value="Sinc Data" onclick="sincronizarExtData();">
            <input class="ui-button ui-widget ui-corner-all" style="" type="button" value="Sinc Stocks" onclick="sincronizarExtStock();">
            <input class="ui-button ui-widget ui-corner-all" style="" type="button" value="Sinc Caract" onclick="sincronizarExtCaracteristica();">
            <input class="ui-button ui-widget ui-corner-all" style="" type="button" value="Sinc Precio" onclick="sincronizarExtPrecio();">
            <input class="ui-button ui-widget ui-corner-all" style="" type="button" value="Sinc Promocion" onclick="sincronizarExtPromo();">
<br>
            <div style="display: inline-block;">
                <fieldset style="">
                    <legend> 1. Marcas </legend>
                    <input class="ui-button ui-widget ui-corner-all" style="" type="button" value="Sinc Marca" onclick="sincronizarExtMarca();">
                </fieldset>
            </div>

            <div style="display: inline-block;">
                <fieldset style="">
                    <legend> 2. Categoria </legend>
                    <input class="ui-button ui-widget ui-corner-all" style="" type="button" value="Sinc Categoria" onclick="sincronizarExtCategoria();">
                </fieldset>
            </div>

            <div style="display: inline-block;">
                <fieldset style="">
                    <legend> 3. SubCategoria </legend>
                    <input class="ui-button ui-widget ui-corner-all" style="" type="button" value="Sinc SubCategoria" onclick="sincronizarExtSubCategoria();">
                </fieldset>
            </div>

            <div style="display: inline-block;">
                <fieldset style="">
                    <legend> 4. Subir Productos </legend>
                    <input class="ui-button ui-widget ui-corner-all" style="" type="button" value="Subir Productos" onclick="sincronizarExtSubirProductos();">
                </fieldset>
            </div>

            <div style="display: inline-block;">
                <fieldset style="">
                    <legend> 5. Imagenes  </legend>
                    <input class="ui-button ui-widget ui-corner-all" style="" type="button" value="Sinc Imagen" onclick="sincronizarExtImagen();">
                </fieldset>
            </div>

        </fieldset>
    </div>
    
    
</div>
<div class="block">
    <form action="" method="post" name="form1" id="form1">
        <table class="marco" style="background:#E3E9E2" width="99%" border="0" cellpadding="0" cellspacing="0">
            <tr>
                <td>
                    <table width="100%" cellspacing="0" cellpadding="0" border="0">
                        <tr>
                            <td nowrap="nowrap">
                                <table  cellspacing="1" cellpadding="0" border="0" class="SubCabecera" width='100%'>
                                    <tr>
                                    
                                    	<td  nowrap="nowrap"><label for=codigo class="label">Codigo :</label></td>
                                        <td nowrap="nowrap"><input type="text" class="text" name="codigo" id="codigo"></td>
                                    
                                        <td  nowrap="nowrap"><label for=nombre class="label">Nombre :</label></td>
                                        <td nowrap="nowrap"><input type="text" class="text" name="nombre" id="nombre"></td>

                                        <td  nowrap="nowrap"><label for=grupo_linea class="label">Linea :</label></td>
                                        <td nowrap="nowrap">
                                            <select class="select" name="grupo_linea" id="grupo_linea" 
                                                onchange="$('#linea_prod')[0].options.length=1; publicForSelectAjaxJSON('<?=buildUrl( 'import/request' ) ?>', {type:'load_line_prod', value_id:this.value}, 'linea_prod' );"
                                                style='width: 150px;'
                                                >
                                                <option value=""> - Seleccione - </option>
                                                <?php foreach ( $a_GrupoLinea as $key => $o_Value ) { ?>
                                                    <option value="<?=$o_Value->item_tipo_id?>"> <?=$o_Value->item_tipo_desc?> </option>
                                                <?php } ?>
                                            </select>
                                        </td>

                                        <td  nowrap="nowrap"><label for=linea_prod class="label">Familia :</label></td>
                                        <td nowrap="nowrap">
                                            <select class="select" name="linea_prod" id="linea_prod" style='width: 150px;'>
                                                <option value=""> - Seleccione - </option>
                                            </select>
                                        </td>

                                        <td  nowrap="nowrap"><label for=marca class="label">Marca :</label></td>
                                        <td nowrap="nowrap">
                                            <select class="select" name="marca" id="marca" style='width: 150px;'>
                                                <option value=""> - Seleccione - </option>
                                                <?php foreach ( $a_Marca as $key => $o_Value ) { ?>
                                                    <option value="<?=$o_Value->marca_id?>"> <?=$o_Value->marca_desc?> </option>
                                                <?php } ?>
                                            </select>
                                        </td>
                                        
                                        <td>
                                        	<input type="button" onclick="findControl();" value="Buscar" class="button">
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
    </form>
</div>
<br>
<?php include_partial( "grid" ); ?>
<?=crearFuentePopupIframe( array( "div_id"=>"dialog", "iframe_id"=>"myIframe", "popup_title"=>"Resumen", "popup_width"=>"600", "popup_height"=>"400", "modal"=>true ) )?>