<?php use_helper('UrlFunctions'); ?>

<?php

if($control){//cuando se hizo el submit
 
  if(is_array($tipoMercado)){
 
  $o_SucursalBean = new SucursalBean();
  
  $o_SucursalBean->setIdSucursal($id);
  $o_SucursalBean->setDescripcion($Descripcion);
  $o_SucursalBean->setDireccion($Direccion);
  $o_SucursalBean->setEstado($cboEstado);
  $o_SucursalBean->setTelefono($Telefono);
  $o_SucursalBean->setEliminado($Eliminado);
  $o_SucursalBean->setIdAdministrador($cboEmpleado);
  $o_SucursalBean->setfechaInicioBalance($fechaInicioBalance);
  $o_SucursalBean->setFechaSaldoIni($FechaSaldoIni);
  $o_SucursalBean->setSaldoDisponibleIni($SaldoDisponibleIni);
  
  $o_SucursalBean->setfechaInicioBalance($fechaInicioBalance);
  
  $o_SucursalBean->setFechaCreacion(date("Y-m-d"));
  $o_SucursalBean->setUsuarioCreacion(myUser::getUser()->getUserId());
  
  while(list($key,$val_tipo)=each($tipoMercado)){
   
    switch ($val_tipo){
      	case "mer":
      		
            $o_SucursalMercadoBean = new SucursalMercadoBean();
            $o_SucursalMercadoBean -> setIdSucursal($id);
            
            $o_MercadoBean 			= new MercadoBean();
            $o_MercadoBean->setIdMercado($IdMercado[$key]);
            $o_MercadoBL 			= new MercadoBL();
            $a_ObjectMercadoBean 	= $o_MercadoBL->busquedaMercado($o_MercadoBean);
                   
            $o_SucursalMercadoBean->setIdMercado($a_ObjectMercadoBean[0]->getIdMercado());
            $o_SucursalMercadoBean->setFechaAsignacion(date("Y-m-d H:i:s"));
            $o_SucursalMercadoBean->setUsuarioAsignacion(myUser::getUser()->getUserId());
            
            if($li[$key] && $a_ObjectMercadoBean[0]->getIdMercado() == $li[$key]){    
              $o_SucursalMercadoBean->setFechaAsignacion(date("Y-m-d"));
              $a_concatResultAUpd[] = $o_SucursalMercadoBean;
            }else{
              $o_SucursalMercadoBean->setUsuarioAsignacion(myUser::getUser()->getUserId());
              $o_SucursalMercadoBean->setFechaAsignacion(date("Y-m-d"));
              $a_concatResultA[] = $o_SucursalMercadoBean;
            }

            break;

      }
    }
    
     $o_SucursalBean->setArraySucMercadoAct($a_concatResultAUpd);
     $o_SucursalBean->setArraySucMercado($a_concatResultA);
    

    $o_SucursalSystemClass = new SucursalSystemClass($o_SucursalBean);
    
    $bResult = $o_SucursalSystemClass->modificarSucursal();
  
    if($bResult){
    	if($cboEmpleadoAnte != $cboEmpleado){
  			$o_Colaborador = new ColaboradorBean();
  			$o_Colaborador->setIdPadre($cboEmpleado);
  			$o_Colaborador->setIdPadreAnterior($cboEmpleadoAnte);
  			$o_ColaboradorDP = new ColaboradorDP($o_Colaborador);
  			$o_ColaboradorDP->CambioAdministrador();
	   }
    ?>
      <script language="JavaScript">
     	 parent.objMainTab.reqBody('<?=buildUrl('suc/'.$typeSubmit)?>','&block=001&insert=1&cod=<?=$o_SucursalBean->getIdSucursal()?>');
      </script>
    <?
    }
       
  }
  
  
}

if($id){

  $o_SucursalBean = new SucursalBean();
  $o_SucursalBean->setIdSucursal($id);
  $o_SucursalBL = new SucursalBL();
  $o_SucursalBean = $o_SucursalBL->busquedaSucursalDetalles($o_SucursalBean);
  $a_SucursalMercado = $o_SucursalBean->getArraySucMercado();
  
} 


