<?php /* Smarty version 2.6.11, created on 2016-04-05 00:56:50
         compiled from modules/cont__centro_llamadas/tpl/ListViewGeneric.tpl */ ?>
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('function', 'sugar_getjspath', 'modules/cont__centro_llamadas/tpl/ListViewGeneric.tpl', 58, false),array('function', 'counter', 'modules/cont__centro_llamadas/tpl/ListViewGeneric.tpl', 143, false),array('function', 'sugar_translate', 'modules/cont__centro_llamadas/tpl/ListViewGeneric.tpl', 161, false),array('function', 'sugar_getimage', 'modules/cont__centro_llamadas/tpl/ListViewGeneric.tpl', 167, false),array('function', 'sugar_ajax_url', 'modules/cont__centro_llamadas/tpl/ListViewGeneric.tpl', 249, false),array('function', 'sugar_evalcolumn_old', 'modules/cont__centro_llamadas/tpl/ListViewGeneric.tpl', 254, false),array('function', 'sugar_field', 'modules/cont__centro_llamadas/tpl/ListViewGeneric.tpl', 300, false),array('modifier', 'replace', 'modules/cont__centro_llamadas/tpl/ListViewGeneric.tpl', 92, false),array('modifier', 'default', 'modules/cont__centro_llamadas/tpl/ListViewGeneric.tpl', 150, false),array('modifier', 'lower', 'modules/cont__centro_llamadas/tpl/ListViewGeneric.tpl', 153, false),array('modifier', 'upper', 'modules/cont__centro_llamadas/tpl/ListViewGeneric.tpl', 156, false),array('modifier', 'substr', 'modules/cont__centro_llamadas/tpl/ListViewGeneric.tpl', 262, false),array('modifier', 'date_format', 'modules/cont__centro_llamadas/tpl/ListViewGeneric.tpl', 771, false),)), $this); ?>

<?php if ($this->_tpl_vars['strMsjResponse'] != ""): ?>
    <div class="ui-widget">
	<div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;">
            <p>
                <br/>
                <span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
                <strong>Informaci&oacute;n!</strong>
                <?php echo $this->_tpl_vars['strMsjResponse']; ?>

                <br/>
            </p>
	</div>
    </div>
<?php endif; ?>


<script type='text/javascript' src='<?php echo smarty_function_sugar_getjspath(array('file' => 'include/javascript/popup_helper.js'), $this);?>
'></script>

<script>
<?php echo '
	$(document).ready(function(){
	    $("ul.clickMenu").each(function(index, node){
	  		$(node).sugarActionMenu();
	  	});

        $(\'.selectActionsDisabled\').children().each(function(index) {
            $(this).attr(\'onclick\',\'\').unbind(\'click\');
        });
        
        var selectedTopValue = $("#selectCountTop").attr("value");
        if(typeof(selectedTopValue) != "undefined" && selectedTopValue != "0"){
        	sugarListView.prototype.toggleSelected();
        }
	});
'; ?>
	
</script>
<?php $this->assign('currentModule', $this->_tpl_vars['pageData']['bean']['moduleDir']);  $this->assign('singularModule', $this->_tpl_vars['moduleListSingular'][$this->_tpl_vars['currentModule']]);  $this->assign('moduleName', $this->_tpl_vars['moduleList'][$this->_tpl_vars['currentModule']]);  $this->assign('hideTable', false); ?>

<?php if (count ( $this->_tpl_vars['data'] ) == 0): ?>
	<?php $this->assign('hideTable', true); ?>
	<div class="list view listViewEmpty">
    <?php if ($this->_tpl_vars['displayEmptyDataMesssages']): ?>
        <?php if (strlen ( $this->_tpl_vars['query'] ) == 0): ?>
                <?php ob_start(); ?><a href="?module=<?php echo $this->_tpl_vars['pageData']['bean']['moduleDir']; ?>
&action=EditView&return_module=<?php echo $this->_tpl_vars['pageData']['bean']['moduleDir']; ?>
&return_action=DetailView"><?php echo $this->_tpl_vars['APP']['LBL_CREATE_BUTTON_LABEL']; ?>
</a><?php $this->_smarty_vars['capture']['default'] = ob_get_contents();  $this->assign('createLink', ob_get_contents());ob_end_clean(); ?>
                <?php ob_start(); ?><a href="?module=Import&action=Step1&import_module=<?php echo $this->_tpl_vars['pageData']['bean']['moduleDir']; ?>
&return_module=<?php echo $this->_tpl_vars['pageData']['bean']['moduleDir']; ?>
&return_action=index"><?php echo $this->_tpl_vars['APP']['LBL_IMPORT']; ?>
</a><?php $this->_smarty_vars['capture']['default'] = ob_get_contents();  $this->assign('importLink', ob_get_contents());ob_end_clean(); ?>
                <?php ob_start(); ?><a target="_blank" href='?module=Administration&action=SupportPortal&view=documentation&version=<?php echo $this->_tpl_vars['sugar_info']['sugar_version']; ?>
&edition=<?php echo $this->_tpl_vars['sugar_info']['sugar_flavor']; ?>
&lang=&help_module=<?php echo $this->_tpl_vars['currentModule']; ?>
&help_action=&key='><?php echo $this->_tpl_vars['APP']['LBL_CLICK_HERE']; ?>
</a><?php $this->_smarty_vars['capture']['default'] = ob_get_contents();  $this->assign('helpLink', ob_get_contents());ob_end_clean(); ?>
                <p class="msg">
                    <?php echo ((is_array($_tmp=((is_array($_tmp=$this->_tpl_vars['APP']['MSG_EMPTY_LIST_VIEW_NO_RESULTS'])) ? $this->_run_mod_handler('replace', true, $_tmp, "<item2>", $this->_tpl_vars['createLink']) : smarty_modifier_replace($_tmp, "<item2>", $this->_tpl_vars['createLink'])))) ? $this->_run_mod_handler('replace', true, $_tmp, "<item3>", $this->_tpl_vars['importLink']) : smarty_modifier_replace($_tmp, "<item3>", $this->_tpl_vars['importLink'])); ?>

                </p>
                <p class="submsg">
                    <?php echo ((is_array($_tmp=((is_array($_tmp=$this->_tpl_vars['APP']['MSG_EMPTY_LIST_VIEW_NO_RESULTS_SUBMSG'])) ? $this->_run_mod_handler('replace', true, $_tmp, "<item1>", $this->_tpl_vars['moduleName']) : smarty_modifier_replace($_tmp, "<item1>", $this->_tpl_vars['moduleName'])))) ? $this->_run_mod_handler('replace', true, $_tmp, "<item4>", $this->_tpl_vars['helpLink']) : smarty_modifier_replace($_tmp, "<item4>", $this->_tpl_vars['helpLink'])); ?>

                </p>
        <?php elseif ($this->_tpl_vars['query'] == "-advanced_search"): ?>
            <p class="msg">
                <?php echo $this->_tpl_vars['APP']['MSG_LIST_VIEW_NO_RESULTS_BASIC']; ?>

            </p>
        <?php else: ?>
            <p class="msg">
                <?php ob_start(); ?>"<?php echo $this->_tpl_vars['query']; ?>
"<?php $this->_smarty_vars['capture']['default'] = ob_get_contents();  $this->assign('quotedQuery', ob_get_contents());ob_end_clean(); ?>
                <?php echo ((is_array($_tmp=$this->_tpl_vars['APP']['MSG_LIST_VIEW_NO_RESULTS'])) ? $this->_run_mod_handler('replace', true, $_tmp, "<item1>", $this->_tpl_vars['quotedQuery']) : smarty_modifier_replace($_tmp, "<item1>", $this->_tpl_vars['quotedQuery'])); ?>

            </p>
            <p class = "submsg">
                <a href="?module=<?php echo $this->_tpl_vars['pageData']['bean']['moduleDir']; ?>
&action=EditView&return_module=<?php echo $this->_tpl_vars['pageData']['bean']['moduleDir']; ?>
&return_action=DetailView">
                    <?php echo ((is_array($_tmp=((is_array($_tmp=$this->_tpl_vars['APP']['MSG_LIST_VIEW_NO_RESULTS_SUBMSG'])) ? $this->_run_mod_handler('replace', true, $_tmp, "<item1>", $this->_tpl_vars['quotedQuery']) : smarty_modifier_replace($_tmp, "<item1>", $this->_tpl_vars['quotedQuery'])))) ? $this->_run_mod_handler('replace', true, $_tmp, "<item2>", $this->_tpl_vars['singularModule']) : smarty_modifier_replace($_tmp, "<item2>", $this->_tpl_vars['singularModule'])); ?>

                </a>

            </p>
        <?php endif; ?>
    <?php else: ?>
        <p class="msg">
            <?php echo $this->_tpl_vars['APP']['LBL_NO_DATA']; ?>

        </p>
	<?php endif; ?>
	</div>
<?php endif;  echo $this->_tpl_vars['multiSelectData']; ?>


<?php if ($this->_tpl_vars['hideTable'] == false): ?>
	<table cellpadding='0' cellspacing='0' width='100%' border='0' class='list view'>
    <?php $this->assign('link_select_id', 'selectLinkTop'); ?>
    <?php $this->assign('link_action_id', 'actionLinkTop'); ?>
    <?php $this->assign('actionsLink', $this->_tpl_vars['actionsLinkTop']); ?>
    <?php $this->assign('selectLink', $this->_tpl_vars['selectLinkTop']); ?>
    <?php $this->assign('action_menu_location', 'top'); ?>
	<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => 'include/ListView/ListViewPagination.tpl', 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
	
    <tr height='20'>
            <td width='1%' class="td_alt">&nbsp;</td>

            <?php if ($this->_tpl_vars['prerow']): ?>

                    <!--<td width='1%' class="td_alt">
                            &nbsp;
                    </td>-->
            <?php endif; ?>
            <?php if (! empty ( $this->_tpl_vars['quickViewLinks'] )): ?>
                <!--<td class='td_alt' width='1%' style="padding: 0px;">&nbsp;</td>-->
            <?php endif; ?>
            <?php echo smarty_function_counter(array('start' => 0,'name' => 'colCounter','print' => false,'assign' => 'colCounter'), $this);?>

            <?php $_from = $this->_tpl_vars['displayColumns']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['colHeader'] => $this->_tpl_vars['params']):
?>
                
                <?php if ($this->_tpl_vars['colHeader'] == 'ID_TIENDA' || $this->_tpl_vars['colHeader'] == 'DO_NOT_CALL'): ?>
                <?php else: ?>
                        <th scope='col' width='<?php echo $this->_tpl_vars['params']['width']; ?>
%'>

                            <div style='white-space: normal;'width='100%' align='<?php echo ((is_array($_tmp=@$this->_tpl_vars['params']['align'])) ? $this->_run_mod_handler('default', true, $_tmp, 'left') : smarty_modifier_default($_tmp, 'left')); ?>
'>
                                <?php if (((is_array($_tmp=@$this->_tpl_vars['params']['sortable'])) ? $this->_run_mod_handler('default', true, $_tmp, true) : smarty_modifier_default($_tmp, true))): ?>
                                    <?php if ($this->_tpl_vars['params']['url_sort']): ?>
                                        <a href='<?php echo $this->_tpl_vars['pageData']['urls']['orderBy'];  echo ((is_array($_tmp=((is_array($_tmp=@$this->_tpl_vars['params']['orderBy'])) ? $this->_run_mod_handler('default', true, $_tmp, @$this->_tpl_vars['colHeader']) : smarty_modifier_default($_tmp, @$this->_tpl_vars['colHeader'])))) ? $this->_run_mod_handler('lower', true, $_tmp) : smarty_modifier_lower($_tmp)); ?>
' class='listViewThLinkS1'>
                                    <?php else: ?>
                                        <?php if (((is_array($_tmp=((is_array($_tmp=@$this->_tpl_vars['params']['orderBy'])) ? $this->_run_mod_handler('default', true, $_tmp, @$this->_tpl_vars['colHeader']) : smarty_modifier_default($_tmp, @$this->_tpl_vars['colHeader'])))) ? $this->_run_mod_handler('lower', true, $_tmp) : smarty_modifier_lower($_tmp)) == $this->_tpl_vars['pageData']['ordering']['orderBy']): ?>
                                            <a href='javascript:sListView.order_checks("<?php echo ((is_array($_tmp=@$this->_tpl_vars['pageData']['ordering']['sortOrder'])) ? $this->_run_mod_handler('default', true, $_tmp, 'ASCerror') : smarty_modifier_default($_tmp, 'ASCerror')); ?>
", "<?php echo ((is_array($_tmp=((is_array($_tmp=@$this->_tpl_vars['params']['orderBy'])) ? $this->_run_mod_handler('default', true, $_tmp, @$this->_tpl_vars['colHeader']) : smarty_modifier_default($_tmp, @$this->_tpl_vars['colHeader'])))) ? $this->_run_mod_handler('lower', true, $_tmp) : smarty_modifier_lower($_tmp)); ?>
" , "<?php echo $this->_tpl_vars['pageData']['bean']['moduleDir'];  echo '2_';  echo ((is_array($_tmp=$this->_tpl_vars['pageData']['bean']['objectName'])) ? $this->_run_mod_handler('upper', true, $_tmp) : smarty_modifier_upper($_tmp));  echo '_ORDER_BY'; ?>
")' class='listViewThLinkS1'>
                                        <?php else: ?>
                                            <a href='javascript:sListView.order_checks("ASC", "<?php echo ((is_array($_tmp=((is_array($_tmp=@$this->_tpl_vars['params']['orderBy'])) ? $this->_run_mod_handler('default', true, $_tmp, @$this->_tpl_vars['colHeader']) : smarty_modifier_default($_tmp, @$this->_tpl_vars['colHeader'])))) ? $this->_run_mod_handler('lower', true, $_tmp) : smarty_modifier_lower($_tmp)); ?>
" , "<?php echo $this->_tpl_vars['pageData']['bean']['moduleDir'];  echo '2_';  echo ((is_array($_tmp=$this->_tpl_vars['pageData']['bean']['objectName'])) ? $this->_run_mod_handler('upper', true, $_tmp) : smarty_modifier_upper($_tmp));  echo '_ORDER_BY'; ?>
")' class='listViewThLinkS1'>
                                        <?php endif; ?>
                                    <?php endif; ?>
                                                <?php echo smarty_function_sugar_translate(array('label' => $this->_tpl_vars['params']['label'],'module' => $this->_tpl_vars['pageData']['bean']['moduleDir']), $this);?>

                                                &nbsp;&nbsp;
                                                <?php if (((is_array($_tmp=((is_array($_tmp=@$this->_tpl_vars['params']['orderBy'])) ? $this->_run_mod_handler('default', true, $_tmp, @$this->_tpl_vars['colHeader']) : smarty_modifier_default($_tmp, @$this->_tpl_vars['colHeader'])))) ? $this->_run_mod_handler('lower', true, $_tmp) : smarty_modifier_lower($_tmp)) == $this->_tpl_vars['pageData']['ordering']['orderBy']): ?>
                                                    <?php if ($this->_tpl_vars['pageData']['ordering']['sortOrder'] == 'ASC'): ?>
                                                        <?php ob_start(); ?>arrow_down.<?php echo $this->_tpl_vars['arrowExt'];  $this->_smarty_vars['capture']['default'] = ob_get_contents();  $this->assign('imageName', ob_get_contents());ob_end_clean(); ?>
                                                        <?php ob_start();  echo smarty_function_sugar_translate(array('label' => 'LBL_ALT_SORT_DESC'), $this); $this->_smarty_vars['capture']['default'] = ob_get_contents();  $this->assign('alt_sort', ob_get_contents());ob_end_clean(); ?>
                                                        <?php echo smarty_function_sugar_getimage(array('name' => $this->_tpl_vars['imageName'],'attr' => 'align="absmiddle" border="0" ','alt' => ($this->_tpl_vars['alt_sort'])), $this);?>

                                                    <?php else: ?>
                                                        <?php ob_start(); ?>arrow_up.<?php echo $this->_tpl_vars['arrowExt'];  $this->_smarty_vars['capture']['default'] = ob_get_contents();  $this->assign('imageName', ob_get_contents());ob_end_clean(); ?>
                                                        <?php ob_start();  echo smarty_function_sugar_translate(array('label' => 'LBL_ALT_SORT_ASC'), $this); $this->_smarty_vars['capture']['default'] = ob_get_contents();  $this->assign('alt_sort', ob_get_contents());ob_end_clean(); ?>
                                                        <?php echo smarty_function_sugar_getimage(array('name' => $this->_tpl_vars['imageName'],'attr' => 'align="absmiddle" border="0" ','alt' => ($this->_tpl_vars['alt_sort'])), $this);?>

                                                    <?php endif; ?>
                                                <?php else: ?>
                                                    <?php ob_start(); ?>arrow.<?php echo $this->_tpl_vars['arrowExt'];  $this->_smarty_vars['capture']['default'] = ob_get_contents();  $this->assign('imageName', ob_get_contents());ob_end_clean(); ?>
                                                    <?php ob_start();  echo smarty_function_sugar_translate(array('label' => 'LBL_ALT_SORT'), $this); $this->_smarty_vars['capture']['default'] = ob_get_contents();  $this->assign('alt_sort', ob_get_contents());ob_end_clean(); ?>
                                                    <?php echo smarty_function_sugar_getimage(array('name' => $this->_tpl_vars['imageName'],'attr' => 'align="absmiddle" border="0" ','alt' => ($this->_tpl_vars['alt_sort'])), $this);?>

                                                <?php endif; ?>
                                            </a>
                                                <?php else: ?>
                                                    <?php if (! isset ( $this->_tpl_vars['params']['noHeader'] ) || $this->_tpl_vars['params']['noHeader'] == false): ?> 
                                                        <?php echo smarty_function_sugar_translate(array('label' => $this->_tpl_vars['params']['label'],'module' => $this->_tpl_vars['pageData']['bean']['moduleDir']), $this);?>

                                                    <?php endif; ?>
                                                <?php endif; ?>

                            </div>
                    </th>
                <?php endif; ?>
                <?php echo smarty_function_counter(array('name' => 'colCounter'), $this);?>

            <?php endforeach; endif; unset($_from); ?>
            <td class='td_alt' nowrap="nowrap" width='1%'>&nbsp;</td>
        </tr>
			
        <?php echo smarty_function_counter(array('start' => $this->_tpl_vars['pageData']['offsets']['current'],'print' => false,'assign' => 'offset','name' => 'offset'), $this);?>
	
        <?php $_from = $this->_tpl_vars['data']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }$this->_foreach['rowIteration'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['rowIteration']['total'] > 0):
    foreach ($_from as $this->_tpl_vars['id'] => $this->_tpl_vars['rowData']):
        $this->_foreach['rowIteration']['iteration']++;
