<?php
//include "clase.conexion.php";
class clsAvanceVendedores extends clsConexion{
	public $varTitulo 	= "AVANCE DE VENTAS POR VENDEDORES";
	function FormuBusqueda() {
		$sqlmes = "call spQuery_Combo_CuotaVenta_Mes('Ninguno');";
		$sqanio = "call spQuery_Combo_CuotaVenta_Anio();";
		$sqltip	= array("R"=>"REPORTE RESUMIDO", "D"=>"REPORTE DETALLADO");
		$varTabla=array("id"=>"tabla", "name"=>"table", "tamano"=>"470", "clase"=>"Formtitulo", "titulo"=>$this->varTitulo,
						"formu"=>array("id"=>"form", "name"=>"form", "metodo"=>"POST", "onsubmit"=>"return false;"),						
						"ocult"=>array(array("tipo"=>"oculto", "id"=>"titu", "name"=>"titu", "valor"=>$this->varTitulo)
									  ),
						"conte"=>array(array("titulo"=>"Empresa :", "clase1"=>"FormCampo1", "clase2"=>"interior",
											 "campo"=>array("tipo"=>"varios",
															"contenido"=>array(array("tipo"=>"text", "id"=>"ecod", "name"=>"ecod", "valor"=>NULL, 
																					 "ancho"=>"50", "alinear"=>"center", 
																					 "blur"=>"xajax_seleccionar_empresa(this.value)", 
																					 "dclick"=>"fn_cargar_listado_empresa('ecod', 'enom')"),
																			   array("tipo"=>"text", "id"=>"enom", "name"=>"enom", "valor"=>NULL, 
																					 "ancho"=>"250", "clase"=>"inputDisable", "locked"=>"SI")
																			   )
															)
											 ),
									   array("titulo"=>"Periodo Cuota :", "clase1"=>"FormCampo1", "clase2"=>"interior",
										     "campo"=>array("tipo"=>"varios",
														    "contenido"=>array(array("tipo"=>"select", "id"=>"anio", "name"=>"anio", "valor"=>NULL,
																				     "sql"=>$sqanio, "sincod"=>"SI", "titulo"=>"--[[ANIO]]--",
																				     "ancho"=>"83", "reload"=>"xajax_comboMesMetas(this.value)"),
																			   array("tipo"=>"select", "id"=>"mes", "name"=>"mes", "valor"=>NULL, 
																			   		 "div"=>"divMes","sql"=>$sqlmes, "titulo"=>"--[[ MES ]]--",
																					 "ancho"=>"160")
																			   )
														   )
										    ),
									   array("titulo"=>"Fecha Inicio :", "clase1"=>"FormCampo1", "clase2"=>"interior",
											 "campo"=>array("tipo"=>"varios",
															"contenido"=>array(array("tipo"=>"texto", "id"=>"fini", "name"=>"fini", "alinear"=>"center",
																					 "ancho"=>"130", "valor"=>date("01/m/Y",time()))
																			   )
														 	)
											 ),
									   array("titulo"=>"Fecha Fin :", "clase1"=>"FormCampo1", "clase2"=>"interior",
											 "campo"=>array("tipo"=>"varios",
															"contenido"=>array(array("tipo"=>"texto", "id"=>"ffin", "name"=>"ffin", "alinear"=>"center", 
																					 "ancho"=>"130", "valor"=>date("d/m/Y",time()))
																			   )
														 	)
											 ),
									   array("titulo"=>"Proveedor :", "clase1"=>"FormCampo1", "clase2"=>"interior",
										     "campo"=>array("tipo"=>"varios",
														    "contenido"=>array(array("tipo"=>"text", "id"=>"pcod", "name"=>"pcod", "valor"=>$varPCOD, 
																					 "ancho"=>"50",  "alinear"=>"center", 
																					 "blur"=>"xajax_seleccionar_proveedor('PR',this.value)", 
																					 "dclick"=>"fn_cargar_listado_proveedor('pcod', 'pnom','PR')"),
																			   array("tipo"=>"text", "id"=>"pnom", "name"=>"pnom", "valor"=>$varPNOM, 
																			   		 "ancho"=>"250", "clase"=>"inputDisable", "locked"=>"SI")
																			   )
														 )
										  	 ),
									   array("titulo"=>"Tipo Reporte :", "clase1"=>"FormCampo1", "clase2"=>"interior", 
											 "campo"=>array("tipo"=>"select_simple", "id"=>"tip", "name"=>"tip", 
											 				"combo"=>array("sql"=>$sqltip, "ancho"=>"150"))),
									   ),
						"boton"=>array(array("tipo"=>"submit", "id"=>"bcon", "name"=>"bcon", "ancho"=>"100", "texto"=>"Buscar",
					  					   "clase"=>"boton_buscar", "click"=>"javascript:xBuscarJS()"),
									 array("tipo"=>"button", "id"=>"bexp", "name"=>"bexp", "ancho"=>"100", "texto"=>"Exportar",
									 	   "clase"=>"boton_exportar", "click"=>"javascript:xExportarJS()"),								
									 array("tipo"=>"button", "id"=>"bimp", "name"=>"bimp", "ancho"=>"100", "texto"=>"Imprimir", 
										   "clase"=>"boton_imprimir", "click"=>"javascript:xImprimirJS('', 'NEW')"),
									 )
						);
		return $this->setTablaForm($varTabla);
		}
 	function GridDatos($varForm = NULL
					   )  {						  
		$varFIni = ($varForm["fini"]=="")?"NULL":"'".FechaMySql($varForm["fini"])."'";
		$varFFin = ($varForm["ffin"]=="")?"NULL":"'".FechaMySql($varForm["ffin"])."'";
		$varPro  = ($varForm["pcod"]=="")?"NULL":$varForm["pcod"];
		if($varForm["tip"]=="R") {
			$sql = "call spQuery_Avance_Ventas_Vendedor($varForm[ecod], '$varForm[anio]', '$varForm[mes]', $varPro, $varFIni, $varFFin);";
			$varTabla=array("id"=>"theTable", "name"=>"theTable", "tamano"=>"700", "sql_cab"=>$sql,	"pages"=>100,
							"conte"=>array(array("tamano"=>20, "titulo"=>"CVEN", "alinear"=>"center"),
										   array("tamano"=>200,"titulo"=>"VENDEDOR", "fijo"=>"SI", "funcion"=>array("contar")),										  
										   array("tamano"=>70, "titulo"=>"CUOTA", "alinear"=>"right", "funcion"=>array("autosuma")),
										   array("tamano"=>70, "titulo"=>"VENTA", "alinear"=>"right", "funcion"=>array("autosuma")),
										   array("tamano"=>70, "titulo"=>"AVANCE %", "alinear"=>"right", "funcion"=>array("porc","3","2"), "tipodat"=>"porc"),
										   array("tamano"=>70, "titulo"=>"NEC.DIA.", "alinear"=>"right", "funcion"=>array("autosuma")),
										   array("tamano"=>70, "titulo"=>"TEND.", "alinear"=>"right", "funcion"=>array("autosuma")),
										   array("tamano"=>70, "titulo"=>"TEND. %", "alinear"=>"right", "funcion"=>array("porc","6","2"), "tipodat"=>"porc"),
										   )
							);
			$varReturn = $this->SetGridTabla($varTabla);
			}
		else {
			$sql = "call spQuery_Avance_Ventas_Vendedor_Max($varForm[ecod], '$varForm[anio]', '$varForm[mes]', $varPro, $varFIni, $varFFin);";
			$varCab = array(array("cab"=>"PREVENTA GENERAL", "det"=>array("PREV","PEDID","PDV")),
							array("cab"=>"VENTA EFECTIVA", "det"=>array("CUOTA","VENTA","%AVAN","%EFEC")),
							array("cab"=>"TENDENCIA", "det"=>array("NECDIA", "TEND", "%CUOTA")),
							array("cab"=>"VENTA RECHAZADA", "det"=>array("MONTO", "%CUOTA", "%PREV")),
							array("cab"=>"PEDIDOS", "det"=>array("EFEC.", "RECH.", "%RECH.")),
							array("cab"=>"PUNTOS DE VENTA", "det"=>array("EFEC.", "RECH.", "%RECH."))
							);
			$varNiv = array(0 =>array("COD"=>"CVEN","DES"=>"VENDEDOR"),
							1 =>array("COD"=>"CTIP","DES"=>"TIPO"),
							2 =>array("COD"=>"CEMP","DES"=>"EMPRESA"));
			$varFor = array(11=>array("tipodat"=>"porc", "formula"=>array("valor1"=>9, "valor2"=>10, "funcion"=>"porc")),
							12=>array("tipodat"=>"porc", "formula"=>array("valor1"=>6, "valor2"=>10, "funcion"=>"porc")),
							15=>array("tipodat"=>"porc", "formula"=>array("valor1"=>9, "valor2"=>13, "funcion"=>"porc")),
							17=>array("tipodat"=>"porc", "formula"=>array("valor1"=>9, "valor2"=>16, "funcion"=>"porc")),
							18=>array("tipodat"=>"porc", "formula"=>array("valor1"=>6, "valor2"=>16, "funcion"=>"porc")),
							21=>array("tipodat"=>"porc", "formula"=>array("valor1"=>7, "valor2"=>20, "funcion"=>"porc")),
							24=>array("tipodat"=>"porc", "formula"=>array("valor1"=>8, "valor2"=>23, "funcion"=>"porc"))
							);
			$varReturn =  $this->setGridCombina($varCab, $sql, $varNiv, NULL, $varFor);
			}
		return $varReturn;
		}
	function Imprimir ($varEmp = NULL,
					   $varAni = NULL, 
					   $varMes = NULL,			    
					   $varIni = NULL, 
					   $varFin = NULL,
					   $varPro = NULL
					   )  {
		$sql_emp = "select concat(id_empresa, ' - ', nombre) as empresa from _sv_empresa where id_empresa=$varEmp;";
		$this->AbrirConexion();
		$rs_emp = $this->Query($sql_emp);
		$this->CerrarConexion();
		$fila_emp = $this->FetchArray($rs_emp);
		$varCadEmp = $fila_emp[0];				  
		
		if($varPro<>"") {
			$sql_pro = "select concat(id_proveedor, ' - ', nombre) as proveedor from _sv_proveedor where id_proveedor=$varPro;";
			$this->AbrirConexion();
			$rs_pro = $this->Query($sql_pro);
			$this->CerrarConexion();
			$fila_pro = $this->FetchArray($rs_pro);
			$varCadPro = $fila_pro[0];
			}
		else {
			$varCadPro = "TODOS LOS VENDEDORES";
			$varPro = "NULL";
			}
		
		$varAniC = (isset($varAni) && $varAni<>"")?"'".$varAni."'":"NULL";
		$varMesC = (isset($varMes) && $varMes<>"")?"'".$varMes."'":"NULL";
		$varIniC = (isset($varIni) && $varIni<>"")?"'".FechaMySql($varIni)."'":"NULL";
		$varFinC = (isset($varFin) && $varFin<>"")?"'".FechaMySql($varFin)."'":"NULL";
		
		
		$sql = "call spQuery_Avance_Ventas_Vendedor($varEmp, $varAniC, $varMesC, $varPro, $varIniC, $varFinC);";	
		
		$html='<table style="width: 98%; padding: 0; margin-top:10px; margin-bottom:10px; border-collapse:collapse;" align="center">';
		$html.='<thead>';
		$html.='<tr>';
		$html.='<td>';
			$html.='<table style="width: 100%;" cellspacing="0" cellpadding="0">';
			$html.='<tr class="titu_sup" height="25px">';
			$html.='<td colspan="2"><b>'.$this->varTitulo.'</b></td>';
			$html.='</tr>';
			$html.='<tr class="titu_inf">';
			$html.='<td colspan="2">';
			$html.='<div align="left" style=" width:50%;float:left;">'.$_SESSION["_CABR"].' : '.$_SESSION["_NSYS"].'</div>';
    		$html.='<div align="right" style="width:50%;float:left">'.MostrarFechaActual().'</div>';
			$html.='</td>';
			$html.='</tr>';
			$html.='</table>';
		$html.='</td>';
		$html.='</tr>';		
		$html.='<tr>';
		$html.='<td>';
			$html.='<table style="width: 100%;" cellspacing="0" cellpadding="0">';
			$html.='<tr>';
			$html.='<td style="width: 8%; vertical-align: middle; text-align:left;"><b>Empresa </b></td>';
			$html.='<td style="vertical-align: middle; text-align:left;"><b>:</b></td>';
			$html.='<td style="width: 42%; vertical-align: middle; text-align:left;">'.$varCadEmp.'</td>';
			$html.='<td style="width: 50%; vertical-align: middle; text-align:right;"><b></b></td>';
			$html.='</tr>';
			$html.='<tr>';
			$html.='<td style="width: 10%; vertical-align: middle; text-align:left;"><b>Periodo </b></td>';
			$html.='<td style="vertical-align: middle; text-align:left;"><b>:</b></td>';
			$html.='<td style="width: 40%; vertical-align: middle; text-align:left;" nowrap>'.MesNombreLargo($varMes).' - '.$varAni.'</td>';
			$html.='<td style="width: 50%; vertical-align: middle; text-align:left;"></td>';
			$html.='</tr>';
			$html.='<tr>';
			$html.='<td style="width: 10%; vertical-align: middle; text-align:left;"><b>Datos </b></td>';
			$html.='<td style="vertical-align: middle; text-align:left;"><b>:</b></td>';
			$html.='<td style="width: 40%; vertical-align: middle; text-align:left;" nowrap>'.$varIni.' - '.$varFin.'</td>';
			$html.='<td style="width: 50%; vertical-align: middle; text-align:left;"></td>';
			$html.='</tr>';
			$html.='<tr>';
			$html.='<td style="width: 10%; vertical-align: middle; text-align:left;"><b>Proveedor </b></td>';
			$html.='<td style="vertical-align: middle; text-align:left;"><b>:</b></td>';
			$html.='<td style="width: 40%; vertical-align: middle; text-align:left;" nowrap>'.$varCadPro.'</td>';
			$html.='<td style="width: 50%; vertical-align: middle; text-align:left;"></td>';
			$html.='</tr>';
			$html.='</table>';
		$html.='</td>';
		$html.='</tr>';
		$html.='</thead>';	
		$html.='<tr>';
		$html.='<td>';
		$html.='<table style="width: 100%;padding: 0; margin-top:0px; margin-bottom:0px; border-collapse:collapse;">';
		$html.='<thead>';
		$html.='<tr class="titu_tabla">';
		$html.='<td width="2" align="center">&nbsp;</td>';
		$html.='<td width="2" align="center">CVEN</td>';
		$html.='<td width="150">VENDEDOR</td>';
		$html.='<td width="60" align="right">META</td>';
		$html.='<td width="60" align="right">AVANCE</td>';
		$html.='<td width="60" align="right">% AVANC</td>';
		$html.='<td width="60" align="right">NEC.DIARIA</td>';
		$html.='<td width="60" align="right">TENDENCIA</td>';
		$html.='<td width="60" align="right">% TEND.</td>';
		$html.='</tr>';
		$html.='</thead>';
		//$sql = "call spQuery_Avance_Ventas_Vendedor('$_GET[anio]', '$_GET[mes]', '$_GET[pro]', $varFIni, $varFFin);";
		$this->AbrirConexion();
		$rs = $this->Query($sql);
		$this->CerrarConexion();
		$varTotal_1 = 0;
		$varTotal_2 = 0;
		$varTotal_3 = 0;
		$varNumDoc = 0;
		while($fila = $this->FetchArray($rs))	{
			$varTotal_1 = $varTotal_1 + $fila["META"];
			$varTotal_2 = $varTotal_2 + $fila["VENTA"];
			$varTotal_3 = $varTotal_3 + $fila["TENDENCIA"];
			$varTotal_4 = $varTotal_4 + $fila["NEC_DIARIA"];
			$varNumDoc++;
			$html.='<tr class="cont_tabla">';
			$html.='<td class="center">&nbsp;</td>';
			$html.='<td class="center">'.$fila["CVEN"].'</td>';
			$html.='<td NOWRAP>'.$fila["VENDEDOR"].'</td>';
			$html.='<td class="right">';
			if(!is_null($fila["META"]) && $fila["META"] <> 0)
				$html.=number_format($fila["META"],"2",".",",");
			$html.='</td>';
			$html.='<td class="right">';
			if(!is_null($fila["VENTA"]) && $fila["VENTA"] <> 0)
				$html.=number_format($fila["VENTA"],"2",".",",");
			$html.='</td>';
			$html.='<td class="right">';
			if(!is_null($fila["PORC_AVANCE"]) && $fila["PORC_AVANCE"] <> 0)
				$html.=number_format($fila["PORC_AVANCE"],"2",".",",")."%";
			$html.='</td>';
			$html.='<td class="right">';
			if(!is_null($fila["NEC_DIARIA"]) && $fila["NEC_DIARIA"] <> 0)
				$html.=number_format($fila["NEC_DIARIA"],"2",".",",");
			$html.='</td>';
			$html.='<td class="right">';
			if(!is_null($fila["TENDENCIA"]) && $fila["TENDENCIA"] <> 0)
				$html.=number_format($fila["TENDENCIA"],"2",".",",");
			$html.='</td>';
			$html.='<td class="right">';
			if(!is_null($fila["PORC_TENDENCIA"]) && $fila["PORC_TENDENCIA"] <> 0)
				$html.=number_format($fila["PORC_TENDENCIA"],"2",".",",")."%";
			$html.='</td>';
			$html.='</tr>';
			}
		$html.='<tr class="titu_tabla">';
		$html.='<td class="left"></td>';
		$html.='<td class="left"></td>';
		$html.='<td class="left">'.number_format($varNumDoc,"0",".",",").' Registros</td>';
		$html.='<td class="right">'.number_format($varTotal_1,"2",".",",").'</td>';
		$html.='<td class="right">'.number_format($varTotal_2,"2",".",",").'</td>';
		$html.='<td class="right">';
		$html.= ($varTotal_1==0)?"0.00":number_format($varTotal_2/$varTotal_1*100,"2",".",",");
		$html.='%</td>';
		$html.='<td class="right">'.number_format($varTotal_4,"2",".",",").'</td>';
		$html.='<td class="right">'.number_format($varTotal_3,"2",".",",").'</td>';
		$html.='<td class="right">';
		$html.= ($varTotal_1==0)?"0.00":number_format($varTotal_3/$varTotal_1*100,"2",".",",");
		$html.='%</td>';
		$html.='</tr>';
		$html.='</table>';
		$html.='</td>';
		$html.='</tr>';			
		$html.='</table>';
		return $html;		
		}
	function ImprimirDet (
					$varEmp = NULL, 
					$varAni = NULL, 
					$varMes = NULL,
					$varIni = NULL, 
					$varFin = NULL,
					$varPro = NULL
					)  {
		
		$sql_emp = "select concat(id_empresa, ' - ', nombre) as empresa from _sv_empresa where id_empresa=$varEmp;";
		$this->AbrirConexion();
		$rs_emp = $this->Query($sql_emp);
		$this->CerrarConexion();
		$fila_emp = $this->FetchArray($rs_emp);
		$varCadEmp = $fila_emp[0];
		
		if($varPro<>"") {
			$sql_pro = "select concat(id_proveedor, ' - ', nombre) as proveedor from _sv_proveedor where id_proveedor=$varPro;";
			$this->AbrirConexion();
			$rs_pro = $this->Query($sql_pro);
			$this->CerrarConexion();
			$fila_pro = $this->FetchArray($rs_pro);
			$varCadPro = $fila_pro[0];
			}
		else {
			$varCadPro = "TODOS LOS VENDEDORES";
			$varPro = "NULL";
			}
							  
		$varAniC = (isset($varAni) && $varAni<>"")?"'".$varAni."'":"NULL";
		$varMesC = (isset($varMes) && $varMes<>"")?"'".$varMes."'":"NULL";
		$varIniC = (isset($varIni) && $varIni<>"")?"'".FechaMySql($varIni)."'":"NULL";
		$varFinC = (isset($varFin) && $varFin<>"")?"'".FechaMySql($varFin)."'":"NULL";
		
		
		$sql = "call spQuery_Avance_Ventas_Vendedor_Max($varEmp, $varAniC, $varMesC, $varPro, $varIniC, $varFinC);";
		
		$varCab = array(array("cab"=>"PREVENTA GENERAL", "det"=>array("PREV","PEDID","PDV")),
						array("cab"=>"VENTA EFECTIVA", "det"=>array("CUOTA","VENTA","%AVAN","%EFEC")),
						array("cab"=>"TENDENCIA", "det"=>array("NECDIA", "TEND", "%CUOTA")),
						array("cab"=>"VENTA RECHAZADA", "det"=>array("MONTO", "%CUOTA", "%PREV")),
						array("cab"=>"PEDIDOS", "det"=>array("EFEC.", "RECH.", "%RECH.")),
						array("cab"=>"PUNTOS DE VENTA", "det"=>array("EFEC.", "RECH.", "%RECH."))
						);
		$varNiv = array(0 =>array("COD"=>"CVEN","DES"=>"VENDEDOR"),
						1 =>array("COD"=>"CTIP","DES"=>"TIPO"),
						2 =>array("COD"=>"CEMP","DES"=>"EMPRESA"));
		$varFor = array(11=>array("tipodat"=>"porc", "formula"=>array("valor1"=>9, "valor2"=>10, "funcion"=>"porc")),
						12=>array("tipodat"=>"porc", "formula"=>array("valor1"=>6, "valor2"=>10, "funcion"=>"porc")),
						15=>array("tipodat"=>"porc", "formula"=>array("valor1"=>9, "valor2"=>13, "funcion"=>"porc")),
						17=>array("tipodat"=>"porc", "formula"=>array("valor1"=>9, "valor2"=>16, "funcion"=>"porc")),
						18=>array("tipodat"=>"porc", "formula"=>array("valor1"=>6, "valor2"=>16, "funcion"=>"porc")),
						21=>array("tipodat"=>"porc", "formula"=>array("valor1"=>7, "valor2"=>20, "funcion"=>"porc")),
						24=>array("tipodat"=>"porc", "formula"=>array("valor1"=>8, "valor2"=>23, "funcion"=>"porc"))
						);
							
		$html='<table style="width: 98%; padding: 0; margin-top:10px; margin-bottom:10px; border-collapse:collapse;" align="center">';
		$html.='<thead>';
		$html.='<tr>';
		$html.='<td>';
			$html.='<table style="width: 100%;" cellspacing="0" cellpadding="0">';
			$html.='<tr class="titu_sup" height="25px">';
			$html.='<td colspan="2"><b>'.$this->varTitulo.'</b></td>';
			$html.='</tr>';
			$html.='<tr class="titu_inf">';
			$html.='<td colspan="2">';
			$html.='<div align="left" style=" width:50%;float:left;">'.$_SESSION["_CABR"].' : '.$_SESSION["_NSYS"].'</div>';
    		$html.='<div align="right" style="width:50%;float:left">'.MostrarFechaActual().'</div>';
			$html.='</td>';
			$html.='</tr>';
			$html.='</table>';
		$html.='</td>';
		$html.='</tr>';		
		$html.='<tr>';
		$html.='<td>';
			$html.='<table style="width: 100%;" cellspacing="0" cellpadding="0">';
			$html.='<tr>';
			$html.='<td style="width: 8%; vertical-align: middle; text-align:left;"><b>Empresa </b></td>';
			$html.='<td style="vertical-align: middle; text-align:left;"><b>:</b></td>';
			$html.='<td style="width: 42%; vertical-align: middle; text-align:left;">'.$varCadEmp.'</td>';
			$html.='<td style="width: 50%; vertical-align: middle; text-align:right;"><b></b></td>';
			$html.='</tr>';
			$html.='<tr>';
			$html.='<td style="width: 10%; vertical-align: middle; text-align:left;"><b>Periodo </b></td>';
			$html.='<td style="vertical-align: middle; text-align:left;"><b>:</b></td>';
			$html.='<td style="width: 40%; vertical-align: middle; text-align:left;" nowrap>'.MesNombreLargo($varMes).' - '.$varAni.'</td>';
			$html.='<td style="width: 50%; vertical-align: middle; text-align:left;"></td>';
			$html.='</tr>';
			$html.='<tr>';
			$html.='<td style="width: 10%; vertical-align: middle; text-align:left;"><b>Datos </b></td>';
			$html.='<td style="vertical-align: middle; text-align:left;"><b>:</b></td>';
			$html.='<td style="width: 40%; vertical-align: middle; text-align:left;" nowrap>'.$varIni.' - '.$varFin.'</td>';
			$html.='<td style="width: 50%; vertical-align: middle; text-align:left;"></td>';
			$html.='</tr>';
			$html.='<tr>';
			$html.='<td style="width: 10%; vertical-align: middle; text-align:left;"><b>Proveedor </b></td>';
			$html.='<td style="vertical-align: middle; text-align:left;"><b>:</b></td>';
			$html.='<td style="width: 40%; vertical-align: middle; text-align:left;" nowrap>'.$varCadPro.'</td>';
			$html.='<td style="width: 50%; vertical-align: middle; text-align:left;"></td>';
			$html.='</tr>';
			$html.='</table>';
		$html.='</td>';
		$html.='</tr>';
		$html.='</thead>';	
		$html.='<tr>';
		$html.='<td>';				
		$html.= $this->setGridCombinaPrint($varCab, $sql, $varNiv, NULL, $varFor);
		$html.='</td>';
		$html.='</tr>';			
		$html.='</table>';
		return $html;
		}
	}
?>