$o_ColaboradorBean = new ColaboradorBean();
$o_ColaboradorBean->setFiltroColaborador(array(0 =>'sys.res'));
$o_SucursalSystemClass = new SucursalSystemClass($o_ColaboradorBean);
$a_Colaborador = $o_SucursalSystemClass->getColaborador();	
 
?>

<script>
validateControls = function(){
  var errOutput               = { error:false, msg:"" };
  
  //var valueTipo               = $('cboTipoInv'); 
  var valueDescripcion             = $('Descripcion');
  //var valueClave              = $('txtClave');
  
  //var valueFechaPublicacion   = $('FechaPublicacion');
  var valueDireccion      = $('Direccion');
  
  if(valueDescripcion.value == ""){
    errOutput.error = true;
    errOutput.msg   += "Debe de digitar el Sucursal.\n";
  }
  if(valueDireccion.value == ""){
    errOutput.error = true;
    errOutput.msg   += "Debe de digitar la Direccion.\n";
  }
  /*if(valueClave.value == ""){
    errOutput.error = true;
    errOutput.msg   += "Debe de digitar la clave.\n";
  }*/
  
  /*if(valueFechaPublicacion.value == ""){
    errOutput.error = true;
    errOutput.msg   += "Debe de ingresar la fecha de publicacion.\n";
  }*/
  /*if(valueFin.value == ""){
    errOutput.error = true;
    errOutput.msg   += "Debe de ingresar la fecha de recepcion.\n";
  }*/
  
  return errOutput;
}
</script>

<script type="text/javascript" src="<?php echo Constantes::ROOT_DIR_APP?>/web/js/objectForm.js"></script>

<script type="text/javascript">
  validatePass = function(){
    valid.onSubmit = false;
  }
</script>

<script>

acutalizarEspecialidad = function(destino,elm){
  $(destino).options.length = 1;
  var url = '<?=buildUrlComplet('mnt.php/ajax/request')?>';
  var pars = 'type=getEspecialidad&nombreElm='+destino+'&value='+elm.value;
  
	var myAjax = new Ajax.Request(
                            		url, 
                            		{
                            			method: 'get', 
                            			parameters: pars, 
                            			onComplete: actualizaJSON
                            		});
}

</script>


<!--
<script>
validateControls = function(){
  var errOutput         = { error:false, msg:"" };

  return errOutput;
}
</script>-->

<script>
actualizarElementos = function(elmValue, elmDestino,type){
  var url = '<?=buildUrl('ajax/request')?>';
  var pars = 'type=NombreMercado&typeFind='+type+'&nombreElm='+elmDestino+'&value='+elmValue;
  	
	var myAjax = new Ajax.Request(
                            		url, 
                            		{
                            			method: 'get', 
                            			parameters: pars, 
                            			onComplete: actualizaJSON
                            		});
}
</script>
<script>
actualizaJSON = function(request, json){
  var numeroElementos = json.length;
  for (var i = 0; i < numeroElementos; i++){
    if($(json[i][0])){
  	  switch ($(json[i][0]).tagName){
  	    case 'TD'      : Element.update(json[i][0], json[i][1]); break;
  	    case 'INPUT'   : $(json[i][0]).value=json[i][1]; break;
  	    case 'SELECT'  : 
  	      var objDDL = $(json[i][0]);
  	      if(typeof(cont) == 'undefined'){
  	        var cont = 0;
  	        objDDL.options.length = 1;
  	      }
  	      var a_contentValues = json[i][1].split("_;_");
      		var value	= a_contentValues[0];
      		var text	= a_contentValues[1];
  	      var option	= new Option(text,value,'selected');
      		try{
      			objDDL.add(option,null);
      		}catch (e){
      			objDDL.add(option,-1);
      		}
  	      cont++;
  	    break;
  	  }
    }else{
      if(json[i][0].indexOf("function") > -1){
        eval("scriptEval = "+json[i][0]);
        scriptEval();
      }
    }
  }
}
</script>


<script>
insertOptionDefault = function(){
  
  var table = $('tableContent');
  var countRows = table.rows.length;
  
  var tr = table.rows[countRows-1];
  var td = tr.cells[1];
  var idSelect = td.firstChild.id;
  
  values = [[idSelect,'mer_;_Mercado']];
  
  actualizaJSON('', values);
  
}
</script>