?>
            <?php echo smarty_function_counter(array('name' => 'offset','print' => false), $this);?>

            <?php $this->assign('scope_row', true); ?>
	
                <?php if ((1 & $this->_foreach['rowIteration']['iteration'])): ?>
                    <?php $this->assign('_rowColor', $this->_tpl_vars['rowColor'][0]); ?>
                <?php else: ?>
                    <?php $this->assign('_rowColor', $this->_tpl_vars['rowColor'][1]); ?>
                <?php endif; ?>
                <?php if ($this->_tpl_vars['rowData']['DO_NOT_CALL'] == 1): ?>
                    <?php $this->assign('backCustom', 'background-color:#F9D1D1 !important;'); ?>
                <?php else: ?>
                    <?php $this->assign('backCustom', ''); ?>
                <?php endif; ?>
                <tr id="trRowBody<?php echo $this->_tpl_vars['offset']; ?>
" height='20' class='<?php echo $this->_tpl_vars['_rowColor']; ?>
S1' style="<?php echo $this->_tpl_vars['backCustom']; ?>
">
                    <td width='1%' class="td_alt">&nbsp;<?php echo $this->_tpl_vars['offset']; ?>
&nbsp;</td>
                    <?php if ($this->_tpl_vars['prerow']): ?>
                        <!--<td width='1%' class='nowrap'>
                            <?php if (! $this->_tpl_vars['is_admin'] && is_admin_for_user && $this->_tpl_vars['rowData']['IS_ADMIN'] == 1): ?>
                               <input type='checkbox' disabled="disabled" class='checkbox' value='<?php echo $this->_tpl_vars['rowData']['ID']; ?>
'>
                            <?php else: ?>
                               <!--<input title="<?php echo smarty_function_sugar_translate(array('label' => 'LBL_SELECT_THIS_ROW_TITLE'), $this);?>
" onclick='sListView.check_item(this, document.MassUpdate)' type='checkbox' class='checkbox' name='mass[]' value='<?php echo $this->_tpl_vars['rowData']['ID']; ?>
'>-->
                            <?php endif; ?>
                        <!--</td>-->
                    <?php endif; ?>
                    <?php if (! empty ( $this->_tpl_vars['quickViewLinks'] )): ?>
                        <?php ob_start();  if ($this->_tpl_vars['params']['dynamic_module']):  echo $this->_tpl_vars['rowData'][$this->_tpl_vars['params']['dynamic_module']];  else:  echo $this->_tpl_vars['pageData']['bean']['moduleDir'];  endif;  $this->_smarty_vars['capture']['default'] = ob_get_contents();  $this->assign('linkModule', ob_get_contents());ob_end_clean(); ?>
                        <?php ob_start();  if ($this->_tpl_vars['act']):  echo $this->_tpl_vars['act'];  else: ?>EditView<?php endif;  $this->_smarty_vars['capture']['default'] = ob_get_contents();  $this->assign('action', ob_get_contents());ob_end_clean(); ?>
                        <!--<td width='2%' nowrap>
                            <?php if ($this->_tpl_vars['pageData']['rowAccess'][$this->_tpl_vars['id']]['edit']): ?>
                                <a title='<?php echo $this->_tpl_vars['editLinkString']; ?>
' id="edit-<?php echo $this->_tpl_vars['rowData']['ID']; ?>
"
                                    href="index.php?module=<?php echo $this->_tpl_vars['linkModule']; ?>
&offset=<?php echo $this->_tpl_vars['offset']; ?>
&stamp=<?php echo $this->_tpl_vars['pageData']['stamp']; ?>
&return_module=<?php echo $this->_tpl_vars['linkModule']; ?>
&action=<?php echo $this->_tpl_vars['action']; ?>
&record=<?php echo $this->_tpl_vars['rowData']['ID']; ?>
"
                                >
                                <?php ob_start();  echo smarty_function_sugar_translate(array('label' => 'LNK_EDIT'), $this); $this->_smarty_vars['capture']['tmp1'] = ob_get_contents();  $this->assign('alt_edit', ob_get_contents());ob_end_clean(); ?>
                                <?php echo smarty_function_sugar_getimage(array('name' => "edit_inline.gif",'attr' => 'border="0" ','alt' => ($this->_tpl_vars['alt_edit'])), $this);?>
</a>
                            <?php endif; ?>
                        </td>-->
                    <?php endif; ?>
                    <?php echo smarty_function_counter(array('start' => 0,'name' => 'colCounter','print' => false,'assign' => 'colCounter'), $this);?>

                    <?php $_from = $this->_tpl_vars['displayColumns']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['col'] => $this->_tpl_vars['params']):
?>
                        <?php echo '';  if ($this->_tpl_vars['col'] == 'ID_TIENDA' || $this->_tpl_vars['col'] == 'DO_NOT_CALL'):  echo '';  else:  echo '';  ob_start();  echo '';  $this->_smarty_vars['capture']['default'] = ob_get_contents();  $this->assign('style_c', ob_get_contents());ob_end_clean();  echo '';  if ($this->_tpl_vars['col'] == 'NAME_GESTION' || $this->_tpl_vars['col'] == 'ULTIMA_FECHA_CALLCENTER' || $this->_tpl_vars['col'] == 'PROXIMA_LLAMADA' || $this->_tpl_vars['col'] == 'DESCRIPTION'):  echo '';  ob_start();  echo 'background-color:#CFFCDE';  $this->_smarty_vars['capture']['default'] = ob_get_contents();  $this->assign('style_c', ob_get_contents());ob_end_clean();  echo '';  endif;  echo '<td style="';  echo $this->_tpl_vars['style_c'];  echo '" ';  if ($this->_tpl_vars['scope_row']):  echo ' scope=\'row\' ';  endif;  echo ' align=\'';  echo ((is_array($_tmp=@$this->_tpl_vars['params']['align'])) ? $this->_run_mod_handler('default', true, $_tmp, 'left') : smarty_modifier_default($_tmp, 'left'));  echo '\' valign="top" class="';  if (( $this->_tpl_vars['params']['type'] == 'teamset' )):  echo 'nowrap';  endif;  echo '';  if (preg_match ( '/PHONE/' , $this->_tpl_vars['col'] )):  echo ' phone';  endif;  echo '">';  if ($this->_tpl_vars['col'] == 'NAME' || $this->_tpl_vars['params']['bold']):  echo '<b>';  endif;  echo '';  if ($this->_tpl_vars['params']['link'] && ! $this->_tpl_vars['params']['customCode']):  echo '';  ob_start();  echo '';  if ($this->_tpl_vars['params']['dynamic_module']):  echo '';  echo $this->_tpl_vars['rowData'][$this->_tpl_vars['params']['dynamic_module']];  echo '';  else:  echo '';  echo ((is_array($_tmp=@$this->_tpl_vars['params']['module'])) ? $this->_run_mod_handler('default', true, $_tmp, @$this->_tpl_vars['pageData']['bean']['moduleDir']) : smarty_modifier_default($_tmp, @$this->_tpl_vars['pageData']['bean']['moduleDir']));  echo '';  endif;  echo '';  $this->_smarty_vars['capture']['default'] = ob_get_contents();  $this->assign('linkModule', ob_get_contents());ob_end_clean();  echo '';  ob_start();  echo '';  if ($this->_tpl_vars['act']):  echo '';  echo $this->_tpl_vars['act'];  echo '';  else:  echo 'DetailView';  endif;  echo '';  $this->_smarty_vars['capture']['default'] = ob_get_contents();  $this->assign('action', ob_get_contents());ob_end_clean();  echo '';  ob_start();  echo '';  echo ((is_array($_tmp=@$this->_tpl_vars['rowData'][$this->_tpl_vars['params']['id']])) ? $this->_run_mod_handler('default', true, $_tmp, @$this->_tpl_vars['rowData']['ID']) : smarty_modifier_default($_tmp, @$this->_tpl_vars['rowData']['ID']));  echo '';  $this->_smarty_vars['capture']['default'] = ob_get_contents();  $this->assign('record', ob_get_contents());ob_end_clean();  echo '';  ob_start();  echo 'index.php?module=';  echo $this->_tpl_vars['linkModule'];  echo '&offset=';  echo $this->_tpl_vars['offset'];  echo '&stamp=';  echo $this->_tpl_vars['pageData']['stamp'];  echo '&return_module=';  echo $this->_tpl_vars['linkModule'];  echo '&action=';  echo $this->_tpl_vars['action'];  echo '&record=';  echo $this->_tpl_vars['record'];  echo '';  $this->_smarty_vars['capture']['default'] = ob_get_contents();  $this->assign('url', ob_get_contents());ob_end_clean();  echo '<';  echo ((is_array($_tmp=@$this->_tpl_vars['pageData']['tag'][$this->_tpl_vars['id']][$this->_tpl_vars['params']['ACLTag']])) ? $this->_run_mod_handler('default', true, $_tmp, @$this->_tpl_vars['pageData']['tag'][$this->_tpl_vars['id']]['MAIN']) : smarty_modifier_default($_tmp, @$this->_tpl_vars['pageData']['tag'][$this->_tpl_vars['id']]['MAIN']));  echo ' href="';  echo smarty_function_sugar_ajax_url(array('url' => $this->_tpl_vars['url']), $this); echo '">';  endif;  echo '';  if ($this->_tpl_vars['params']['customCode']):  echo '';  echo smarty_function_sugar_evalcolumn_old(array('var' => $this->_tpl_vars['params']['customCode'],'rowData' => $this->_tpl_vars['rowData']), $this); echo '';  else:  echo '';  if ($this->_tpl_vars['col'] == 'CLIENTE_VIP_C' || $this->_tpl_vars['col'] == 'NAME_TIENDA' || $this->_tpl_vars['col'] == 'ID_TIENDA' || $this->_tpl_vars['col'] == 'PHONE_HOME' || $this->_tpl_vars['col'] == 'PHONE_WORK' || $this->_tpl_vars['col'] == 'NAME_GESTION' || $this->_tpl_vars['col'] == 'ULTIMA_FECHA_CALLCENTER' || $this->_tpl_vars['col'] == 'PROXIMA_LLAMADA' || $this->_tpl_vars['col'] == 'DESCRIPTION' || $this->_tpl_vars['col'] == 'BIRTHDATE'):  echo '';  if ($this->_tpl_vars['col'] == 'BIRTHDATE'):  echo '';  if (((is_array($_tmp=$this->_tpl_vars['rowData']['BIRTHDATE'])) ? $this->_run_mod_handler('substr', true, $_tmp, 5, 2) : substr($_tmp, 5, 2)) == '01'):  echo 'Enero';  endif;  echo '';  if (((is_array($_tmp=$this->_tpl_vars['rowData']['BIRTHDATE'])) ? $this->_run_mod_handler('substr', true, $_tmp, 5, 2) : substr($_tmp, 5, 2)) == '02'):  echo 'Febrero';  endif;  echo '';  if (((is_array($_tmp=$this->_tpl_vars['rowData']['BIRTHDATE'])) ? $this->_run_mod_handler('substr', true, $_tmp, 5, 2) : substr($_tmp, 5, 2)) == '03'):  echo 'Marzo';  endif;  echo '';  if (((is_array($_tmp=$this->_tpl_vars['rowData']['BIRTHDATE'])) ? $this->_run_mod_handler('substr', true, $_tmp, 5, 2) : substr($_tmp, 5, 2)) == '04'):  echo 'Abril';  endif;  echo '';  if (((is_array($_tmp=$this->_tpl_vars['rowData']['BIRTHDATE'])) ? $this->_run_mod_handler('substr', true, $_tmp, 5, 2) : substr($_tmp, 5, 2)) == '05'):  echo 'Mayo';  endif;  echo '';  if (((is_array($_tmp=$this->_tpl_vars['rowData']['BIRTHDATE'])) ? $this->_run_mod_handler('substr', true, $_tmp, 5, 2) : substr($_tmp, 5, 2)) == '06'):  echo 'Junio';  endif;  echo '';  if (((is_array($_tmp=$this->_tpl_vars['rowData']['BIRTHDATE'])) ? $this->_run_mod_handler('substr', true, $_tmp, 5, 2) : substr($_tmp, 5, 2)) == '07'):  echo 'Julio';  endif;  echo '';  if (((is_array($_tmp=$this->_tpl_vars['rowData']['BIRTHDATE'])) ? $this->_run_mod_handler('substr', true, $_tmp, 5, 2) : substr($_tmp, 5, 2)) == '08'):  echo 'Agosto';  endif;  echo '';  if (((is_array($_tmp=$this->_tpl_vars['rowData']['BIRTHDATE'])) ? $this->_run_mod_handler('substr', true, $_tmp, 5, 2) : substr($_tmp, 5, 2)) == '09'):  echo 'Septiembre';  endif;  echo '';  if (((is_array($_tmp=$this->_tpl_vars['rowData']['BIRTHDATE'])) ? $this->_run_mod_handler('substr', true, $_tmp, 5, 2) : substr($_tmp, 5, 2)) == '10'):  echo 'Octubre';  endif;  echo '';  if (((is_array($_tmp=$this->_tpl_vars['rowData']['BIRTHDATE'])) ? $this->_run_mod_handler('substr', true, $_tmp, 5, 2) : substr($_tmp, 5, 2)) == '11'):  echo 'Noviembre';  endif;  echo '';  if (((is_array($_tmp=$this->_tpl_vars['rowData']['BIRTHDATE'])) ? $this->_run_mod_handler('substr', true, $_tmp, 5, 2) : substr($_tmp, 5, 2)) == '12'):  echo 'Diciembre';  endif;  echo '';  echo ' ';  echo '';  echo ((is_array($_tmp=$this->_tpl_vars['rowData']['BIRTHDATE'])) ? $this->_run_mod_handler('substr', true, $_tmp, 8) : substr($_tmp, 8));  echo '';  endif;  echo '';  if ($this->_tpl_vars['col'] == 'CLIENTE_VIP_C'):  echo '';  if ($this->_tpl_vars['rowData'][$this->_tpl_vars['col']] == '1'):  echo 'Si';  endif;  echo '';  endif;  echo '';  if ($this->_tpl_vars['col'] == 'NAME_TIENDA'):  echo '';  ob_start();  echo 'index.php?module=stu_tiendas&offset=';  echo $this->_tpl_vars['offset'];  echo '&stamp=';  echo $this->_tpl_vars['pageData']['stamp'];  echo '&return_module=stu_tiendas&action=';  echo $this->_tpl_vars['action'];  echo '&record=';  echo $this->_tpl_vars['rowData']['ID_TIENDA'];  echo '';  $this->_smarty_vars['capture']['default'] = ob_get_contents();  $this->assign('url_t', ob_get_contents());ob_end_clean();  echo '<';  echo ((is_array($_tmp=@$this->_tpl_vars['pageData']['tag'][$this->_tpl_vars['id']][$this->_tpl_vars['params']['ACLTag']])) ? $this->_run_mod_handler('default', true, $_tmp, @$this->_tpl_vars['pageData']['tag'][$this->_tpl_vars['id']]['MAIN']) : smarty_modifier_default($_tmp, @$this->_tpl_vars['pageData']['tag'][$this->_tpl_vars['id']]['MAIN']));  echo ' href="';  echo smarty_function_sugar_ajax_url(array('url' => $this->_tpl_vars['url_t']), $this); echo '">';  echo $this->_tpl_vars['rowData'][$this->_tpl_vars['col']];  echo '</';  echo ((is_array($_tmp=@$this->_tpl_vars['pageData']['tag'][$this->_tpl_vars['id']][$this->_tpl_vars['params']['ACLTag']])) ? $this->_run_mod_handler('default', true, $_tmp, @$this->_tpl_vars['pageData']['tag'][$this->_tpl_vars['id']]['MAIN']) : smarty_modifier_default($_tmp, @$this->_tpl_vars['pageData']['tag'][$this->_tpl_vars['id']]['MAIN']));  echo '>';  endif;  echo '';  if ($this->_tpl_vars['col'] == 'PHONE_HOME' || $this->_tpl_vars['col'] == 'PHONE_WORK'):  echo '';  if ($this->_tpl_vars['rowData']['DO_NOT_CALL'] == 0):  echo '<a href="javascript:void(0)"onclick="fnShowGestion(\'';  echo $this->_tpl_vars['rowData']['ID'];  echo '\',\'';  echo $this->_tpl_vars['rowData']['FIRST_NAME'];  echo '\',\'';  echo $this->_tpl_vars['rowData']['PHONE_HOME'];  echo '\',\'';  echo $this->_tpl_vars['rowData']['PHONE_MOBILE'];  echo '\',\'';  echo $this->_tpl_vars['rowData']['PHONE_WORK'];  echo '\',\'';  echo $this->_tpl_vars['rowData']['NAME_TIENDA'];  echo '\',\'';  echo $this->_tpl_vars['rowData']['CLIENTE_VIP_C'];  echo '\',\'';  echo $this->_tpl_vars['rowData']['BIRTHDATE'];  echo '\',\'';  echo $this->_tpl_vars['rowData']['ID_TIENDA'];  echo '\',\'';  echo $this->_tpl_vars['rowData']['EMAIL_PRINCIPAL'];  echo '\',\'';  echo $this->_tpl_vars['offset'];  echo '\',\'';  echo $this->_tpl_vars['rowData']['CEDULA_NIT_C'];  echo '\',\'';  echo $this->_tpl_vars['rowData']['FRECUENCIACONTACTO_C'];  echo '\',\'';  echo $this->_tpl_vars['rowData']['TIPOCONTACTO_C'];  echo '\',\'';  echo $this->_tpl_vars['rowData']['TIPOINFORMACION_C'];  echo '\',\'';  echo $this->_tpl_vars['rowData']['TIPOINFORMACIONSM_C'];  echo '\');">';  echo smarty_function_sugar_field(array('parentFieldArray' => $this->_tpl_vars['rowData'],'vardef' => $this->_tpl_vars['params'],'displayType' => 'ListView','field' => $this->_tpl_vars['col']), $this); echo '<img src="themes/default/images/icon_AdminMobile.gif" title="Generar Gestion"></a>';  else:  echo '';  echo smarty_function_sugar_field(array('parentFieldArray' => $this->_tpl_vars['rowData'],'vardef' => $this->_tpl_vars['params'],'displayType' => 'ListView','field' => $this->_tpl_vars['col']), $this); echo '<img src="themes/default/images/decline_inline.gif" title="Contacto que solicito ser excluido de toda comunicacion" />';  endif;  echo '';  endif;  echo '';  if ($this->_tpl_vars['col'] == 'NAME_GESTION' || $this->_tpl_vars['col'] == 'ULTIMA_FECHA_CALLCENTER' || $this->_tpl_vars['col'] == 'PROXIMA_LLAMADA' || $this->_tpl_vars['col'] == 'DESCRIPTION'):  echo '';  if ($this->_tpl_vars['col'] == 'ULTIMA_FECHA_CALLCENTER'):  echo '<a href="javascript:void(0)" onclick=\'fnShowHistorialGestion("';  echo $this->_tpl_vars['rowData']['ID'];  echo '");\'>';  echo smarty_function_sugar_field(array('parentFieldArray' => $this->_tpl_vars['rowData'],'vardef' => $this->_tpl_vars['params'],'displayType' => 'ListView','field' => $this->_tpl_vars['col']), $this); echo '</a>';  else:  echo '';  echo smarty_function_sugar_field(array('parentFieldArray' => $this->_tpl_vars['rowData'],'vardef' => $this->_tpl_vars['params'],'displayType' => 'ListView','field' => $this->_tpl_vars['col']), $this); echo '';  endif;  echo '';  endif;  echo '';  else:  echo '';  echo smarty_function_sugar_field(array('parentFieldArray' => $this->_tpl_vars['rowData'],'vardef' => $this->_tpl_vars['params'],'displayType' => 'ListView','field' => $this->_tpl_vars['col']), $this); echo '';  endif;  echo '';  endif;  echo '';  if (empty ( $this->_tpl_vars['rowData'][$this->_tpl_vars['col']] ) && empty ( $this->_tpl_vars['params']['customCode'] )):  echo '&nbsp;';  endif;  echo '';  if ($this->_tpl_vars['params']['link'] && ! $this->_tpl_vars['params']['customCode']):  echo '</';  echo ((is_array($_tmp=@$this->_tpl_vars['pageData']['tag'][$this->_tpl_vars['id']][$this->_tpl_vars['params']['ACLTag']])) ? $this->_run_mod_handler('default', true, $_tmp, @$this->_tpl_vars['pageData']['tag'][$this->_tpl_vars['id']]['MAIN']) : smarty_modifier_default($_tmp, @$this->_tpl_vars['pageData']['tag'][$this->_tpl_vars['id']]['MAIN']));  echo '>';  endif;  echo '';  if ($this->_tpl_vars['col'] == 'NAME' || $this->_tpl_vars['params']['bold']):  echo '</b>';  endif;  echo '</td>';  endif;  echo ''; ?>

	                <?php $this->assign('scope_row', false); ?>
					<?php echo smarty_function_counter(array('name' => 'colCounter'), $this);?>

				<?php endforeach; endif; unset($_from); ?>
				<td align='right'><?php echo $this->_tpl_vars['pageData']['additionalDetails'][$this->_tpl_vars['id']]; ?>