<script>
events = function(type){
  oReturn = validateControls();
  if(!oReturn.error){
    switch (type){
      case 'submit':
        if(grid.getCountRows() > 1){
          if(grid.validateRows()){
            disabledWin.show(true,true,'idGrid')
            $('form1').submit();
          }else{
            alert("Verifique el formulario.");
          }
        }else{
          elementLoad.show(undefined,'&nbsp;&nbsp;&nbsp;Tiene que Ingresar detalles.'); setTimeout('elementLoad.hide()',3000);
        }
      break;
      case 'insert':
        grid.insert();
        insertOptionDefault();
      break;
      case 'delete':
        grid.deletes();
      break;
    }
  }else{
    alert(oReturn.msg);
    return false;
  }
}
</script>

<script>
buscaDetalle = function(e,elm){
  
  var charCode;
  if (navigator.appName == "Mozilla" || navigator.appName == "Netscape"){
    charCode = e.keyCode;
  }else{
    charCode = event.keyCode;
  }
  if (charCode == 114){
    
    var parentTr      = elm.parentNode.parentNode.id;
    var valueSelect   = $(parentTr + "_td_1_tipoMercado[]").value;
    var url           = "";
    
    if(valueSelect != ""){
    	
      switch (valueSelect){
        case 'mer':
          url = '<?=buildUrlComplet('mnt.php/mer/listFind')?>iframe/contentResultxx/nameElm/'+elm.id+'/value/'+elm.value;
          tit = 'Mercado';
        break;
        /*case 'alm':
          url = '<?=buildUrlComplet('mnt.php/alm/listFind')?>iframe/contentResultxx/nameElm/'+elm.id+'/value/'+elm.value;
          tit = 'Alumno';
        break;
        case 'ext':
          url = '<?=buildUrlComplet('mnt.php/ext/listFind')?>iframe/contentResultxx/nameElm/'+elm.id+'/value/'+elm.value;
          tit = 'Externo';
        break;*/
      }
      parent.objMainTab.modalDialog(url,{title:'Busqueda de '+ tit,width:600,height:420});
    }else{
      elementLoad.show(undefined,'&nbsp;&nbsp;&nbsp;Seleccione el tipo para el ListFind.'); setTimeout('elementLoad.hide()', 1000);
    }
  }
}
</script>

<script>
actionSelect = function(elm){
  
  var parentTr      = elm.parentNode.parentNode.id;
  
  $(parentTr + "_td_2_IdMercado[]").value = "";
  $(parentTr + "_td_3").innerHTML = "&nbsp;";
 
}

actionCod = function(elm){
  //alert("Hola");
  elm       = $(elm);
  elm.value = elm.value.trim();
  var elmValue = elm.value;
  
  parentTr = elm.parentNode.parentNode.id;
  
  elmDestino = parentTr + "_td_3";
  
  if(elmValue != ""){
    
    if(!grid.validateByColumn(2, elm, 'INPUT')){
    
      var parentTr      = elm.parentNode.parentNode.id;
      var valueSelect   = $(parentTr + "_td_1_tipoMercado[]").value;
      
      $(elmDestino).innerHTML = "&nbsp;";
      formItem.loadProcess(parentTr + "_td_3");
      actualizarElementos(elmValue, elmDestino, valueSelect);
      
    }else{
      
      elm.value = "";
      elementLoad.show(undefined,'&nbsp;&nbsp;&nbsp;El Mercado ya fue Ingresado'); setTimeout('elementLoad.hide()', 1000);
      $(elmDestino).innerHTML = "&nbsp;";
      
    }
    
  }
  
}
</script>

<script type="text/javascript">
tinyMCE.init({

//mode : "textareas",

theme : "advanced",

elements : "txtTitulo",

theme_advanced_toolbar_align : "left",

theme_advanced_toolbar_location : "top"



});

</script>