</td>
		    	</tr>
		<?php endforeach; else: ?>
		<tr height='20' class='<?php echo $this->_tpl_vars['rowColor'][0]; ?>
S1'>
		    <td colspan="<?php echo $this->_tpl_vars['colCount']; ?>
">
		        <em><?php echo $this->_tpl_vars['APP']['LBL_NO_DATA']; ?>
</em>
		    </td>
		</tr> 
		<?php endif; unset($_from); ?>
    <?php $this->assign('link_select_id', 'selectLinkBottom'); ?>
    <?php $this->assign('link_action_id', 'actionLinkBottom'); ?>
    <?php $this->assign('selectLink', $this->_tpl_vars['selectLinkBottom']); ?>
    <?php $this->assign('actionsLink', $this->_tpl_vars['actionsLinkBottom']); ?>
    <?php $this->assign('action_menu_location', 'bottom'); ?>
    <?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => 'include/ListView/ListViewPagination.tpl', 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
	</table>
<?php endif;  if ($this->_tpl_vars['contextMenus']): ?>
<script type="text/javascript">
<?php echo $this->_tpl_vars['contextMenuScript']; ?>

<?php echo '
function lvg_nav(m,id,act,offset,t){
    if(t.href.search(/#/) < 0){return;}
    else{
        if(act==\'pte\'){
            act=\'ProjectTemplatesEditView\';
        }
        else if(act==\'d\'){
            act=\'DetailView\';
        }else if( act ==\'ReportsWizard\'){
            act = \'ReportsWizard\';
        }else{
            act=\'EditView\';
        }
    '; ?>

        url = 'index.php?module='+m+'&offset=' + offset + '&stamp=<?php echo $this->_tpl_vars['pageData']['stamp']; ?>
&return_module='+m+'&action='+act+'&record='+id;
        t.href=url;
    <?php echo '
    }
}'; ?>

<?php echo '
    function lvg_dtails(id){'; ?>

        return SUGAR.util.getAdditionalDetails( '<?php echo ((is_array($_tmp=@$this->_tpl_vars['pageData']['bean']['moduleDir'])) ? $this->_run_mod_handler('default', true, $_tmp, @$this->_tpl_vars['params']['module']) : smarty_modifier_default($_tmp, @$this->_tpl_vars['params']['module'])); ?>
',id, 'adspan_'+id);<?php echo '}'; ?>

</script>
<?php endif; ?>
    <div id='reportecontactos' title='reportecontactos'>
        <div id="mostrardatos">
            
        </div>
    </div>


    <div id="divOculto" style="display:none;">
        
        <div id="divGestionCallcenter" title="Gestion de callcenter">
            <div id="divPreloadGestionCallcenter" style="color:red;font-family:verdana;"></div>
            <div id="divBodyGestionCallcenter">
                <div id="divPreFormGestionCallcenter">
                    <form id="frmGestionCallcenter" method="post" action="">
                        <input type="hidden" id="hdnoffset" name="hdnoffset"/>
                        <input type="hidden" id="hdnidcontacto" name="hdnidcontacto" />
                        <table style="width:100%;">
                            <tr>
                                <td>
                                    <fieldset >
                                        <legend>Datos Contacto</legend>
                                        <!-- Table que contiene el fieldset de la fila superior-->
                                        <table style="width:100%;">
                                            <tr>
                                                <td> 
                            <table width="100%" border="1" cellspacing="0" cellpadding="0">
  <tr>
    <td width="48%"><!-- Subtabla columna izquierda -->
                                                    <table>
                                                      <tr>
                                                        <td colspan="3"><img src="themes/default/images/_blank.png" width="10" height="10"></td>
                                                      </tr>
                                                       <tr>
                                                           <td width="111" align="right">
                                                                <span><b>Contacto:</b></span></td>
                                                           <td width="6">
                                                                <label id="spnFirstName">&nbsp;</label>
                                                                <input  type="text" id="txtFirstName" name="txtFirstName" style="display:none;"/></td>
                                                           <td width="85"><a style ="float: rigth;"href="javascript:void(0)" onClick="fnEditInlineField();"><img src="themes/default/images/edit_inline.gif" title="Actualizar datos"/></a></td>
                                                       </tr>
                                                       <tr>
                                                         <td colspan="3"><img src="themes/default/images/_blank.png" width="10" height="10"></td>
                                                       </tr>
                                                       <tr>
                                                            <td align="right">
                                                                <span><b>Casa:</b></span></td>
                                                            <td>
                                                                <label id="spnTelCasa">&nbsp;</label>
                                                                <input  type="text" id="txtTelCasa" name="txtTelCasa" style="display:none;"/></td>
                                                            <td><a href="javascript:void(0)" onClick="fnEditInlineField();"><img src="themes/default/images/edit_inline.gif" title="Actualizar datos"/></a></td>
                                                       </tr>
                                                       <tr>
                                                         <td colspan="3"><img src="themes/default/images/_blank.png" width="10" height="10"></td>
                                                       </tr>
                                                       <tr>
                                                           <td align="right">
                                                                <span><b>Whatsapp:</b></span></td>
                                                           <td>
                                                                <label id="spnTelCelu">&nbsp;</label>
                                                                <input  type="text" id="txtTelCelu" name="txtTelCelu" style="display:none;"/></td>
                                                           <td><a href="javascript:void(0)" onClick="fnEditInlineField();"><img src="themes/default/images/edit_inline.gif" title="Actualizar datos"/></a></td>
                                                       </tr>
                                                       <tr>
                                                         <td colspan="3"><img src="themes/default/images/_blank.png" width="10" height="10"></td>
                                                       </tr>
                                                       <tr>
                                                            <td align="right"><b>Tel 2:</b>
                                                         </td>
                                                            <td>
                                                                <label id="spnTelTrabajo">&nbsp;</label>
                                                                <input  type="text" id="txtTelTrabajo" name="txtTelTrabajo" style="display:none;"/></td>
                                                            <td><a href="javascript:void(0)" onClick="fnEditInlineField();"><img src="themes/default/images/edit_inline.gif" title="Actualizar datos"/></a></td>
                                                       </tr>
                                                       <tr>
                                                         <td colspan="3"><img src="themes/default/images/_blank.png" width="10" height="10"></td>
                                                       </tr>
                                                       <tr>
                                                         <td>&nbsp;</td>
                                                         <td>&nbsp;</td>
                                                         <td>&nbsp;</td>
                                                       </tr>  
                                                    </table></td>
    <td>&nbsp;</td>
    <td width="48%" align="left"><!-- Subtabla columna izquierda -->
                                                    <table>
                                                      <tr>
                                                        <td colspan="3"><img src="themes/default/images/_blank.png" width="10" height="10"></td>
                                                      </tr>
                                                        <tr>
                                                            <td align="right"><b>Tienda:</b></td>
                                                            <td>
                                                                <label id="spnTienda">&nbsp;</label>
                                                                <select id="selTienda" name="selTienda" style="display:none;">
                                                                    <option value="">Selecione...</option>
                                                                    <?php $_from = $this->_tpl_vars['dataListStuTiendas']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['colHeader'] => $this->_tpl_vars['params']):
?>
                                                                        <option value="<?php echo $this->_tpl_vars['params']['id']; ?>
"><?php echo $this->_tpl_vars['params']['name']; ?>
</option>
                                                                    <?php endforeach; endif; unset($_from); ?>
                                                                </select></td>
                                                            <td><a href="javascript:void(0)" onClick="fnEditInlineField();"><img src="themes/default/images/edit_inline.gif" title="Actualizar datos"/></a></td>
                                                        </tr>
                                                        <tr>
                                                          <td colspan="3"><img src="themes/default/images/_blank.png" width="10" height="10"></td>
                                                        </tr>
                                                        <tr>
                                                            <td align="right"><b>Cedula:</b></td>
                                                            <td>
                                                                <label id="spnCedula">&nbsp;</label>
                                                                <input  type="text" id="txtCedula" name="txtCedula" style="display:none;"/></td>
                                                            <td><a href="javascript:void(0)" onClick="fnEditInlineField();"><img src="themes/default/images/edit_inline.gif" title="Actualizar datos"/></a></td>
                                                        </tr>
                                                        <tr>
                                                          <td colspan="3"><img src="themes/default/images/_blank.png" width="10" height="10"></td>
                                                        </tr>
                                                        <tr>
                                                            <td align="right"><b>VIP:</b></td>
                                                            <td>
                                                                <label id="spnVip">&nbsp;</label>
                                                                <select id="selVip" name="selVip" style="display:none;">
                                                                    <option value="0">No</option>
                                                                    <option value="1">Si</option>
                                                                </select></td>
                                                            <td><a href="javascript:void(0)" onClick="fnEditInlineField();"><img src="themes/default/images/edit_inline.gif" title="Actualizar datos"/></a></td>
                                                        </tr>
                                                        <tr>
                                                          <td colspan="3"><img src="themes/default/images/_blank.png" width="10" height="10"></td>
                                                        </tr>
                                                        <tr>
                                                            <td align="right"><b>Cumplea&ntilde;os:</b></td>
                                                            <td>
                                                                <label id="spnCumples">&nbsp;</label>
                                                                <span id="divCumples" style="display:none;">
                                                                <select id="selMesCumples" name="selMesCumples">
                                                                    <option value="">...</option>
                                                                    <option value="1">Enero</option>
                                                                    <option value="2">Febrero</option>
                                                                    <option value="3">Marzo</option>
                                                                    <option value="4">Abril</option>
                                                                    <option value="5">Mayo</option>
                                                                    <option value="6">Junio</option>
                                                                    <option value="7">Julio</option>
                                                                    <option value="8">Agosto</option>
                                                                    <option value="9">Septiembre</option>
                                                                    <option value="10">Octubre</option>
                                                                    <option value="11">Noviembre</option>
                                                                    <option value="12">Diciembre</option>
                                                                </select>
                                                                <select id="selDiaCumples" name="selDiaCumples">
                                                                    <option value="">...</option>
                                                                    <option value="1">1</option><option value="2">2</option>
                                                                    <option value="3">3</option><option value="4">4</option>
                                                                    <option value="5">5</option><option value="6">6</option>
                                                                    <option value="7">7</option><option value="8">8</option>
                                                                    <option value="9">9</option><option value="10">10</option>
                                                                    <option value="11">11</option><option value="12">12</option>
                                                                    <option value="13">13</option><option value="14">14</option>
                                                                    <option value="15">15</option><option value="16">16</option>
                                                                    <option value="17">17</option><option value="18">18</option>
                                                                    <option value="19">19</option><option value="20">20</option>
                                                                    <option value="21">21</option><option value="22">22</option>
                                                                    <option value="23">23</option><option value="24">24</option>
                                                                    <option value="25">25</option><option value="26">26</option>
                                                                    <option value="27">27</option><option value="28">28</option>
                                                                    <option value="29">29</option><option value="30">30</option>
                                                                    <option value="31">31</option>
                                                                </select>
                                                                </span></td>
                                                            <td><a href="javascript:void(0)" onClick="fnEditInlineField();"><img src="themes/default/images/edit_inline.gif" title="Actualizar datos"/></a></td>
                                                        </tr>
                                                        <tr>
                                                          <td colspan="3"><img src="themes/default/images/_blank.png" width="10" height="10"></td>
                                                        </tr>
                                                        <tr>
                                                            <td align="right"><b>Email:</b></td>
                                                            <td>
                                                                <label id="spnEmailP">&nbsp;</label>
                                                                <input  type="text" id="txtEmailP" name="txtEmailP" style="display:none;"/></td>
                                                            <td><a href="javascript:void(0)" onClick="fnEditInlineField();"><img src="themes/default/images/edit_inline.gif" title="Actualizar datos"/></a></td>
                                                        </tr>
                                                        <tr>
                                                          <td colspan="3"><img src="themes/default/images/_blank.png" width="10" height="10"></td>
                                                        </tr>
                  </table></td>
  </tr>
</table>
                        
                                                
                                                    
                                                </td>    
                                            </tr>
                                        </table>
                                    </fieldset>
                                </td>
                                <td valign="top">
                                  <fieldset >
                                    <legend>Envio Campañas</legend>
                                      <table>
                                          <tr>
                                              <td align="right"><b>Frecuencia</b></td>
                                                <td>
                                                  <label id="spnFrecuenciaContacto">&nbsp;</label>
                                                  <select id="selFrecuenciaContacto" name="selFrecuenciaContacto" style="display:none;">
                                                      <option value=""></option>
                                                      <option value="Semanal">Semanal</option>
                                                      <option value="Quincenal">Quincenal</option>
                                                      <option value="Mensual">Mensual</option>
                                                  </select></td>
                                                <td><a href="javascript:void(0)" onClick="fnEditInlineField();"><img src="themes/default/images/edit_inline.gif" title="Actualizar datos"/></a></td>
                                          </tr>
                                          <tr>
                                            <td colspan="3"><img src="themes/default/images/_blank.png" width="10" height="10"></td>
                                          </tr>
                                          <tr>
                                              <td align="right"><b>Tipo de contacto</b></td>
                                                <td>
                                                  <label id="spnTipoContacto">&nbsp;</label>
                                                  <select id="selTipoContacto" name="selTipoContacto" style="display:none;">
                                                      <option value=""></option>
                                                      <option value="Mail">Mail</option>
                                                      <option value="Redes_Sociales">Redes Sociales</option>
                                                      <option value="Telefono">Teléfono</option>
                                                      <option value="Whatsapp">Whatsapp</option>
                                                      <option value="Todas">Todas</option>
                                                  </select>
                                                  <!--<span><b>Seleccione el tipo de Informaci&oacute;n</b></span>
                                                    <label id="spnTipoInformacionNormal">&nbsp;</label>
                                                 
                                                    <select id="selTipoInformacionNormal"  name="selTipoInformacionNormal"   style="display:none;">
                                                        <option value=""></option>
                                                        <option value="Beneficios">Beneficios</option>
                                                        <option value="Colecciones">Colecciones</option>
                                                        <option value="Promociones">Promociones</option>
                                                        <option value="Todas">Todas</option>
                                                    </select>
                                                    <a href="javascript:void(0)" onclick="fnEditInlineField();">
                                                        <img src="themes/default/images/edit_inline.gif" title="Actualizar datos"/>
                                                    </a></br>-->    
                                              </td>
                                                <td><a href="javascript:void(0)" onClick="fnEditInlineField();"><img src="themes/default/images/edit_inline.gif" title="Actualizar datos"/></a></td>
                                          </tr>
                                          <tr>
                                            <td colspan="3"><img src="themes/default/images/_blank.png" width="10" height="10"></td>
                                          </tr>
                                          <tr>
                                              <td align="right"><b>Tipo de Info.</b></td>
                                                <td>
                                                  <label id="spnTipoInformacionMultiple">&nbsp;</label>
                                                  <!--
                                                    se cambia el select selTipoInformacion  de un select normal a un select 
                                                    multiple 
                                                    -->

                                                  <select id="selTipoInformacionMultiple"  name="selTipoInformacionMultiple[]"  multiple="multiple" style="display:none;">
                                                      <option value=""></option>
                                                      <option value="Beneficios">Beneficios</option>
                                                      <option value="Colecciones">Colecciones</option>
                                                      <option value="Promociones">Promociones</option>
                                                      <option value="Todas">Todas</option>
                                                  </select></td>
                                                <td><a href="javascript:void(0)" onClick="fnEditInlineField();"><img src="themes/default/images/edit_inline.gif" title="Actualizar datos"/></a></td>
                                          </tr>
                                      </table>
                                        
                                        
                                    </fieldset>    
                                </td>
                            </tr>
                            </table>
                            
                            <!-- Se separaron la dos columnas de informacion con los datos del contacto en la parte superior  -->

                            <table>
                            <tr>
                                <th width="10%" valign="top">
                                    <fieldset>
                                        <legend>Evento</legend>
                                        <div>
                                            <table style="width:100%;">
                                                <tr>
                                                    <td>
                                                        <span>Opciones:</span>
                                                    </td>
                                                    <td>
                                                        <select id="selOpciones" name="selOpciones">
                                                            <option value="">Seleccione...</option>
                                                            <?php $_from = $this->_tpl_vars['dataListOpcRespuestas']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['colHeader'] => $this->_tpl_vars['params']):
?>
                                                                <?php if ($this->_tpl_vars['params']['id'] == '41dcbc2e-8af7-6a7e-7eed-55eeebb32f18'): ?>
                                                                    <option style='background-color:#F9DDDD;' value="<?php echo $this->_tpl_vars['params']['id']; ?>
"><?php echo $this->_tpl_vars['params']['name']; ?>
</option>
                                                                <?php else: ?>
                                                                    <option value="<?php echo $this->_tpl_vars['params']['id']; ?>
"><?php echo $this->_tpl_vars['params']['name']; ?>
</option>
                                                                <?php endif; ?>
                                                            <?php endforeach; endif; unset($_from); ?>
                                                        </select>
                                                    </td>
                                                </tr>
                                                <tr id="trProximaLlamada" style="display:none;">
                                                    <td>Proxima llamada</td>
                                                    <td>
                                                        <input id="txtFechaProximaLlamada" name="txtFechaProximaLlamada" type="text" size="15" readonly="readonly" />
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <span>Descripci&oacute;n:</span>
                                                    </td>
                                                    <td>
                                                        <textarea id="tarDescripcion" name="tarDescripcion"></textarea>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <span>Se hablo con:</span>
                                                    </td>
                                                    <td>
                                                        <input type="text" id="txtSeHabloCon" name="txtSeHabloCon"/>
                                                    </td>
                                                </tr>
                                            </table>
                                        </div>
                                        <div>
                                            <input type="button" id="bttnSubmit" value="Guardar Gestion"/>
                                        </div>
                                    </fieldset>
                                </th>
                                <th width="90%" valign="top">
                                    <fieldset>
                                        <legend>Historial Compras</legend>
                                        <div id="divTabsCat">
                                            <ul>
                                                <li><a href="#tabC1">Compras</a></li>
                                                <li><a href="#tabC2">Callcenter</a></li>
                                            </ul>
                                            <div id="tabC1">
                                                <div id="divTabsCompras">
                                                    <ul id="ulDivTabsCompras">
                                                        <img src="themes/default/images/ui-anim_basic_16x16.gif"/>
                                                        <br/>
                                                        Cargando informaci&oacute;n...
                                                    </ul>
                                                </div>
                                            </div>
                                            <div id="tabC2">
                                                <img src="themes/default/images/ui-anim_basic_16x16.gif"/>
                                                <br/>
                                                Cargando informaci&oacute;n...
                                            </div>
                                        </div>
                                    </fieldset>
                                </th>
                            </tr>
                        </table>
                    </form>
                </div>
                <div>
                    
                </div>
            </div>
        </div>
        
        <select id="selStuTiendas_hidden">
            <option value="">TODAS</option>
            <?php $_from = $this->_tpl_vars['dataListStuTiendas']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['colHeader'] => $this->_tpl_vars['params']):
?>
                <option value="<?php echo $this->_tpl_vars['params']['id']; ?>
"><?php echo $this->_tpl_vars['params']['name']; ?>
</option>
            <?php endforeach; endif; unset($_from); ?>
        </select>
        



        
        <div id='divHistorialGestion' title='Historial gestion'>
            <div id="divPreloadHistorialGestion" style="color:red;font-family:verdana;"></div>
            <div id="divBodyHistorialGestion"></div>
        </div>

        
        
        <div id='divHistorialReporteCallcenter' title='Reporte Callcenter'>
            <ul>
                <li><a href='#divReport1'>Llamadas/Tienda</a></li>
                <li><a href='#divReport2'>Llamadas/Operador</a></li>
                <li><a href='#divReport3'>Clientes</a></li>
                <!--
                    agregado por:darwin rosero 
                    se agrege este link para que llame a la nueva pesteña
                    
                -->
                <!--<li><a href='#divReport4'>Campañas</a></li>
                <li><a href='#divReport5'>Reportes</a></li>-->
            </ul>
            <div id='divReport1'>
                <div id="divPreloadReport1" style="color:red;font-family:verdana;"></div>
                <div>
                    <input type='text' id='txtFechaDesdeReport1' size='10' readonly="readonly" value='<?php echo ((is_array($_tmp=time())) ? $this->_run_mod_handler('date_format', true, $_tmp, "%Y-%m-%d") : smarty_modifier_date_format($_tmp, "%Y-%m-%d")); ?>
'/>
                    <input type='text' id='txtFechaHastaReport1' size='10' readonly="readonly" value='<?php echo ((is_array($_tmp=time())) ? $this->_run_mod_handler('date_format', true, $_tmp, "%Y-%m-%d") : smarty_modifier_date_format($_tmp, "%Y-%m-%d")); ?>
'/>
                    <input type='button' id='bttnReport1' value='Buscar' />
                    <div id='divExport_1' style='float:right;'>
                        <a href='javascript:void(0)' onclick='fnExportDoc("pdf",1)'><img src="themes/default/images/pdf_image_inline.gif" title='Exportar a pdf'></a>
                        <a href='javascript:void(0)' onclick='fnExportDoc("xlsx",1)'><img src="themes/default/images/xls_image_inline.gif" title='Exportar a xlsx'></a>
                    </div>
                </div>
                <div id="divBodyReport1">
                </div>
            </div>
            <div id='divReport2'>
                <div id="divPreloadReport2" style="color:red;font-family:verdana;"></div>
                <div>
                    <input type='text' id='txtFechaDesdeReport2' size='10' readonly="readonly" value='<?php echo ((is_array($_tmp=time())) ? $this->_run_mod_handler('date_format', true, $_tmp, "%Y-%m-%d") : smarty_modifier_date_format($_tmp, "%Y-%m-%d")); ?>
'/>
                    <input type='text' id='txtFechaHastaReport2' size='10' readonly="readonly" value='<?php echo ((is_array($_tmp=time())) ? $this->_run_mod_handler('date_format', true, $_tmp, "%Y-%m-%d") : smarty_modifier_date_format($_tmp, "%Y-%m-%d")); ?>
'/>
                    <input type='button' id='bttnReport2' value='Buscar' />
                    <div id='divExport_2' style='float:right;'>
                        <a href='javascript:void(0)' onclick='fnExportDoc("pdf",2)'><img src="themes/default/images/pdf_image_inline.gif" title='Exportar a pdf'></a>
                        <a href='javascript:void(0)' onclick='fnExportDoc("xlsx",2)'><img src="themes/default/images/xls_image_inline.gif" title='Exportar a xlsx'></a>
                    </div>
                </div>
                <div id="divBodyReport2">
                </div>
            </div>
            <div id='divReport3'>
                <div id="divPreloadReport3" style="color:red;font-family:verdana;"></div>
                <div>
                    <input type='text' id='txtFechaDesdeReport3' size='10' readonly="readonly" value='<?php echo ((is_array($_tmp=time())) ? $this->_run_mod_handler('date_format', true, $_tmp, "%Y-%m-%d") : smarty_modifier_date_format($_tmp, "%Y-%m-%d")); ?>
'/>
                    <input type='text' id='txtFechaHastaReport3' size='10' readonly="readonly" value='<?php echo ((is_array($_tmp=time())) ? $this->_run_mod_handler('date_format', true, $_tmp, "%Y-%m-%d") : smarty_modifier_date_format($_tmp, "%Y-%m-%d")); ?>
'/>
                    <input type='button' id='bttnReport3' value='Buscar' />
                    <div id='divExport_3' style='float:right;'>
                        <a href='javascript:void(0)' onclick='fnExportDoc("pdf",3)'><img src="themes/default/images/pdf_image_inline.gif" title='Exportar a pdf'></a>
                        <a href='javascript:void(0)' onclick='fnExportDoc("xlsx",3)'><img src="themes/default/images/xls_image_inline.gif" title='Exportar a xlsx'></a>
                    </div>
                </div>
                <div id="divBodyReport3">
                </div>
            </div>

            <!-- agregado por:darwin rosero se agrega este div para la nueva pestaña  -->
 <!-- apago     <div id='divReport4'>
            
                <div id="divPreloadReport4" style="color:red;font-family:verdana;"></div>
                <div>
                    <input type='text' id='txtFechaDesdeReport4' size='10' readonly="readonly" value='<?php echo ((is_array($_tmp=time())) ? $this->_run_mod_handler('date_format', true, $_tmp, "%Y-%m-%d") : smarty_modifier_date_format($_tmp, "%Y-%m-%d")); ?>
'/>
                    <input type='text' id='txtFechaHastaReport4' size='10' readonly="readonly" value='<?php echo ((is_array($_tmp=time())) ? $this->_run_mod_handler('date_format', true, $_tmp, "%Y-%m-%d") : smarty_modifier_date_format($_tmp, "%Y-%m-%d")); ?>
'/>
                    

                    

                    tipo:

                    <select id="selTipoContacto1" name="selTipoContacto1" >
                                        <option value=""></option>
                                        <option value="Mail">Mail</option>
                                        <option value="Redes_Sociales">Redes Sociales</option>
                                        <option value="Telefono">Teléfono</option>
                                        <option value="Whatsapp">Whatsapp</option>
                                        <option value="Todas">Todas</option>
                   </select>

                    periodo:
                    <select id="selFrecuencia" name="selFrecuencia" >
                                        <option value=""></option>
                                        <option value="Semanal">Semanal</option>
                                        <option value="Quincenal">Quincenal</option>
                                        <option value="Mensual">Mensual</option>
                    </select>


                    informacion:
                    <select id="selTipoInformacion"  name="selTipoInformacion">
                                        <option value=""></option>
                                        <option value="Beneficios">Beneficios</option>
                                        <option value="Colecciones">Colecciones</option>
                                        <option value="Promociones">Promociones</option>
                                        <option value="Todas">Todas</option>
                    </select>

                

                    <input type='button' id='bttnReport4' value='Buscar' />
                    <div id='divExport_4' style='float:right;'>
                        <a href='javascript:void(0)' onclick='fnExportDoc("pdf",4)'><img src="themes/default/images/pdf_image_inline.gif" title='Exportar a pdf'></a>
                        <a href='javascript:void(0)' onclick='fnExportDoc("xlsx",4)'><img src="themes/default/images/xls_image_inline.gif" title='Exportar a xlsx'></a>
                    </div>
                </div>
                <div id="divBodyReport4">
                </div>
            </div>  termino apagado reporte 4    -->
            <!--                agregado por:darwin rosero 
              se agrega este div para la nueva pestaña  -->
<!-- apago rep5             <div id='divReport5'>
            
                <div id="divPreloadReport5" style="color:red;font-family:verdana;"></div>
                    
                    <!--<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => 'modules/cont_centro_llamadas/tpl/mostrarContactos.tpl', 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
                    -->
                <div id="divBodyReport5">
                </div>
            </div>

        </div>
    </div> termino apagado rep5 -->
    