<table class="cuerpo" width="98%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td height="0">
      <table border="0" cellpadding="0" cellspacing="0" width="100%">
        <tr>
          <td class="titleBody">
            <li>Sucursal</li>
            <span class="subtitle"><I>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:::&nbsp;Ficha del Sucursal</I></span></td>
          <td align="right" valign="baseline">&nbsp;</td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td valign="top">
      <form id="form1" name="form1" method="POST" onsubmit="validatePass();" >
      <input type="hidden" name="control" value="1">
      <input type="hidden" name="id" id="id" value="<?=$id?>">
       <!-- <input type="hidden" name="txtivnid" id="txtivnid"> -->
      <fieldset>
       <legend class="fielsettex"><I>Datos Generales</I></legend>
			
      <table   width="100%" class="marco" style="background: #E3E9E2">
        <tr>
          <td valign="top">
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="50%" height="80" valign="top"><table height="80" border="0" cellpadding="0" cellspacing="2" class="SubCabecera">
                    
                     <tr>
  					   <td nowrap="nowrap" width="10%" class="cabecera"><label class="label req" for="txtDescripcion" >Sucursal</label></td>
  					   <td nowrap="nowrap"><input name="Descripcion" id="Descripcion" size="35" type="text" class="text" value="<?php echo $o_SucursalBean->getDescripcion()?>"/></td>
  						<td nowrap="nowrap" width="8%" class="cabecera">&nbsp;</td>
                  		<td nowrap="nowrap" width="10%" class="cabecera"><label class="label req" for="txtTelefono" >Teléfono</label></td>
                  		<td nowrap="nowrap"><input name="Telefono" id="Telefono" size="10" type="text" class="text" value="<?php echo $o_SucursalBean->getTelefono()?>"/></td>
  						
				   </tr>
				   <tr>
                        <td colspan="5">&nbsp;</td>
                     </tr>
				   <tr>
				     <td nowrap="nowrap" width="10%" class="cabecera"><label class="label" for="txtDireccion">Direcci&oacute;n</label></td>
  					 <td nowrap="nowrap" ><textarea  name="Direccion" id="Direccion" cols="32" rows="2"><?php echo $o_SucursalBean->getDireccion()?></textarea></td>
  					 <td nowrap="nowrap" width="8%" class="cabecera">&nbsp;</td>
  					  <td nowrap="nowrap" width="10%" class="cabecera"><label class="label req" for="txtEstado" >Estado</label></td>
					  <td nowrap="nowrap" width="38%">
					   <select name="cboEstado" id="cboEstado" type="text" class="combo"/> 
						 <option value="" >Selecione</option>
						 <option value="A" <?php  if($o_SucursalBean->getEstado() == 'A') echo "selected='selected'"?>>Activo</option>
						  <option value="I" <?php  if($o_SucursalBean->getEstado() == 'I') echo "selected='selected'"?>>Inactivo</option>
					   </select>
					 </td>
				   </tr>
				   <tr>
				   <td nowrap="nowrap" width="10%" class="cabecera"><label class="label req" for="txtFechaInicio" >F. Balance Ini</label></td>
  				   <td nowrap="nowrap"><input class="text"  readonly  type="text" name="fechaInicioBalance" id="fechaInicioBalance"  maxlength="10" size="8" value="<?php echo $o_SucursalBean->getfechaInicioBalance()?>" ondblclick="this.value=''"/><button type="button" onclick="return false" id="btnfechaInicioBalance">...</button></td>
					 <script type="text/javascript">
					 document.getElementById("btnfechaInicioBalance").disabled = false;
					 Calendar.setup({
					 inputField : "fechaInicioBalance",
					 ifFormat : "%Y-%m-%d",
					 daFormat : "%Y-%m-%d",
					 button   : "btnfechaInicioBalance"
					});
				  </script>
				  
					<td nowrap="nowrap" width="8%" class="cabecera">&nbsp;</td>
				   	<td width="10%" nowrap="nowrap" class="cabecera"><label class="label req" for="txtSueldo" >Administrador</label></td>
                    <td nowrap="nowrap"><select class="combo validate-selection " name="cboEmpleado" id="cboEmpleado">
		              <option value="" > - Seleccionar - </option>
		               <?php foreach ($a_Colaborador as $iKey => $o_ColaboradorBean){ ?>
		               <option value="<?=$o_ColaboradorBean->getIdColaborador()?>" <?php if($o_ColaboradorBean->getIdColaborador() == $o_SucursalBean->getIdAdministrador() ) echo " SELECTED "?>>
		               <?=$o_ColaboradorBean->getNombreCompleto()?>
		               </option>
		               <?php } ?>
		               </select>
                 	  </td>
                 	  <input type="hidden" name = "cboEmpleadoAnte" id = "cboEmpleadoAnte"  value="<?php echo $o_SucursalBean->getIdAdministrador()?>">
                    </tr>
                    <tr>
	                   <td nowrap="nowrap" width="10%" class="cabecera"><label class="label req" for="txtFechaInicio" >F. Saldo Ini</label></td>
	  				   <td nowrap="nowrap"><input class="text"  readonly  type="text" name="FechaSaldoIni" id="FechaSaldoIni"  maxlength="10" size="8" value="<?php echo $o_SucursalBean->getFechaSaldoIni()?>" ondblclick="this.value=''"/><button type="button" onclick="return false" id="btnFechaSaldoIni">...</button></td>
						 <script type="text/javascript">
						 document.getElementById("btnFechaSaldoIni").disabled = false;
						 Calendar.setup({
						 inputField : "FechaSaldoIni",
						 ifFormat : "%Y-%m-%d",
						 daFormat : "%Y-%m-%d",
						 button   : "btnFechaSaldoIni"
						});
					  </script>
                    </tr>
                     <tr>
  					   <td nowrap="nowrap" width="10%" class="cabecera"><label class="label req" for="txtDescripcion" >Saldo Disponible</label></td>
  					   <td nowrap="nowrap"><input name="SaldoDisponibleIni" id="SaldoDisponibleIni" size="10" type="text" class="text" value="<?php echo $o_SucursalBean->getSaldoDisponibleIni()?>"/></td>
  					   <td nowrap="nowrap" width="8%" class="cabecera">&nbsp;</td>
				    </tr>
                </table>
                </td>
              </tr>
            </table>
            <br>
            </form>
            
                  <table width="100%" height="200" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td valign="top" id="contentDetail">
                        <table width="100%" border="0" cellspacing="0" cellpadding="0">
                          <tr>
                            <td>
                              <table border="0" cellspacing="0" cellpadding="0" width="100%">
                                <tr>
                                  <td class="tabSpace">&nbsp;</td>
                                  <td class="ssTab ssTabAct" id="ttab1" onclick=";" nowrap="nowrap">Mercados</td>
                                  <td class="tabSpace">&nbsp;</td>
                                  <td width="100%" class="tabSpace">&nbsp;</td>
                                </tr>
                              </table>
                            </td>
                          </tr>
                          <tr>
                            <td class="marcoTab">
                              <div id="tab1">
                                <table class="SubDetalle" width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
                                  <tr>
                                    <td valign="top">
                                      <table width="100%" border="0" cellpadding="5" cellspacing="0">
                                        <tr>
                                          <td height="0">&nbsp;</td>
                                        </tr>
                                        <tr>
                                          <td align="left">
                                            <table class="marco" border="0" cellpadding="0" cellspacing="0" width="100%">
                                              <tr>
                                                <td>
                                                  <table class="grid" id="tableContent" width="100%" border="0" cellpadding="0" cellspacing="0">
                                                    <tbody id="idGrid">
                                                      <tr height="23">
                                                        <th width="5%" nowrap="nowrap">Nro</th>
                                                        <th width="15%" nowrap="nowrap">Tipo</th>
                                                        <th width="15%" nowrap="nowrap">Código</th>
                                                        <th width="55%" nowrap="nowrap" align="left">Descripción</th>
                                                          <?
	                                                      $i = 0;
	                                                      foreach ($a_SucursalMercado as $iKey => $o_SucMercado){ 
	                                                       $i++; ?>
	                                                      <tr 
	                                                         id="idGrid_tr_<?=$i?>" 
	                                                         onmouseout  ="JavaScript:formItem.loadEngine('grid','leaveHover','idGrid_tr_<?=$i?>')" 
	                                                         onmouseover ="JavaScript:formItem.loadEngine('grid','enterHover','idGrid_tr_<?=$i?>')" 
	                                                         ondblclick  ="JavaScript:formItem.loadEngine('grid','rowSelect','idGrid_tr_<?=$i?>')" style="background-color: rgb(255, 255, 255);"
	                                                      >
                                                         <td id="idGrid_tr_<?=$i?>_td_0" align="center" code="count"><?=$i?></td>
                                                         <td id="idGrid_tr_<?=$i?>_td_1" align="center" code="tipoMercado[]">
                                                                  <select 
                                                                  onclick   = "" 
                                                                  onkeyup   = "" 
                                                                  
                                                                  id        = "idGrid_tr_<?=$i?>_td_1_tipoMercado[]" 
                                                                  name      = "tipoMercado[]" 
                                                                  code      = "tipoMercado[]"
                                                                  >
                                                                 
                                                                  <option value="mer" selected > Mercado&nbsp;</option>
                                                                 
                                                                  </select>
                                                                
                                                        </td>
                                                        <td id="idGrid_tr_<?=$i?>_td_2" align="center" code="IdMercado[]"><input 
                                                                  type      = "text" 
                                                                  onclick   = "" 
                                                                  onkeyup   = "" 
                                                                  style     = "text-align: center;" 
                                                                  onkeydown = "buscaDetalle(event,this);" 
                                                                  onfocus   = "this.select();" 
                                                                  onblur    = "actionCod(this);" 
                                                                  class     = "text mayus" 
                                                                  size      = "8" 
                                                                  id        = "idGrid_tr_<?=$i?>_td_2_IdMercado[]" 
                                                                  name      = "IdMercado[]" 
                                                                  code      = "IdMercado[]"
                                                                  value     = "<?php $array_objeto = $o_SucMercado->getObjectMercado(); echo sprintf('%06d',$array_objeto[0]->getIdMercado())?>"/>
                                                        </td>
                                                        <td align="left" id="idGrid_tr_<?=$i?>_td_3"><?=$array_objeto[0]->getDescripcion()?>
                                                       <input type="hidden" name="li[]" value="<?=$array_objeto[0]->getIdMercado()?>"></td>
                                                       </tr>
                                                      <? } ?> 
                                                      </tr>
                                                    </tbody>
                                                  </table>
                                                </td>
                                              </tr>
                                            </table>
                                            <input class="button" name="bten" type="button" value="Agregar Mercado" onclick="/*grid.insert();*/ events('insert');" />
                                            <input class="button" name="bten3" type="button" value="Borrar" onclick="/*grid.deletes();*/ events('delete');"/>
                                          </td>
                                        </tr>
                                      </table>
                                    </td>
                                  </tr>
                                </table>
                              </div>
                            </td>
                          </tr>
                        </table>
                      </td>
                    </tr>
                  </table>
                  <div align="right">
                  <input type="hidden" name="typeSubmit" id="typeSubmit" onkeyup="">
                  <input class="button" type="button" value="Grabar" onclick="$('typeSubmit').value='list'; events('submit');"/>
                  <input class="button" type="button" value="Cancelar" onclick="parent.objMainTab.reqBody('<?=buildUrl('suc/list')?>','001')" />
                  </div>
          </td>
        </tr>
       </table>
       </fieldset>

    </td>
  </tr>
</table>


<script type="text/javascript">
	function formCallback(result, form) {
		window.status = "valiation callback for form '" + form.id + "': result = " + result;
	}
	var valid = new Validation('form1', {immediate : true});
</script>


<script>
//----------------------------------------------------------------------------------------//
var grid = new formItem("idGrid",{objInstance:'grid'});
//se especifica q caracteristicas tendra cada celda
grid.options.data = ['s', 'SelectView', 'iText', 's', 'iText'];
//alineacion de cada linea
grid.options.alignTd = ['center', 'center', 'center', 'left', 'center'];
//valor por defecto solo para movimiento
var attributes = [];
attributes[1]  = {'class':'', onblur:"", onChange:"actionSelect(this);", style:""};
attributes[2]  = {size:"8", 'class':'text mayus', onfocus:"this.select();", style:"text-align:center;", onblur:"actionCod(this);", onkeydown:"buscaDetalle(event,this);"};
//attributes[4]  = {size:"5", 'class':'text mayus', onfocus:"this.select();", style:"text-align:center;"};
grid.options.attribute = attributes;
//nombre de las variables a retornar
var namesVar = [];
namesVar[0] = "count";
namesVar[1] = "tipoMercado[]";
namesVar[2] = "IdMercado[]";
//namesVar[4] = "part[]";
grid.options.varOutput = namesVar;
//debe de validar antes de insertar y se reutiliza para grabar
grid.options.rowValidate = [2,3];
//----------------------------------------------------------------------------------------//
</script>