<script type='text/javascript' src='<?php echo smarty_function_sugar_getjspath(array('file' => 'include/javascript/jquery/grid/js/jquery.ui.datepicker.js'), $this);?>
'></script>
<script type='text/javascript' src='<?php echo smarty_function_sugar_getjspath(array('file' => 'include/javascript/jquery/grid/js/jquery.ui.slider.js'), $this);?>
'></script>    
<script type='text/javascript' src='<?php echo smarty_function_sugar_getjspath(array('file' => 'include/javascript/jquery/jquery-ui-timepicker-addon.js'), $this);?>
'></script>
<script type='text/javascript' src='<?php echo smarty_function_sugar_getjspath(array('file' => 'include/javascript/jquery/i18n/jquery-ui-timepicker-es.js'), $this);?>
'></script>
<link type="text/css" href='<?php echo smarty_function_sugar_getjspath(array('file' => 'include/javascript/jquery/jquery-ui-timepicker-addon.css'), $this);?>
' rel="stylesheet" />
<script>
    <?php echo '
    $(document).ready(function(){
        $(\'#divHistorialReporteCallcenter\').tabs();
        var myParam = location.search.split(\'offset=\')[1];
        
        if(myParam!=undefined){
            $(\'#trRowBody\'+myParam).addClass(\'class_bck\');
            $(\'#trRowBody\'+myParam).prop(\'style\',\'background-color:#FBFBC0\');

            var target = this.hash;
            var $target = $(\'#trRowBody\'+myParam);
            $(\'html, body\').stop().animate({
                \'scrollTop\': $target.offset().top
            }, 900, \'swing\', function () {
                //window.location.hash = target;
            });
        }
        
        $("#txtFechaDesdeReport1").datepicker({
            buttonImage: "themes/default/images/Calendar.gif",
            buttonImageOnly: true,
            showOn: \'button\',
            dateFormat: \'yy-mm-dd\',
            changeYear: true,
            changeMonth: true,
            maxDate: \'0D\',
            onClose: function (selectedDate) {
                $("#txtFechaHastaReport1").datepicker("option", "minDate", selectedDate);
            }
        });
        
        
        $("#txtFechaHastaReport1").datepicker({
            buttonImage: "themes/default/images/Calendar.gif",
            buttonImageOnly: true,
            showOn: \'button\',
            dateFormat: \'yy-mm-dd\',
            changeYear: true,
            changeMonth: true,
            maxDate: \'0D\',
            onClose: function (selectedDate) {
                $("#txtFechaDesdeReport1").datepicker("option", "maxDate", selectedDate);
            }
        });
        $("#txtFechaDesdeReport2").datepicker({
            buttonImage: "themes/default/images/Calendar.gif",
            buttonImageOnly: true,
            showOn: \'button\',
            dateFormat: \'yy-mm-dd\',
            changeYear: true,
            changeMonth: true,
            maxDate: \'0D\',
            onClose: function (selectedDate) {
                $("#txtFechaHastaReport2").datepicker("option", "minDate", selectedDate);
            }
        });

        $("#txtFechaHastaReport2").datepicker({
            buttonImage: "themes/default/images/Calendar.gif",
            buttonImageOnly: true,
            showOn: \'button\',
            dateFormat: \'yy-mm-dd\',
            changeYear: true,
            changeMonth: true,
            maxDate: \'0D\',
            onClose: function (selectedDate) {
                $("#txtFechaDesdeReport2").datepicker("option", "maxDate", selectedDate);
            }
        });
        $("#txtFechaDesdeReport3").datepicker({
            buttonImage: "themes/default/images/Calendar.gif",
            buttonImageOnly: true,
            showOn: \'button\',
            dateFormat: \'yy-mm-dd\',
            changeYear: true,
            changeMonth: true,
            maxDate: \'0D\',
            onClose: function (selectedDate) {
                $("#txtFechaHastaReport3").datepicker("option", "minDate", selectedDate);
            }
        });

        $("#txtFechaHastaReport3").datepicker({
            buttonImage: "themes/default/images/Calendar.gif",
            buttonImageOnly: true,
            showOn: \'button\',
            dateFormat: \'yy-mm-dd\',
            changeYear: true,
            changeMonth: true,
            maxDate: \'0D\',
            onClose: function (selectedDate) {
                $("#txtFechaDesdeReport3").datepicker("option", "maxDate", selectedDate);
            }
        });
        
       $("#txtFechaDesdeReport4").datepicker({
            buttonImage: "themes/default/images/Calendar.gif",
            buttonImageOnly: true,
            showOn: \'button\',
            dateFormat: \'yy-mm-dd\',
            changeYear: true,
            changeMonth: true,
            maxDate: \'0D\',
            onClose: function (selectedDate) {
                $("#txtFechaHastaReport4").datepicker("option", "minDate", selectedDate);
            }
        });

        $("#txtFechaHastaReport4").datepicker({
            buttonImage: "themes/default/images/Calendar.gif",
            buttonImageOnly: true,
            showOn: \'button\',
            dateFormat: \'yy-mm-dd\',
            changeYear: true,
            changeMonth: true,
            maxDate: \'0D\',
            onClose: function (selectedDate) {
                $("#txtFechaDesdeReport4").datepicker("option", "maxDate", selectedDate);
            }
        });


        
        $("#divGestionCallcenter").dialog({
            autoOpen: false,
            modal: true,
            draggable: true,
            resizable:true,
            width:\'900\',
            buttons:{
                "Cerrar":function(){
                    $(this).dialog(\'close\');
                    // set background row
                    $(\'.class_bck\').each(function(){
                        $(this).removeClass(\'class_bck\')
                        $(this).prop(\'style\',\'\')
                    });
                }
            },
            close:function(){
                // set background row
                $(\'.class_bck\').each(function(){
                    $(this).removeClass(\'class_bck\')
                    $(this).prop(\'style\',\'\')
                });
            },
            position: \'top\'
        });
        $("#divHistorialGestion").dialog({
            autoOpen: false,
            modal: true,
            draggable: true,
            resizable:true,
            width:\'600\',
            buttons:{
                "Cerrar":function(){
                    $(this).dialog(\'close\');
                }
            },
            position: \'top\'
        });
        $("#divHistorialReporteCallcenter").dialog({
            autoOpen: false,
            modal: true,
            draggable: true,
            resizable:true,
            width:\'1200\',
            buttons:{
                "Cerrar":function(){
                    $(this).dialog(\'close\');
                }
            },
            position: \'top\'
        });

        $("#reportecontactos").dialog({
            autoOpen: false,
            modal: true,
            draggable: true,
            resizable:true,
            width:\'900\',
            buttons:{
                "Cerrar":function(){
                    $(this).dialog(\'close\');
                }
            },
            position: \'top\'
        });


        //set form
        $(\'#divPreFormGestionCallcenter\').html(\'<form method="post" id="frmGestionCallcenter" action="">\'+$(\'#divPreFormGestionCallcenter\').html()+\'</form>\');
        
        $(\'#divTabsCat\').tabs();
        $(\'#divTabsCompras\').tabs();
        
        //
        $(\'#bttnSubmit\').click(function(){
            fnSaveGestion();
        });
        
        $(\'#selOpciones\').change(function(){
            fnVerificaOpc($(this).val());
        });
        
        /**datepicker**/
        $.timepicker.regional[\'es\'];
        $(\'#txtFechaProximaLlamada\').datetimepicker({
            changeMonth: true,
            numberOfMonths: 1,
            showOn: \'button\',
            buttonImage: \'themes/default/images/Calendar.gif\',
            buttonImageOnly: true,
            changeYear: true,
            minDate: \'0D\',
            dateFormat: \'yy-mm-dd\',
            timeFormat:  "hh:mm tt",
            controlType: \'select\',
            
        }).attr(\'readonly\',true);
        $(\'.ui-datepicker-trigger\').click(function(){
            $(\'.ui-datepicker-current\').css(\'display\',\'none\');
        });
        
        $(\'#advanced_search_link\').remove();
        
        
        
        // set contacts
        $(\'#cont__centro_llamadas_contactscontacts_ida_basic\').prop(\'name\',\'cont__centro_llamadas_contactscontacts_ida_basic\');
        
        // set filtros custom
        $(\'#estado_gestion_basic\').prop(\'name\',\'estado_gestion_basic\');
        $(\'#estado_gestion_basic\').html(
                    \'<option value="" selected="selected">TODOS</option>\'+
                    \'<option value="1">Sin gestion</option>\'+
                    \'<option value="2">Gestionados</option>\'+
                    \'<option value="3">Proxima llamada</option>\'+
                    \'<option value="4">No reciben publicidad</option>\'+
                    \'<option value="5">Encuesta Realizada</option>\'+
                    \'<option value="6">Promocion Entregada</option>\'+
                    \'<option value="7">Venta virtual Realizada</option>\'
                );
        $(\'#estado_gestion_basic\').html($(\'#selOpciones\').html()+
                \'<option value="1">Sin gestion</option>\'+
                \'<option value="2">Gestionados</option>\'+
                \'<option value="4">No reciben publicidad</option>\'
        );
        $(\'#estado_gestion_basic\').change(function(){
            fnGestionEstado($(this).val());
        });
        // hidden label prox llamada
        $(\'#proxima_llamada_basic\').parent().prev().children().prop(\'style\',\'display:none;\');
        $(\'#proxima_llamada_basic\').parent().prev().children().html(\'Prox. Llamada<a href="javascript:void(0)" onclick="fnCleanProxLl();"><img src="themes/default/images/Dashboard.gif" title="Limpiar campos"></a>\');
        fnCambiaHtmlProxLlamada($(\'#proxima_llamada_basic\').parent());
        $(\'#txtFechaDesdeProxLlamada\').datetimepicker({
            changeMonth: true,
            numberOfMonths: 1,
            showOn: \'button\',
            buttonImage: \'themes/default/images/Calendar.gif\',
            buttonImageOnly: true,
            changeYear: true,
            minDate: \'0D\',
            dateFormat: \'yy-mm-dd\',
            timeFormat:  "hh:mm tt",
            controlType: \'select\',
            onClose: function(dateText, inst) {
                if ($(\'#txtFechaHastaProxLlamada\').val() != \'\') {
                    var testStartDate = $(\'#txtFechaDesdeProxLlamada\').datetimepicker(\'getDate\');
                    var testEndDate = $(\'#txtFechaHastaProxLlamada\').datetimepicker(\'getDate\');
                    if (testStartDate > testEndDate)
                        $(\'#txtFechaHastaProxLlamada\').datetimepicker(\'setDate\', testStartDate);
                }
                else {
                    $(\'#txtFechaHastaProxLlamada\').val(dateText);
                }
            },
            onSelect: function (selectedDateTime){
                $(\'#txtFechaHastaProxLlamada\').datetimepicker(\'option\', \'minDate\', $(\'#txtFechaDesdeProxLlamada\').datetimepicker(\'getDate\') );
            }
        }).attr(\'readonly\',true);
        $(\'#txtFechaHastaProxLlamada\').datetimepicker({
            changeMonth: true,
            numberOfMonths: 1,
            showOn: \'button\',
            buttonImage: \'themes/default/images/Calendar.gif\',
            buttonImageOnly: true,
            changeYear: true,
            minDate: \'0D\',
            dateFormat: \'yy-mm-dd\',
            timeFormat:  "hh:mm tt",
            controlType: \'select\',
            onClose: function(dateText, inst) {
                if ($(\'#txtFechaDesdeProxLlamada\').val() != \'\') {
                    var testStartDate = $(\'#txtFechaDesdeProxLlamada\').datetimepicker(\'getDate\');
                    var testEndDate = $(\'#txtFechaHastaProxLlamada\').datetimepicker(\'getDate\');
                    if (testStartDate > testEndDate)
                        $(\'#txtFechaDesdeProxLlamada\').datetimepicker(\'setDate\', testEndDate);
                }
                else {
                    $(\'#txtFechaDesdeProxLlamada\').val(dateText);
                }
            },
            onSelect: function (selectedDateTime){
                $(\'#txtFechaDesdeProxLlamada\').datetimepicker(\'option\', \'maxDate\', $(\'#txtFechaHastaProxLlamada\').datetimepicker(\'getDate\') );
            }
        }).attr(\'readonly\',true);
        
        // set trango fecha creacion
        $(\'#date_entered_basic\').parent().prev().children().html(\'Fecha creacion<a href="javascript:void(0)" onclick="fnCleanCreacion();"><img src="themes/default/images/Dashboard.gif" title="Limpiar campos"></a>\');
        fnCambiaHtmlFechaCreacion($(\'#date_entered_basic\').parent());
        $(\'#txtFechaDesdeCreacion\').datetimepicker({
            changeMonth: true,
            numberOfMonths: 1,
            showOn: \'button\',
            buttonImage: \'themes/default/images/Calendar.gif\',
            buttonImageOnly: true,
            changeYear: true,
            maxDate: \'0D\',
            dateFormat: \'yy-mm-dd\',
            timeFormat:  "hh:mm tt",
            controlType: \'select\',
            onClose: function(dateText, inst) {
                if ($(\'#txtFechaHastaCreacion\').val() != \'\') {
                    var testStartDate = $(\'#txtFechaDesdeCreacion\').datetimepicker(\'getDate\');
                    var testEndDate = $(\'#txtFechaHastaCreacion\').datetimepicker(\'getDate\');
                    if (testStartDate > testEndDate)
                        $(\'#txtFechaHastaCreacion\').datetimepicker(\'setDate\', testStartDate);
                }
                else {
                    $(\'#txtFechaHastaCreacion\').val(dateText);
                }
            },
            onSelect: function (selectedDateTime){
                $(\'#txtFechaHastaCreacion\').datetimepicker(\'option\', \'minDate\', $(\'#txtFechaDesdeCreacion\').datetimepicker(\'getDate\') );
            }
        }).attr(\'readonly\',true);
        $(\'#txtFechaHastaCreacion\').datetimepicker({
            changeMonth: true,
            numberOfMonths: 1,
            showOn: \'button\',
            buttonImage: \'themes/default/images/Calendar.gif\',
            buttonImageOnly: true,
            changeYear: true,
            maxDate: \'0D\',
            dateFormat: \'yy-mm-dd\',
            timeFormat:  "hh:mm tt",
            controlType: \'select\',
            onClose: function(dateText, inst) {
                if ($(\'#txtFechaDesdeCreacion\').val() != \'\') {
                    var testStartDate = $(\'#txtFechaDesdeCreacion\').datetimepicker(\'getDate\');
                    var testEndDate = $(\'#txtFechaHastaCreacion\').datetimepicker(\'getDate\');
                    if (testStartDate > testEndDate)
                        $(\'#txtFechaDesdeCreacion\').datetimepicker(\'setDate\', testEndDate);
                }
                else {
                    $(\'#txtFechaDesdeCreacion\').val(dateText);
                }
            },
            onSelect: function (selectedDateTime){
                $(\'#txtFechaDesdeCreacion\').datetimepicker(\'option\', \'maxDate\', $(\'#txtFechaHastaCreacion\').datetimepicker(\'getDate\') );
            }
        }).attr(\'readonly\',true);
        
        // set tiendas
        $(\'#stu_tiendas_name_basic\').prop(\'name\',\'stu_tiendas_name_basic\');
        $(\'#stu_tiendas_name_basic\').html($(\'#selStuTiendas_hidden\').html());
        // set vip
        $(\'#cliente_vip_c_basic\').prop(\'name\',\'cliente_vip_c_basic\');
        $(\'#cliente_vip_c_basic\').html(
            \'<option value="" selected="selected">TODOS</option>\'+
            \'<option value="1">Si</option>\'+
            \'<option value="0">No</option>\'
        );
        // set fecha cumples
        $(\'#fecha_cumples_basic\').prop(\'name\',\'fecha_cumples_basic\');
        $(\'#fecha_cumples_basic\').parent().prev().children().html(
                \'Cumplea&ntilde;os<br/>\'+
                \'&nbsp;Mes: <input type="radio" id="radMes" name="radCumples" checked="checked"/>\'+
                \'&nbsp;Rango: <input type="radio" id="radRango" name="radCumples"/>\'
        );
        $(\'#radMes,#radRango\').click(function(){
            fnCambFechaFiltro();
        });
        $(\'#fecha_cumples_basic\').html(
            \'<option value="">TODOS</option>\'+
            \'<option value="1">Enero</option>\'+
            \'<option value="2">Febrero</option>\'+
            \'<option value="3">Marzo</option>\'+
            \'<option value="4">Abril</option>\'+
            \'<option value="5">Mayo</option>\'+
            \'<option value="6">Junio</option>\'+
            \'<option value="7">Julio</option>\'+
            \'<option value="8">Agosto</option>\'+
            \'<option value="9">Septiembre</option>\'+
            \'<option value="10">Octubre</option>\'+
            \'<option value="11">Noviembre</option>\'+
            \'<option value="12">Diciembre</option>\'
        );
        // set rango
        $(\'#fecha_cumples_basic\').after(
            \'<div id="divFechaRangoCumples" style="display:none;">\'+
            \'   De: \'+
            \'<select id="selRangoMesCumplesDe" name="selRangoMesCumplesDe" style="width:auto !important;">\'+
            \'<option value="">...</option>\'+
            \'<option value="1">Enero</option>\'+
            \'<option value="2">Febrero</option>\'+
            \'<option value="3">Marzo</option>\'+
            \'<option value="4">Abril</option>\'+
            \'<option value="5">Mayo</option>\'+
            \'<option value="6">Junio</option>\'+
            \'<option value="7">Julio</option>\'+
            \'<option value="8">Agosto</option>\'+
            \'<option value="9">Septiembre</option>\'+
            \'<option value="10">Octubre</option>\'+
            \'<option value="11">Noviembre</option>\'+
            \'<option value="12">Diciembre</option>\'+
            \'</select>\'+
            \'<select id="selRangoDiaCumplesDe" name="selRangoDiaCumplesDe" style="width:auto !important;">\'+
            \'<option value="">...</option>\'+
            \'<option value="1">1</option><option value="2">2</option>\'+
            \'<option value="3">3</option><option value="4">4</option>\'+
            \'<option value="5">5</option><option value="6">6</option>\'+
            \'<option value="7">7</option><option value="8">8</option>\'+
            \'<option value="9">9</option><option value="10">10</option>\'+
            \'<option value="11">11</option><option value="12">12</option>\'+
            \'<option value="13">13</option><option value="14">14</option>\'+
            \'<option value="15">15</option><option value="16">16</option>\'+
            \'<option value="17">17</option><option value="18">18</option>\'+
            \'<option value="19">19</option><option value="20">20</option>\'+
            \'<option value="21">21</option><option value="22">22</option>\'+
            \'<option value="23">23</option><option value="24">24</option>\'+
            \'<option value="25">25</option><option value="26">26</option>\'+
            \'<option value="27">27</option><option value="28">28</option>\'+
            \'<option value="29">29</option><option value="30">30</option>\'+
            \'<option value="31">31</option>\'+
            \'</select>\'+
            \'   <br/>Hasta: \'+
            \'<select id="selRangoMesCumplesHasta" name="selRangoMesCumplesHasta" style="width:auto !important;">\'+
            \'<option value="">...</option>\'+
            \'<option value="1">Enero</option>\'+
            \'<option value="2">Febrero</option>\'+
            \'<option value="3">Marzo</option>\'+
            \'<option value="4">Abril</option>\'+
            \'<option value="5">Mayo</option>\'+
            \'<option value="6">Junio</option>\'+
            \'<option value="7">Julio</option>\'+
            \'<option value="8">Agosto</option>\'+
            \'<option value="9">Septiembre</option>\'+
            \'<option value="10">Octubre</option>\'+
            \'<option value="11">Noviembre</option>\'+
            \'<option value="12">Diciembre</option>\'+
            \'</select>\'+
            \'<select id="selRangoDiaCumplesHasta" name="selRangoDiaCumplesHasta" style="width:auto !important;">\'+
            \'<option value="">...</option>\'+
            \'<option value="1">1</option><option value="2">2</option>\'+
            \'<option value="3">3</option><option value="4">4</option>\'+
            \'<option value="5">5</option><option value="6">6</option>\'+
            \'<option value="7">7</option><option value="8">8</option>\'+
            \'<option value="9">9</option><option value="10">10</option>\'+
            \'<option value="11">11</option><option value="12">12</option>\'+
            \'<option value="13">13</option><option value="14">14</option>\'+
            \'<option value="15">15</option><option value="16">16</option>\'+
            \'<option value="17">17</option><option value="18">18</option>\'+
            \'<option value="19">19</option><option value="20">20</option>\'+
            \'<option value="21">21</option><option value="22">22</option>\'+
            \'<option value="23">23</option><option value="24">24</option>\'+
            \'<option value="25">25</option><option value="26">26</option>\'+
            \'<option value="27">27</option><option value="28">28</option>\'+
            \'<option value="29">29</option><option value="30">30</option>\'+
            \'<option value="31">31</option>\'+
            \'</select>\'+
            \'</div>\'
        );
        
        // set bttn reportes
        $(\'#selectLinkTop\').after("<a href=\'repetidos.php\' target=\'_blank\' ;\'><img src=\'themes/default/images/infoerrada.png\' width=\'20\' height=\'20\' title=\'Reportes\'/></a>");

        $(\'#selectLinkTop\').after("<a href=\'javascript:void(0)\' onclick=\'fnShowReportes();\'><img src=\'themes/default/images/ActivitiesReports.gif\' title=\'Reportes\'/></a>");


       
        
        $(\'#delete_listview_top\').remove();
        $(\'#select_actions_disabled_top\').remove();
        $(\'#actionLinkTop\').remove();
        $(\'#delete_listview_bottom\').remove();
        $(\'#select_actions_disabled_bottom\').remove();
        $(\'#actionLinkBottom\').remove();
        
        $(\'#massall_top\').remove();
        $(\'#massall_bottom\').remove();
        $(\'#selectLinkTop\').remove();
        $(\'#selectLinkBottom\').remove();
        
        // veriicamos
        if(\'';  echo $this->_tpl_vars['request_custom']['selRangoMesCumplesDe'];  echo '\' != ""){
            $(\'#radRango\').prop(\'checked\',true);
        }else{
            $(\'#radMes\').prop(\'checked,true\');
        }
        fnCambFechaFiltro();
        // set request
        $(\'#estado_gestion_basic\').val(\'';  echo $this->_tpl_vars['request_custom']['estado_gestion_basic'];  echo '\');
        fnGestionEstado(\'';  echo $this->_tpl_vars['request_custom']['estado_gestion_basic'];  echo '\');
        $(\'#txtFechaDesdeProxLlamada\').val(\'';  echo $this->_tpl_vars['request_custom']['txtFechaDesdeProxLlamada'];  echo '\');
        $(\'#txtFechaHastaProxLlamada\').val(\'';  echo $this->_tpl_vars['request_custom']['txtFechaHastaProxLlamada'];  echo '\');
        $(\'#txtFechaDesdeCreacion\').val(\'';  echo $this->_tpl_vars['request_custom']['txtFechaDesdeCreacion'];  echo '\');
        $(\'#txtFechaHastaCreacion\').val(\'';  echo $this->_tpl_vars['request_custom']['txtFechaHastaCreacion'];  echo '\');
        $(\'#stu_tiendas_name_basic\').val(\'';  echo $this->_tpl_vars['request_custom']['stu_tiendas_name_basic'];  echo '\');
        $(\'#cliente_vip_c_basic\').val(\'';  echo $this->_tpl_vars['request_custom']['cliente_vip_c_basic'];  echo '\');
        $(\'#cedula_nit_c_basic\').val(\'';  echo $this->_tpl_vars['request_custom']['cedula_nit_c_basic'];  echo '\');
        $(\'#email_address_basic\').val(\'';  echo $this->_tpl_vars['request_custom']['email_address_basic'];  echo '\');
        $(\'#fecha_cumples_basic\').val(\'';  echo $this->_tpl_vars['request_custom']['fecha_cumples_basic'];  echo '\');
        $(\'#selRangoMesCumplesDe\').val(\'';  echo $this->_tpl_vars['request_custom']['selRangoMesCumplesDe'];  echo '\');
        $(\'#selRangoDiaCumplesDe\').val(\'';  echo $this->_tpl_vars['request_custom']['selRangoDiaCumplesDe'];  echo '\');
        $(\'#selRangoMesCumplesHasta\').val(\'';  echo $this->_tpl_vars['request_custom']['selRangoMesCumplesHasta'];  echo '\');
        $(\'#selRangoDiaCumplesHasta\').val(\'';  echo $this->_tpl_vars['request_custom']['selRangoDiaCumplesHasta'];  echo '\');
        $(\'#search_form\').find(\'input\').each(function(){
            if($(this).prop(\'name\') == \'action\'){
               $(this).val(\'index\'); 
            }
        });
        
        $(\'#bttnReport1\').click(function(){
            fnBuscaLlamadasTienda();
        });
        $(\'#bttnReport2\').click(function(){
            fnBuscaLlamadasOperador();
        });
        $(\'#bttnReport3\').click(function(){
            fnBuscaLlamadasCliente();
        });
        /*
          modifica por darwin rosero 
          a qui se egrega este evento para que 
          llame al metodo que muestra los datos 
          de la ventana campañas 

        */
         $(\'#bttnReport4\').click(function(){
            fnBuscaCampaniasCliente();
        });
    });
    
    function fnCambFechaFiltro(){
        $(\'#fecha_cumples_basic\').hide();
        $(\'#fecha_cumples_basic\').val(\'\');
        $(\'#selRangoMesCumplesDe\').val(\'\');
        $(\'#selRangoDiaCumplesDe\').val(\'\');
        $(\'#selRangoMesCumplesHasta\').val(\'\');
        $(\'#selRangoDiaCumplesHasta\').val(\'\');
        $(\'#divFechaRangoCumples\').hide();
        if($(\'#radMes\').is(\':checked\')){
            $(\'#fecha_cumples_basic\').show();
        }else{
            $(\'#divFechaRangoCumples\').show();
        }
    }

    function fnShowcontactos()
    {
        
    //$("#reportecontactos").dialog(\'open\');

    
    $(\'#divReport5\').load(\'index.php?module=cont__centro_llamadas&action=verconctos\');


    }
    
    /**
     * 
     * @param {type} value
     * @returns {undefined}
     */
    function fnGestionEstado(value){
        $(\'#divTdProxLlamadas\').parent().prev().children().prop(\'style\',\'display:none;\');
        $(\'#divTdProxLlamadas\').hide();
        fnCleanProxLl();
        switch(value){
            case "a3714054-b810-ac7f-2321-55c6f0432000":
                $(\'#divTdProxLlamadas\').parent().prev().children().prop(\'style\',\'display:block;\');
                $(\'#divTdProxLlamadas\').show();
                break;
        }
    }
    
    /**
     * 
     * @returns {undefined}
     */
    function fnCleanProxLl(){
        $(\'#txtFechaDesdeProxLlamada\').val(\'\');
        $(\'#txtFechaHastaProxLlamada\').val(\'\');
    }
    
    /**
     * 
     * @param {type} objtd
     * @returns {undefined}
     */
    function fnCambiaHtmlProxLlamada(objtd){
        var html = "";
        html += "<div id=\'divTdProxLlamadas\' style=\'display:none;\'>";
        html += "   Desde:";
        html += "       <input type=\'text\' id=\'txtFechaDesdeProxLlamada\' name=\'txtFechaDesdeProxLlamada\' style=\'width:100px !important;\' readonly=\'readonly\' maxlength=\'10\' />";
        html += "   <br/>";
        html += "   Hasta: ";
        html += "       <input type=\'text\' id=\'txtFechaHastaProxLlamada\' name=\'txtFechaHastaProxLlamada\' style=\'width:100px !important;\' readonly=\'readonly\' maxlength=\'10\' />";
        html += "</div>";
        $(objtd).html(html);
    }
    
    /**
     * 
     * @param {type} objtd
     * @returns {undefined}
     */
    function fnCambiaHtmlFechaCreacion(objtd){
        var html = "";
        html += "<div id=\'divTdFechaCreacion\'>";
        html += "   Desde:";
        html += "       <input type=\'text\' id=\'txtFechaDesdeCreacion\' name=\'txtFechaDesdeCreacion\' style=\'width:100px !important;\' readonly=\'readonly\' maxlength=\'10\' />";
        html += "   <br/>";
        html += "   Hasta: ";
        html += "       <input type=\'text\' id=\'txtFechaHastaCreacion\' name=\'txtFechaHastaCreacion\' style=\'width:100px !important;\' readonly=\'readonly\' maxlength=\'10\' />";
        html += "</div>";
        $(objtd).html(html);
    }
    
    /**
     * 
     * @returns {undefined}
     */
    function fnCleanCreacion(){
        $(\'#txtFechaDesdeCreacion\').val(\'\');
        $(\'#txtFechaHastaCreacion\').val(\'\');
    }
    
    
    /**
     * 
     * @param {type} idcontactos
     * @param {type} firstname
     * @param {type} phonehome
     * @param {type} phonemobile
     * @param {type} phonework
     * @param {type} nametienda
     * @param {type} clientevip
     * @returns {undefined}
     */
    function fnShowGestion(idcontactos,firstname,phonehome,phonemobile,phonework,
            nametienda,clientevip,fechacumples,idtienda,emailp,offset,cedula,frequenciaContacto,tipoContacto,tipoInformacionNormal,tipoInformacion){
        $(\'#hdnoffset\').val(offset);
        // set background row
        $(\'.class_bck\').each(function(){
            $(this).removeClass(\'class_bck\')
            $(this).prop(\'style\',\'\')
        });
        $(\'#trRowBody\'+offset).addClass(\'class_bck\');
        $(\'#trRowBody\'+offset).prop(\'style\',\'background-color:#FBFBC0\');
        
        $(\'#hdnidcontacto\').val(idcontactos);
        $(\'#spnFirstName\').html(firstname);
        $(\'#txtFirstName\').val(firstname);
        
        $(\'#spnTelCasa\').html(phonehome);
        $(\'#txtTelCasa\').val(phonehome);
        
        $(\'#spnTelCelu\').html(phonemobile);
        $(\'#txtTelCelu\').val(phonemobile);
        
        $(\'#spnTelTrabajo\').html(phonework);
        $(\'#txtTelTrabajo\').val(phonework);
        
        $(\'#spnTienda\').html(nametienda);
        $(\'#selTienda\').val(idtienda);
        
        $(\'#spnVip\').html((clientevip==\'1\'?\'Si\':\'No\'));
        $(\'#selVip\').val(clientevip);
        
        $(\'#spnCumples\').html("");
        if(fechacumples!=""){
            $(\'#spnCumples\').html(fnGetMesSpn(fechacumples.split("-")[1])+\' \'+fechacumples.substring(8));
        }
        
        var arrcum = fechacumples.split(\'-\');
        $(\'#selMesCumples\').val(parseInt(arrcum[1]));
        $(\'#selDiaCumples\').val(parseInt(arrcum[2]));
        
        $(\'#spnEmailP\').html(emailp);
        $(\'#txtEmailP\').val(emailp);
        
        $(\'#spnCedula\').html(cedula);
        $(\'#txtCedula\').val(cedula);
        
        // open dialog
        $(\'#divGestionCallcenter\').dialog(\'open\');
        // cargamos la info de ventas
        fnLoadInfoVentas(idcontactos);
        $(\'#spnFrecuenciaContacto\').html(frequenciaContacto);
        $(\'#selFrecuenciaContacto\').val(frequenciaContacto);

        $(\'#spnTipoContacto\').html(tipoContacto);
        $(\'#selTipoContacto\').val(tipoContacto);


        /*
          modificado por : darwin rosero 
          fecha: enero/21/2016
          se cambian estos valores Para poder tener los dos 
          tipos de select el normal y el multiple
        */

        $(\'#spnTipoInformacionNormal\').html(tipoInformacionNormal);
        $(\'#selTipoInformacionNormal\').val(tipoInformacionNormal);


        /*
          añadido por : darwin rosero 
          fecha: enero/21/2016
          se toma el valor tipoInformacion se convierte
          en un array separandolo por las comas de cada 
          palabra con la funcion split  que trae este string 
          y mandamos este array a la funcion  fnAcomodarOpciones
        */
        tipoInformacion = tipoInformacion.split(",");
        tipoInformacionLabel=fnAcomodarOpciones(\'selTipoInformacionMultiple\',tipoInformacion);

         /*
           añadido por : darwin rosero 
           fecha: enero/21/2016
           se agregra esta linea para mostrar  en label los datos  que se encuentra hasta ahora 
           
         */
        $(\'#spnTipoInformacionMultiple\').html(tipoInformacionLabel);
         
    }
    /*
      añadido por : darwin rosero 
      fecha: enero/21/2016
      esta funcion recive dos parametros  idselect y arrInformacion
      el primero es el id del select multiple que queremos selecionar y 
      el segundo es un array con los datos a seleccionar 

      idselect:id del select multiple 
      arrInformacion: array con los datos a selecionar

    */
   function fnAcomodarOpciones(idSelect,arrInformacion)
    {
         // a qui se asigana a esta variable el primer valor del arraglo que se manda
         tipoLabel=arrInformacion[0].replace(/[^a-zA-Z 0-9.]+/g,\'\');
         //luego recorremos todas las opciones del select 
         $(\'#\'+idSelect+\' option \').each(function(i, sel){ 
            /*se crea este for para rrecorrer el arreglo y compararlo con las opciones 
              del select 
            */
             for(i=0;i<arrInformacion.length;i++){
                  /*cada item o palabra del arreglo  le devemos quitar los ^palabra ^
                    ya que de esta manera no lo manda sugarcrm y toca quitarlo para poder comparar 
                    la palabra con los item a si que la quitamos con replace
                  */
                  nuevaInformacion=arrInformacion[i].replace(/[^a-zA-Z 0-9.]+/g,\'\');
                 
                  //luego comparamos este dato con la opcion en este momente del ciclo 
                  if(nuevaInformacion==$(sel).val()){
                       /*si no estamos por el primer ciclo vamos concatenando 
                        las palabras del arreglo en la variable tipoLabel 
                       */
                      if(arrInformacion[0]!=arrInformacion[i]){
                            tipoLabel+=","+nuevaInformacion;
                          }
                    
                     //si se cumple el if se selecionan
                     $(sel).attr("selected","selected");
                  }
              }
             
            });
         return tipoLabel;
    }




    
    function fnSaveGestion(){
        // validamos los datos a enviar
        if($(\'#selOpciones\').val()==\'\'){
            alert(\'Debe seleccionar una opcion de gestion, proceso abortado\');
            return;
        }
        if($(\'#selOpciones\').val()==\'a3714054-b810-ac7f-2321-55c6f0432000\'){
            if($(\'#txtFechaProximaLlamada\').val()==\'\'){
                alert(\'Debe seleccionar una fecha de proxima llamada, proceso abortado\');
                return;
            }
        }
        
        //
        $(\'#frmGestionCallcenter\').append(\'<input type="hidden" name="action" value="saveGestionCallcenter" />\');
        $.ajax({
            url: "index.php?module=cont__centro_llamadas",
            type:\'POST\',
            data: "input_type=JSON&response_type=JSON&to_pdf:true&"+$(\'#frmGestionCallcenter\').serialize(),
            dataType:\'json\',
            beforeSend:function(){
                $(\'#bttnSubmit\').prop(\'disabled\',\'disabled\').addClass(\'ui-state-disabled\');
                $(\'#divPreloadGestionCallcenter\').html("<img src=\'themes/default/images/bar_loader.gif\'/><br/>Guardando informaci&oacute;n...");
            },
            success: function(msg){
                
                $(\'#divPreloadGestionCallcenter\').html("");
                if(msg!=null && msg.msj!=null){
                    var arrpag = $(\'.pageNumbers\').html().split(\'-\');
                    arrpag = arrpag[0].trim().replace("(", "");
                    arrpag = parseInt(arrpag.trim());
                    arrpag = (parseInt(arrpag) - 1);
                    alert(msg.msj);
                    $(\'#search_form\').append(\'<input type="hidden" name="cont__centro_llamadas2_CONT__CENTRO_LLAMADAS_offset" value="\'+arrpag+\'">\');
                    $(\'#search_form\').attr(\'action\',$(\'#search_form\').attr(\'action\')+\'&offset=\'+$(\'#hdnoffset\').val())
                    $(\'#search_form\').submit();
                }else{
                    alert("Error en el proceso");
                }
            }
        });
    }
    
    function fnGetMesSpn(mes){
        if(mes=="")
            return "";
        switch(parseInt(mes)){
            case 1: return "Enero";
            case 2: return "Febrero";
            case 3: return "Marzo";
            case 4: return "Abril";
            case 5: return "Mayo";
            case 6: return "Junio";
            case 7: return "Julio";
            case 8: return "Agosto";
            case 9: return "Septiembre";
            case 10: return "Octubre";
            case 11: return "Noviembre";
            case 12: return "Diciembre";
        }
    }
    
    /**
     * 
     * @param {type} idcontactos
     * @returns {undefined}
     */
    function fnLoadInfoVentas(idcontactos){
        // cargamos la gestion d callcenter
        fnLoadGestionCallcenter(idcontactos);
        // consultamos via ajax el html de la plantilla
        $.ajax({
            url: "index.php?module=cont__centro_llamadas",
            type:\'POST\',
            data: {action:\'getInfoVentas\',input_type: "JSON", response_type: "JSON",idcontactos:idcontactos,to_pdf:true},
            dataType:\'json\',
            beforeSend:function(){
                $(\'#ulDivTabsCompras\').html("<img src=\'themes/default/images/ui-anim_basic_16x16.gif\'/><br/>Cargando informaci&oacute;n...");
            },
            success: function(msg){
                $(\'#ulDivTabsCompras\').html("");
                if(msg != null && msg.rows!=null){
                    if(msg.rows.length>0){
                        for(var k=0;k<msg.rows.length;k++){
                            $(\'#divTabsCompras\').tabs(\'add\', \'#tab-\'+k, msg.rows[k].fecha_documento+\' - \'+msg.rows[k].numero_documento);
                            var htmltabla = "";
                            htmltabla += "<div>";
                            htmltabla += "  <table width=100%>";
                            htmltabla += "      <tr>";
                            htmltabla += "          <th>Numero documento:</th>";
                            htmltabla += "          <td><i style=\'color:red;\'>"+msg.rows[k].numero_documento+"</i></td>";
                            htmltabla += "          <th>Fecha document:</th>";
                            htmltabla += "          <td><i style=\'color:red;\'>"+msg.rows[k].fecha_documento+"</i></td>";
                            htmltabla += "          <th>Cantidad Productos:</th>";
                            htmltabla += "          <td><i style=\'color:red;\'>"+msg.rows[k].cantidad_productos+"</i></td>";
                            htmltabla += "      </tr>";
                            htmltabla += "  </table>";
                            htmltabla += "</div>";
                            // tabla detalles
                            if(msg.rows[k].detalle!=null){
                                htmltabla += "<div>";
                                htmltabla += "  <table width=100% class=\'list view\'>";
                                htmltabla += "  <tr>";
                                htmltabla += "      <th>Referencia</th>";
                                htmltabla += "      <th>Descripcion</th>";
                                htmltabla += "      <th>Vr. Neto</th>";
                                htmltabla += "      <th>Talla</th>";
                                htmltabla += "      <th>Color</th>";
                                htmltabla += "      <th>Linea</th>";
                                htmltabla += "      <th>Coleccion</th>";
                                htmltabla += "  </tr>";
                                var total=0;
                                for(j=0;j<msg.rows[k].detalle.length;j++){
                                    htmltabla += "<tr class=\'oddListRowS1\'>";
                                    htmltabla += "      <td>"+msg.rows[k].detalle[j].name_producto+"</td>";
                                    htmltabla += "      <td>"+msg.rows[k].detalle[j].desc_item_c+"</td>";
                                    htmltabla += "      <td>"+number_format(msg.rows[k].detalle[j].valor_neto)+"</td>";
                                    htmltabla += "      <td>"+msg.rows[k].detalle[j].talla+"</td>";
                                    htmltabla += "      <td>"+msg.rows[k].detalle[j].color+"</td>";
                                    htmltabla += "      <td>"+msg.rows[k].detalle[j].linea+"</td>";
                                    htmltabla += "      <td>"+msg.rows[k].detalle[j].colecciones+"</td>";
                                    htmltabla += "</tr>";
                                    total = (total + parseFloat(msg.rows[k].detalle[j].valor_neto));
                                }
                                htmltabla += "  <tr>";
                                htmltabla += "      <th>&nbsp;</th>";
                                htmltabla += "      <th>&nbsp;</th>";
                                htmltabla += "      <th>"+number_format(total)+"</th>";
                                htmltabla += "      <th>&nbsp;</th>";
                                htmltabla += "      <th>&nbsp;</th>";
                                htmltabla += "      <th>&nbsp;</th>";
                                htmltabla += "      <th>&nbsp;</th>";
                                htmltabla += "  </tr>";
                                htmltabla += "  </table>";
                                htmltabla += "</div>";
                            }
                            // sethtml ntab
                            $(\'#tab-\'+k).html(htmltabla);
                            
                        }
                    }else{
                        $(\'#ulDivTabsCompras\').html("<b>NO HAY DATOS PARA MOSTRAR</b>");
                    }
                }else{
                    if(msg.msj != null){
                        alert(msg.msj);
                    }else{
                        alert("Error en el proceso!");
                    }
                }
            }
        });
    }
    
    /**
     * 
     * @param {type} idcontactos
     * @returns {undefined}
     */
    function fnLoadGestionCallcenter(idcontactos,iddiv){
        $.ajax({
            url: "index.php?module=cont__centro_llamadas",
            type:\'POST\',
            data: {action:\'getInfoCallcenter\',input_type: "JSON", response_type: "JSON",idcontactos:idcontactos,to_pdf:true},
            dataType:\'json\',
            beforeSend:function(){
                if(iddiv == undefined){
                    $(\'#tabC2\').html("<img src=\'themes/default/images/ui-anim_basic_16x16.gif\'/><br/>Cargando informaci&oacute;n...");
                }else{
                    $(\'#divPreload\'+iddiv).html("<img src=\'themes/default/images/ui-anim_basic_16x16.gif\'/><br/>Cargando informaci&oacute;n...");
                }
            },
            success: function(msg){
                if(iddiv == undefined){
                    $(\'#tabC2\').html("");
                }else{
                    $(\'#divPreload\'+iddiv).html("");
                }
                if(msg != null && msg.rows!=null){
                    if(msg.rows.length>0){
                        var html = "";
                        html += "<table width=100% class=\'list view\'>";
                        html += " <tr>";
                        html += "    <th>Fecha gestion</th>";
                        html += "    <th>Gestion</th>";
                        html += "    <th>Fecha Proxima llamada</th>";
                        html += "    <th>Hablo con</th>";
                        html += "    <th>Observaciones</th>";
                        html += " </tr>";
                        for(var i=0;i<msg.rows.length;i++){
                            html += "<tr>";
                            html += "   <td>"+msg.rows[i].date_entered+"</td>";
                            html += "   <td>"+msg.rows[i].gestion_name+"</td>";
                            html += "   <td>"+msg.rows[i].proxima_llamada+"</td>";
                            html += "   <td>"+msg.rows[i].hablo_con+"</td>";
                            html += "   <td><i style=\'font-size:8pt;\'>"+msg.rows[i].description+"</i></td>";
                            html += "</tr>";
                        }
                        html += "</table>";
                        if(iddiv!=undefined){
                            $(\'#divBody\'+iddiv).html(html);
                        }else{
                            $(\'#tabC2\').html(html);
                        }
                    }else{
                        if(iddiv!=undefined){
                            $(\'#\'+iddiv).html("NO HAY DATOS DE GESTION");
                        }else{
                            $(\'#tabC2\').html("NO HAY DATOS DE GESTION");
                        }
                    }
                }else{
                    if(msg.msj != null){
                        alert(msg.msj);
                    }else{
                        alert("Error em el proceso!");
                    }
                }
            }
        });
    }
    
    /**
     * 
     * @param {type} valueopc
     * @returns {undefined}
     */
    function fnVerificaOpc(valueopc){
        $(\'#trProximaLlamada\').hide();
        $(\'#txtFechaProximaLlamada\').val(\'\');
        $(\'#spnFirstName,#spnTelCasa,#spnTelCelu,#spnTelTrabajo,#spnTienda,#spnVip,#spnCumples,#spnEmailP\').show();
        $(\'#txtFirstName,#txtTelCasa,#txtTelCelu,#txtTelTrabajo,#selTienda,#selVip,#divCumples,#txtEmailP\').hide();
        switch(valueopc){
            case "a3714054-b810-ac7f-2321-55c6f0432000":
                $(\'#trProximaLlamada\').show(\'\',500);
                break;
            case "ef2cb3bd-2798-c655-3b2f-55f265e2aff4":
                fnEditInlineField();
                break;
        }
    }
    
    /**
     * 
     * @param {type} number
     * @param {type} decimals
     * @param {type} dec_point
     * @param {type} thousands_sep
     * @returns {unresolved}
     */
    function number_format(number, decimals, dec_point, thousands_sep) {
        number = (number + \'\')
          .replace(/[^0-9+\\-Ee.]/g, \'\');
        var n = !isFinite(+number) ? 0 : +number,
          prec = !isFinite(+decimals) ? 0 : Math.abs(decimals),
          sep = (typeof thousands_sep === \'undefined\') ? \',\' : thousands_sep,
          dec = (typeof dec_point === \'undefined\') ? \'.\' : dec_point,
          s = \'\',
          toFixedFix = function(n, prec) {
            var k = Math.pow(10, prec);
            return \'\' + (Math.round(n * k) / k)
              .toFixed(prec);
          };
        // Fix for IE parseFloat(0.55).toFixed(0) = 0;
        s = (prec ? toFixedFix(n, prec) : \'\' + Math.round(n))
          .split(\'.\');
        if (s[0].length > 3) {
          s[0] = s[0].replace(/\\B(?=(?:\\d{3})+(?!\\d))/g, sep);
        }
        if ((s[1] || \'\')
          .length < prec) {
          s[1] = s[1] || \'\';
          s[1] += new Array(prec - s[1].length + 1)
            .join(\'0\');
        }
        return s.join(dec);
    }
    
    /**
     * 
     * @returns {undefined}
     */
    function fnCenterDialog(){
        $(\'#divConfigCampania\').dialog(\'widget\').position({
            my: "center", at: "center", of: window
        });
    }
    
    /**
     * 
     * @param {type} idcontacto
     * @returns {undefined}
     */
    function fnShowHistorialGestion(idcontacto){
        $(\'#divHistorialGestion\').dialog(\'open\');
        fnLoadGestionCallcenter(idcontacto,\'HistorialGestion\');
    }
    
    /**
     * 
     * @returns {undefined}
     */
    function fnShowReportes(){
        $(\'#divHistorialReporteCallcenter\').dialog(\'open\');
        // busca los 3 reportes
        fnBuscaLlamadasTienda();
        fnBuscaLlamadasOperador();
        fnBuscaLlamadasCliente();
        fnShowcontactos();
         /*
          modifica por darwin rosero 
          a qui se egrega este metodo que muestra los datos 
          de la ventana campañas 

        */
        fnBuscaCampaniasCliente();
    }
    
    function fnBuscaLlamadasTienda(){
        $.ajax({
            url: "index.php?module=cont__centro_llamadas",
            type:\'POST\',
            data: {action:\'getReportLlamadasTienda\',input_type: "JSON", response_type: "JSON",to_pdf:true,fecha_desde:$(\'#txtFechaDesdeReport1\').val(),fecha_hasta:$(\'#txtFechaHastaReport1\').val()},
            dataType:\'json\',
            beforeSend:function(){
                $(\'#divBodyReport1\').html("");
                $(\'#divExport_1\').hide();
                $(\'#divPreloadReport1\').html("<img src=\'themes/default/images/bar_loader.gif\'/><br/>Cargando informaci&oacute;n...");
            },
            success: function(msg){
                $(\'#divExport_1\').show();
                $(\'#divPreloadReport1\').html("");
                if(msg!=null && msg.rows != null){
                    var str = "<table width=100% class=\'list view\'>";
                        if(msg.rows!=null && msg.rows.length>0){
                            $(msg.rows[0]).each(function(key,value){
                                var cont_o = 0;
                                var cont_ci = 1;
                                str += "    <tr>";
                                var value_22 = value;
                                for (key_2 in value) {
                                    if(key_2.indexOf(\'__opc\') > 0){
                                        if(cont_o > 0 && cont_o % 3 == 0){
                                            str += "    </tr>";
                                            cont_o = 0;
                                        }
                                        str += "    <th>";
                                        str += "        "+cont_ci+\'-\'+key_2.substring(0,key_2.indexOf(\'__opc\'));
                                        /*for (key_22 in value_22) {
                                            if(key_22.indexOf(\'__efectiva\') > 0){
                                                if(key_22.substring(0,key_22.indexOf(\'__efectiva\')) == 
                                                   key_2.substring(0,key_2.indexOf(\'__opc\'))     
                                                ){
                                            
                                                    str += "    <span style=\'border-style:solid;border-width:1px;width:50px;height;10px;background-color:#DCF9E4;\'>&nbsp;&nbsp;&nbsp;</span>";
                                                    break;
                                                }
                                            }
                                        }*/
                                        str += "    </th>";
                                        cont_ci ++;
                                        cont_o ++;
                                    }
                                }
                                str += "    </tr>";
                            });
                        }
                        str += "</table>";
                    str += "<table width=100% class=\'list view\'>";
                    if(msg.rows.length>0){
                        str += "<tr class=\'oddListRowS1\'>";
                        str += "    <th>Tienda</th>";
                        str += "    <th>Llamadas</th>";
                        // recorremos las opc
                        cont_o = 1;
                        if(msg.rows!=null && msg.rows.length>0){
                            $(msg.rows[0]).each(function(key,value){
                                for (key_2 in value) {
                                    if(key_2.indexOf(\'__opc\') > 0){
                                        str += "    <th>"+cont_o+"</th>";
                                        cont_o++;
                                    }
                                }
                            });
                        }
                        str += "    <th>Efectivas</th>";
                        str += "    <th>Porcentaje %</th>";
                        str += "</tr>";
                        var t_1 = 0;
                        var t_2 = 0;
                        var t_3 = 0;
                        for(var i=0;i<msg.rows.length;i++){
                            t_1 = (t_1 + parseFloat(msg.rows[i].total_llamadas));
                            t_2 = (t_2 + parseFloat(msg.rows[i].total_llamadas_efectivas));
                            t_3 = (t_3 + parseFloat(msg.rows[i].porcentaje));
                            str += "<tr class=\'oddListRowS1\'>";
                            str += "    <td>"+msg.rows[i].name+"</td>";
                            str += "    <td>"+number_format(msg.rows[i].total_llamadas)+"</td>";
                            $(msg.rows[i]).each(function(key,value){
                                var value_22 = value;
                                for (key_2 in value) {
                                    if(key_2.indexOf(\'__opc\') > 0){
                                        var strb_k = \'\';
                                        /*for (key_22 in value_22) {
                                            if(key_22.indexOf(\'__efectiva\') > 0){
                                                if(key_22.substring(0,key_22.indexOf(\'__efectiva\')) == 
                                                   key_2.substring(0,key_2.indexOf(\'__opc\'))     
                                                ){
                                            
                                                    strb_k = \'background:#DCF9E4\';
                                                    break;
                                                }
                                            }
                                        }*/
                                        str += "    <td style=\'"+strb_k+"\'>"+(value[key_2]==0?\'\':value[key_2]);
                                        str += "    </td>";
                                    }
                                }
                            });
                            str += "    <td style=\'background:#DCF9E4;\'>"+number_format(msg.rows[i].total_llamadas_efectivas)+"</td>";
                            str += "    <td style=\'background:#DCF9E4;\'>"+number_format(msg.rows[i].porcentaje,2)+"</td>";
                            str += "</tr>";
                        }
                        str += "<tr class=\'oddListRowS1\'>";
                        str += "    <th>&nbsp;</th>";
                        str += "    <th>"+number_format(t_1)+"</th>";
                        if(msg.rows!=null && msg.rows.length>0){
                            $(msg.rows[0]).each(function(key,value){
                                for (key_2 in value) {
                                    if(key_2.indexOf(\'__opc\') > 0){
                                        str += "    <th>&nbsp;</th>";
                                    }
                                }
                            });
                        }
                        str += "    <th>"+number_format(t_2)+"</th>";
                        str += "    <th>&nbsp;</th>";
                        str += "</tr>";
                    }else{
                        str += "<tr><th>NO HAY DATOS PARA MOSTRAR</th></tr>";
                    }
                    str += "</table>";
                    $(\'#divBodyReport1\').html(str);
                }else{
                    alert("Error en el proceso");
                }
            }
        });
    }
    
    /**
     * 
     * @returns {undefined}
     */
    function fnBuscaLlamadasOperador(){
        $.ajax({
            url: "index.php?module=cont__centro_llamadas",
            type:\'POST\',
            data: {action:\'getReportLlamadasOperador\',input_type: "JSON", response_type: "JSON",to_pdf:true,fecha_desde:$(\'#txtFechaDesdeReport2\').val(),fecha_hasta:$(\'#txtFechaHastaReport2\').val()},
            dataType:\'json\',
            beforeSend:function(){
                $(\'#divBodyReport2\').html("");
                $(\'#divExport_2\').hide();
                $(\'#divPreloadReport2\').html("<img src=\'themes/default/images/bar_loader.gif\'/><br/>Cargando informaci&oacute;n...");
            },
            success: function(msg){
                $(\'#divExport_2\').show();
                $(\'#divPreloadReport2\').html("");
                if(msg!=null && msg.rows != null){
                    var str = "<table width=100% class=\'list view\'>";
                        if(msg.rows!=null && msg.rows.length>0){
                            $(msg.rows[0]).each(function(key,value){
                                var cont_o = 0;
                                var cont_ci = 1;
                                str += "    <tr>";
                                var value_22 = value;
                                for (key_2 in value) {
                                    if(key_2.indexOf(\'__opc\') > 0){
                                        if(cont_o > 0 && cont_o % 3 == 0){
                                            str += "    </tr>";
                                            cont_o = 0;
                                        }
                                        str += "    <th>";
                                        str += "        "+cont_ci+\'-\'+key_2.substring(0,key_2.indexOf(\'__opc\'));
                                        /*for (key_22 in value_22) {
                                            if(key_22.indexOf(\'__efectiva\') > 0){
                                                if(key_22.substring(0,key_22.indexOf(\'__efectiva\')) == 
                                                   key_2.substring(0,key_2.indexOf(\'__opc\'))     
                                                ){
                                            
                                                    str += "    <span style=\'border-style:solid;border-width:1px;width:50px;height;10px;background-color:#DCF9E4;\'>&nbsp;&nbsp;&nbsp;</span>";
                                                    break;
                                                }
                                            }
                                        }*/
                                        str += "    </th>";
                                        cont_ci ++;
                                        cont_o ++;
                                    }
                                }
                                str += "    </tr>";
                            });
                        }
                        str += "</table>";
                    str += "<table width=100% class=\'list view\'>";
                    if(msg.rows.length>0){
                        str += "<tr class=\'oddListRowS1\'>";
                        str += "    <th>Operador</th>";
                        str += "    <th>Llamadas</th>";
                        // recorremos las opc
                        cont_o = 1;
                        if(msg.rows!=null && msg.rows.length>0){
                            $(msg.rows[0]).each(function(key,value){
                                for (key_2 in value) {
                                    if(key_2.indexOf(\'__opc\') > 0){
                                        str += "    <th>"+cont_o+"</th>";
                                        cont_o++;
                                    }
                                }
                            });
                        }
                        str += "    <th>Efectivas</th>";
                        str += "    <th>Porcentaje %</th>";
                        str += "</tr>";
                        var t_1 = 0;
                        var t_2 = 0;
                        var t_3 = 0;
                        for(var i=0;i<msg.rows.length;i++){
                            t_1 = (t_1 + parseFloat(msg.rows[i].total_llamadas));
                            t_2 = (t_2 + parseFloat(msg.rows[i].total_llamadas_efectivas));
                            t_3 = (t_3 + parseFloat(msg.rows[i].porcentaje));
                            str += "<tr class=\'oddListRowS1\'>";
                            str += "    <td>"+msg.rows[i].name+"</td>";
                            str += "    <td>"+number_format(msg.rows[i].total_llamadas)+"</td>";
                            $(msg.rows[i]).each(function(key,value){
                                var value_22 = value;
                                for (key_2 in value) {
                                    if(key_2.indexOf(\'__opc\') > 0){
                                        var strb_k = \'\';
                                        /*for (key_22 in value_22) {
                                            if(key_22.indexOf(\'__efectiva\') > 0){
                                                if(key_22.substring(0,key_22.indexOf(\'__efectiva\')) == 
                                                   key_2.substring(0,key_2.indexOf(\'__opc\'))     
                                                ){
                                            
                                                    strb_k = \'background:#DCF9E4\';
                                                    break;
                                                }
                                            }
                                        }*/
                                        str += "    <td style=\'"+strb_k+"\'>"+(value[key_2]==0?\'\':value[key_2]);
                                        str += "    </td>";
                                    }
                                }
                            });
                            str += "    <td style=\'background:#DCF9E4;\'>"+number_format(msg.rows[i].total_llamadas_efectivas)+"</td>";
                            str += "    <td style=\'background:#DCF9E4;\'>"+number_format(msg.rows[i].porcentaje,2)+"</td>";
                            str += "</tr>";
                        }
                        str += "<tr class=\'oddListRowS1\'>";
                        str += "    <th>&nbsp;</th>";
                        str += "    <th>"+number_format(t_1)+"</th>";
                        if(msg.rows!=null && msg.rows.length>0){
                            $(msg.rows[0]).each(function(key,value){
                                for (key_2 in value) {
                                    if(key_2.indexOf(\'__opc\') > 0){
                                        str += "    <th>&nbsp;</th>";
                                    }
                                }
                            });
                        }
                        str += "    <th>"+number_format(t_2)+"</th>";
                        str += "    <th>&nbsp;</th>";
                        str += "</tr>";
                    }else{
                        str += "<tr><th>NO HAY DATOS PARA MOSTRAR</th></tr>";
                    }
                    str += "</table>";
                    $(\'#divBodyReport2\').html(str);
                }else{
                    alert("Error en el proceso");
                }
            }
        });
    }
    
    /**
     * 
     * @returns {undefined}
     */
    function fnBuscaLlamadasCliente(){
        $.ajax({
            url: "index.php?module=cont__centro_llamadas",
            type:\'POST\',
            data: {action:\'getReportLlamadasClientes\',input_type: "JSON", response_type: "JSON",to_pdf:true,fecha_desde:$(\'#txtFechaDesdeReport3\').val(),fecha_hasta:$(\'#txtFechaHastaReport3\').val()},
            dataType:\'json\',
            beforeSend:function(){
                $(\'#divBodyReport3\').html("");
                $(\'#divExport_3\').hide();
                $(\'#divPreloadReport3\').html("<img src=\'themes/default/images/bar_loader.gif\'/><br/>Cargando informaci&oacute;n...");
            },
            success: function(msg){
                $(\'#divExport_3\').show();
                $(\'#divPreloadReport3\').html("");
                if(msg!=null && msg.rows != null){
                    var str = "<table width=100% class=\'list view\'>";
                    if(msg.rows.length>0){
                        str += "<tr class=\'oddListRowS1\'>";
                        str += "    <th>Tienda</th>";
                        str += "    <th>Total</th>";
                        str += "    <th>Total rango fecha</th>";
                        str += "</tr>";
                        var t_1 = 0;
                        var t_2 = 0;
                        var t_3 = 0;
                        for(var i=0;i<msg.rows.length;i++){
                            t_1 = (t_1 + parseFloat(msg.rows[i].cantidad_clientes));
                            t_2 = (t_2 + parseFloat(msg.rows[i].total_en_rango));
                            str += "<tr class=\'oddListRowS1\'>";
                            str += "    <td>"+msg.rows[i].name+"</td>";
                            str += "    <td>"+number_format(msg.rows[i].cantidad_clientes)+"</td>";
                            str += "    <td>"+number_format(msg.rows[i].total_en_rango)+"</td>";
                            str += "</tr>";
                        }
                        str += "<tr id= class=\'oddListRowS1\'>";
                        str += "    <th>&nbsp;</th>";
                        str += "    <th>"+number_format(t_1)+"</th>";
                        str += "    <th>"+number_format(t_2)+"</th>";
                        str += "</tr>";
                    }else{
                        str += "<tr><th>NO HAY DATOS PARA MOSTRAR</th></tr>";
                    }
                    str += "</table>";
                    $(\'#divBodyReport3\').html(str);
                }else{
                    alert("Error en el proceso");
                }
            }
        });
    }
    
     function fnBuscaCampaniasCliente(){
        $.ajax({
            url: "index.php?module=cont__centro_llamadas",
            type:\'POST\',
            data: {action:\'getReportCampanasClientes\',input_type: "JSON", response_type: "JSON",to_pdf:true,  
                   fecha_desde:$(\'#txtFechaDesdeReport4\').val(),fecha_hasta:$(\'#txtFechaHastaReport4\').val(),
                   tipocontacto_c:$(\'#selTipoContacto1\').val(),frecuenciacontacto_c:$(\'#selFrecuencia\').val(),
                   tipoinformacionsm_c:$(\'#selTipoInformacion\').val()

                   
                   },
            dataType:\'json\',
            
            beforeSend:function(){
                $(\'#divBodyReport4\').html("");
                $(\'#divExport_4\').hide();
                $(\'#divPreloadReport4\').html("<img src=\'themes/default/images/bar_loader.gif\'/><br/>Cargando informaci&oacute;n...");
            },
            success: function(msg){
                
                $(\'#divExport_4\').show();
                $(\'#divPreloadReport4\').html("");
                if(msg!=null && msg.rows != null){
                    var str = "<table width=100% class=\'list view\'>";
                    if(msg.rows.length>0){
                        str += "<tr class=\'oddListRowS1\'>";
                        str += "    <th>Tienda</th>";
                        str += "    <th>Total</th>";
                        str += "    <th>Total  tipo </th>";
                        str += "    <th>Total  periodo</th>";
                        str += "    <th>Total  informacion</th>";
                        str += "</tr>";
                        var t_1 = 0;
                        var t_2 = 0;
                        var t_3 = 0;
                        var t_4 = 0;
                        var t_5 = 0;
                        var t_6 = 0;
                        for(var i=0;i<msg.rows.length;i++)
                        {
                            t_1 = (t_1 + parseFloat(msg.rows[i].cantidad_clientes));
                            //t_2 = (t_2 + parseFloat(msg.rows[i].total_en_fecha));
                            t_4 = (t_4 + parseFloat(msg.rows[i].total_en_tipo));
                            t_5 = (t_5 + parseFloat(msg.rows[i].total_en_periodo));
                            t_6 = (t_6 + parseFloat(msg.rows[i].total_en_informacion));
                            str += "<tr class=\'oddListRowS1\'>";
                            str += "    <td>"+msg.rows[i].name+"</td>";
                            str += "    <td>"+number_format(msg.rows[i].cantidad_clientes)+"</td>";
                            //str += "    <td>"+number_format(msg.rows[i].total_en_fecha)+"</td>";
                            str += "    <td>"+number_format(msg.rows[i].total_en_tipo)+"</td>";
                            str += "    <td>"+number_format(msg.rows[i].total_en_periodo)+"</td>";
                            str += "    <td>"+number_format(msg.rows[i].total_en_informacion)+"</td>";
                            str += "</tr>";
                        }
                        str += "<tr id= class=\'oddListRowS1\'>";
                        str += "    <th>&nbsp;</th>";
                        str += "    <th>"+number_format(t_1)+"</th>";
                        //str += "    <th>"+number_format(t_2)+"</th>";
                        str += "    <th>"+number_format(t_4)+"</th>";
                        str += "    <th>"+number_format(t_5)+"</th>";
                        str += "    <th>"+number_format(t_6)+"</th>";
                        str += "</tr>";
                    }else{
                        str += "<tr><th>NO HAY DATOS PARA MOSTRAR</th></tr>";
                    }
                    str += "</table>";
                    $(\'#divBodyReport4\').html(str);
                }else{
                    alert("Error en el proceso");
                }
                
            }
        });
    }





    
    function fnExportDoc(tipo,divnum){
        var action = null;
        if(divnum == 1){
            action = "getReportLlamadasTienda";
        }
        else{
            if(divnum == 2){
                action = "getReportLlamadasOperador";
            }
            else{
                if(divnum == 3){
                    action = "getReportLlamadasClientes";
                }
                else{
                if(divnum == 4){
                    action = "getReportCampanasClientes";
                }
                else{
                    if(divnum == 5){
                    action = "buscarcontactos";
                    tiendalist=$("#dataListTiendas").val();
                    tienda=tiendalist.split("/");
                    }

                }
              }
            }


        }

        


            
        $.ajax({
            url: "index.php?module=cont__centro_llamadas",
            type:\'POST\',
            data: {action:action,tipo:tipo,input_type: "JSON", response_type: "JSON",to_pdf:true,fecha_desde:$(\'#txtFechaDesdeReport\'+divnum).val(),fecha_hasta:$(\'#txtFechaHastaReport\'+divnum).val(),tipocontacto_c:$(\'#selTipoContacto1\').val(),
                frecuenciacontacto_c:$(\'#selFrecuencia\').val(),tipoinformacionsm_c:$(\'#selTipoInformacion\').val(),tienda : tienda[0],
                    cumple : $("#dataListMes").val(),
                    fecha_1 : $("#fechaInicial").val(),
                    fecha_2 : $("#fechaFinal").val()
                    
                 

                 },
            dataType:\'json\',
            beforeSend:function(){
                $(\'#divPreloadReport\'+divnum).html("<img src=\'themes/default/images/bar_loader.gif\'/><br/>Generando archivo...");
            },
            success: function(msg){
                $(\'#divPreloadReport\'+divnum).html("");
                
                if(msg.archivo_url != null){
                    window.open(msg.archivo_url,\'_blank\');
                }else{
                    alert("Error en el proceso");
                }
            }
        });
    }
    
    function fnEditInlineField(){
        // set opc
        $(\'#selOpciones\').val(\'ef2cb3bd-2798-c655-3b2f-55f265e2aff4\');
        // hidden field
        if($(\'#spnFirstName\').is(\':visible\')){
            $(\'#spnFirstName,#spnTelCasa,#spnTelCelu,#spnTelTrabajo,#spnTienda,#spnVip,#spnCumples,#spnEmailP,#spnCedula,#spnFrecuenciaContacto,#spnTipoContacto,#spnTipoInformacionNormal,#spnTipoInformacionMultiple\').hide();
            $(\'#txtFirstName,#txtTelCasa,#txtTelCelu,#txtTelTrabajo,#selTienda,#selVip,#divCumples,#txtEmailP,#txtCedula,#selFrecuenciaContacto,#selTipoContacto,#selTipoInformacionNormal,#selTipoInformacionMultiple\').show();
        }else{
            $(\'#spnFirstName,#spnTelCasa,#spnTelCelu,#spnTelTrabajo,#spnTienda,#spnVip,#spnCumples,#spnEmailP,#spnCedula,#spnFrecuenciaContacto,#spnTipoContacto,#spnTipoInformacionNormal,#spnTipoInformacionMultiple\').show();
            $(\'#txtFirstName,#txtTelCasa,#txtTelCelu,#txtTelTrabajo,#selTienda,#selVip,#divCumples,#txtEmailP,#txtCedula,#selFrecuenciaContacto,#selTipoContacto,#selTipoInformacionNormal,#selTipoInformacionMultiple\').hide();
        }
    }
    '; ?>

</script>