<?php
//include "clase.conexion.php";
class clsRegistroCompras extends clsConexion{
	public $varTitulo = "REPORTE DE DOCUMENTOS POR PAGAR";
	public $varMyTabla  = "_sv_compra";
	public $varMyID  	  = "id_compra";
	function FormuBusqueda() {
		$varEst = array("AC"=>"ACTIVO", "PP"=>"PAGADO PARCIAL","CA"=>"CANCELADO","AN"=>"ANULADO");
		$varTabla=array("id"=>"tabla", "name"=>"table", "tamano"=>"450", "clase"=>"FormTitulo", "titulo"=>$this->varTitulo." - BUSQUEDA",
						"formu"=>array("id"=>"form", "name"=>"form", "metodo"=>"POST", "onsubmit"=>"return false;"),						
						"ocult"=>array(array("tipo"=>"oculto", "id"=>"titu", "name"=>"titu", "valor"=>$this->varTitulo),
									   array("tipo"=>"oculto", "id"=>"opt", "name"=>"opt", "valor"=>$Opcion)
									  ),
						"conte"=>array(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(this.value)", 
																					 "dclick"=>"fn_cargar_listado_proveedor('pcod', 'pnom')"),
																			   array("tipo"=>"text", "id"=>"pnom", "name"=>"pnom", "valor"=>$varPNOM, 
																			   		 "ancho"=>"250", "clase"=>"inputDisable", "locked"=>"SI")
																			   )
														 )
										  	 ),	
									   array("titulo"=>"Tipo Doc. :", "clase1"=>"FormCampo1", "clase2"=>"interior",
											 "campo"=>array("tipo"=>"varios",
															"contenido"=>array(array("tipo"=>"text", "id"=>"tcod", "name"=>"tcod", "valor"=>$_POST["tcod"],
																					 "ancho"=>"50", "alinear"=>"center", 
																					 "keypress"=>"return SoloEnteros(event)",
																					 "blur"=>"xajax_seleccionar_tipo_docpago(this.value)", 
																					 "dclick"=>"fn_cargar_listado_tipo_docpago('tcod', 'tnom')"),
																			   array("tipo"=>"text", "id"=>"tnom", "name"=>"tnom", "valor"=>$_POST["tnom"], 
																					 "ancho"=>"250", "clase"=>"inputDisable", "locked"=>"SI")
																			   )
														 	)
											 ),
									   array("titulo"=>"Fecha Inicial :", "clase1"=>"FormCampo1", "clase2"=>"interior",
											 "campo"=>array("tipo"=>"varios",
															"contenido"=>array(array("tipo"=>"texto", "id"=>"fini", "name"=>"fini", "alinear"=>"center",
																					 "ancho"=>"130", "valor"=>$varFINI)
																			   )
														 	)
											 ),
									   array("titulo"=>"Fecha Final :", "clase1"=>"FormCampo1", "clase2"=>"interior",
											 "campo"=>array("tipo"=>"varios",
															"contenido"=>array(array("tipo"=>"texto", "id"=>"ffin", "name"=>"ffin", "alinear"=>"center", 
																					 "ancho"=>"130", "valor"=>$varFFIN)
																			   )
														 	)
											 ),
										array("titulo"=>"Estado :", "clase1"=>"FormCampo1", "clase2"=>"interior",
											 "campo"=>array("tipo"=>"varios",
															"contenido"=>array(array("tipo"=>"select_simple", "id"=>"est", "name"=>"est",
																					 "combo"=>array("sql"=>$varEst, "sincod"=>"SI", 
																					 "ancho"=>"140", "titulo"=>"--[[SELECCIONAR]]--"))
																			   )
														 	)
											 )
									 ),
					  "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, 
					   $varField = NULL, 
					   $varOrder = NULL
					   ) {
		$varPro = (isset($varForm["pcod"]) && $varForm["pcod"]<>'')? $varForm["pcod"]:"NULL";
		$varTip = (isset($varForm["tcod"]) && $varForm["tcod"]<>'')? $varForm["tcod"]:"NULL";
		$varIni = (isset($varForm["fini"]) && $varForm["fini"]<>'')? "'".FechaMySql($varForm["fini"])."'":"NULL";
		$varFin = (isset($varForm["ffin"]) && $varForm["ffin"]<>'')? "'".FechaMySql($varForm["ffin"])."'":"NULL";
		$varEst = (isset($varForm["est"]) && $varForm["est"]<>'Ninguno')?"'".$varForm["est"]."'":"NULL";
		$varUsr = (isset($_SESSION["_CUSE"]))?$_SESSION["_CUSE"]:1;
		$varFie = (isset($varField) && $varField<>'')? "'$varField'":"NULL";
		$varOrd = (isset($varOrder) && $varOrder<>'')? "'$varOrder'":"NULL";
		
		$sql = "call spQuery_CXP_Registro_Compras('101',$varPro, $varTip, $varIni, $varFin, $varEst, $varFie, $varOrd);";
		
		$varTabla=array("id"=>"theTable", "name"=>"theTable", "tamano"=>"1000", "sql_cab"=>$sql, "pages"=>50,
						"conte"=>array(array("tamano"=>20, "titulo"=>"IDE", "alinear"=>"center"),
									   array("tamano"=>50, "titulo"=>"FEMI", "alinear"=>"center"),
									   array("tamano"=>50, "titulo"=>"FMOV", "alinear"=>"center"),
									   array("tamano"=>50, "titulo"=>"FVEN", "alinear"=>"center"),
									   array("tamano"=>10, "titulo"=>"CTIP", "alinear"=>"center", "oculto"=>"SI"),
									   array("tamano"=>50, "titulo"=>"TIPO", "fijo"=>"SI"),
									   array("tamano"=>50, "titulo"=>"ABREV", "fijo"=>"SI", "oculto"=>"SI"),
									   array("tamano"=>90, "titulo"=>"DOCUMENTO", "alinear"=>"center"),
									   array("tamano"=>40, "titulo"=>"EST.", "alinear"=>"center"),										   
									   array("tamano"=>10, "titulo"=>"CPRO", "alinear"=>"center"),
									   array("tamano"=>250,"titulo"=>"PROVEEDOR", "fijo"=>"SI", "funcion"=>array("contar")),
									   array("tamano"=>100, "titulo"=>"GLOSA", "oculto"=>"SI"),
									   array("tamano"=>60, "titulo"=>"SUB TOTAL", "alinear"=>"right", "funcion"=>array("autosuma")),
									   array("tamano"=>60, "titulo"=>"IGV", "alinear"=>"right", "funcion"=>array("autosuma")),
									   array("tamano"=>60, "titulo"=>"TOTAL", "alinear"=>"right", "funcion"=>array("autosuma")),
									   array("tamano"=>60, "titulo"=>"SALDO", "alinear"=>"right", "funcion"=>array("autosuma")),
									   array("tamano"=>100, "titulo"=>"FCREADO", "alinear"=>"center", "oculto"=>"SI"),
									   array("tamano"=>100, "titulo"=>"FMODIFI", "alinear"=>"center", "oculto"=>"SI"),
									   array("tamano"=>100, "titulo"=>"UCREADO", "alinear"=>"center", "oculto"=>"SI"),
									   array("tamano"=>100, "titulo"=>"UMODIFI", "alinear"=>"center", "oculto"=>"SI")
									   ),
						"boton"=>array(array("tipo"=>"img", "id"=>"bbus", "name"=>"bbus", "img"=>"images/b_table.png", 
												 "toltip"=>array(array("valor"=>"HAGA CLICK PARA <b>VER EL DETALLE DE</b> LA COMPRA<br><b>Fecha Emisi&oacute;n : </b>"),
																 array("valor"=>1, "tipo"=>"INDEX"),
																 array("valor"=>"<br><b>Tipo Doc. : </b>"),
																 array("valor"=>3, "tipo"=>"INDEX"),
																 array("valor"=>"<br><b>Documento : </b>"),
																 array("valor"=>4, "tipo"=>"INDEX")
												   				),
												 "click"=>array("funcion"=>"FormuDetalleJS",
																"param"=>array(array("valor"=>0, 	  "tipo"=>"INDEX"))
																)
												 
												),
										)
							);
		return $this->SetGridTabla2($varTabla);
		//return $sql;
		}
	
	
	function FormuDetalle($varCod=NULL) {
		$sql = "CALL spQuery_Registro_Compras_Cabecera($varCod)";
		$this->AbrirConexion();
		$rs = $this->Query($sql);
		$this->CerrarConexion();
		$Fila = $this->FetchArray($rs);

		$varTabla=array("id"=>"tabla", "name"=>"table", "tamano"=>"500", "clase"=>"FormTitulo", "titulo"=>$this->varTitulo." - DETALLE",					
						"formu"=>array("id"=>"form", "name"=>"form", "metodo"=>"POST", "onsubmit"=>"return false;"),
						"ocult"=>array(array("tipo"=>"oculto", "id"=>"titu", "name"=>"titu", "valor"=>$this->varTitulo." - ".$Fila["LISTA"]),
									   array("tipo"=>"oculto", "id"=>"opt", "name"=>"opt",   "valor"=>"DET")
									  ),
						"conte"=>array(array("titulo"=>"Ide :", "clase1"=>"FormCampo1", "clase2"=>"interior", "tamano"=>"80",
											 "campo" =>array("tipo"=>"texto", "id"=>"cod", "name"=>"cod", "clase"=>"inputDisable",
											 "valor"=>$Fila["IDE"], "alinear"=>"center", "locked"=>"SI", "ancho"=>"70")),
									   array("titulo"=>"Fecha Emision :", "clase1"=>"FormCampo1", "clase2"=>"interior", 
											 "texto"=>$Fila["FEMI"], "tamano"=>"120"),
									   array("titulo"=>"Fecha Movimiento :", "clase1"=>"FormCampo1", "clase2"=>"interior", 
											 "texto"=>$Fila["FMOV"]),
									   array("titulo"=>"Documento :", "clase1"=>"FormCampo1", "clase2"=>"interior", 
									   		 "texto"=>$Fila["CTIP"]." &nbsp; ".$Fila["NDOC"]),
									   array("titulo"=>"Proveedor :", "clase1"=>"FormCampo1", "clase2"=>"interior",
										     "texto"=>$Fila["CPRO"].' - '.$Fila["PROVEEDOR"]),
									   array("titulo"=>"Sub Total :", "clase1"=>"FormCampo1", "clase2"=>"interior",
										     "texto"=>number_format($Fila["SUBTOTAL"], 2,'.',',')),
									   array("titulo"=>"IGV :", "clase1"=>"FormCampo1", "clase2"=>"interior",
										     "texto"=>number_format($Fila["IGV"], 2,'.',',')),
									   array("titulo"=>"Total :", "clase1"=>"FormCampo1", "clase2"=>"interior",
										     "texto"=>number_format($Fila["TOTAL"], 2,'.',',')),
									   array("titulo"=>"Estado :", "clase1"=>"FormCampo1", "clase2"=>"interior",
										     "texto"=>$Fila["ESTADO"]),
									   array("titulo"=>"F/U Creado :", "clase1"=>"FormCampo1", "clase2"=>"interior",
										     "texto"=>$Fila["USER_CREATE"]." &nbsp; - &nbsp; ".$Fila["DATE_CREATE"]),
									   array("titulo"=>"F/U Modificado :", "clase1"=>"FormCampo1", "clase2"=>"interior",
										     "texto"=>$Fila["USER_UPDATE"]." &nbsp; - &nbsp; ".$Fila["DATE_UPDATE"])
									   ),
							  "boton"=>array(array("tipo"=>"button", "id"=>"breg", "name"=>"breg", "ancho"=>"100",
												   "clase"=>"boton_cancelar", "texto"=>"Cancelar", "click"=>"javascrip:xajax_xRegresar()"),
											 array("tipo"=>"button", "id"=>"bnew", "name"=>"bnew", "ancho"=>"120", "texto"=>"Nueva Compra", 
										   		   "clase"=>"boton_nuevo", "click"=>"javascript:FormuRegistroJS('NEW','')"),
											)
						);		
		$varReturn = $this->setTablaForm($varTabla);
		
		$sql = "CALL spQuery_Registro_Compras_Detalle($varCod)";
		$varTabla=array("id"=>"theTable", "name"=>"theTable", "tamano"=>"800", "sql_cab"=>$sql, "pages"=>50,
						"conte"=>array(array("tamano"=>20, "titulo"=>"CMOV", "alinear"=>"center"),
									   array("tamano"=>200,"titulo"=>"MOVIMIENTO", "fijo"=>"SI"),
									   array("tamano"=>20, "titulo"=>"CPRO", "alinear"=>"center"),
									   array("tamano"=>400,"titulo"=>"PRODUCTO", "fijo"=>"SI"),
									   array("tamano"=>50, "titulo"=>"UM", "alinear"=>"center"),
									   array("tamano"=>50, "titulo"=>"PRE. SIN_IGV", "alinear"=>"right", "decimal"=>5),
									   array("tamano"=>50, "titulo"=>"PRE. CON_IGV", "alinear"=>"right", "decimal"=>5),
									   array("tamano"=>50, "titulo"=>"CANTIDAD", "alinear"=>"right"),
									   array("tamano"=>50, "titulo"=>"% DESC1", "alinear"=>"center", "tipodat"=>"porc"),
									   array("tamano"=>50, "titulo"=>"% DESC2", "alinear"=>"center", "tipodat"=>"porc"),
									   array("tamano"=>50, "titulo"=>"SUBTOTAL", "alinear"=>"right"),
									   array("tamano"=>50, "titulo"=>"IGV", "alinear"=>"right"),
									   array("tamano"=>50, "titulo"=>"TOTAL", "alinear"=>"right")
									   )
						);
		$varReturn.= "<div id=\"divDatos\">";
		$varReturn.= $this->SetGridTabla($varTabla);
		$varReturn.= "</div>";
		
		return $varReturn;
		}
	
	function FormuDetalleFloat($varCod=NULL) {
		$sql = "CALL spQuery_Registro_Compras_Cabecera($varCod)";
		$this->AbrirConexion();
		$rs = $this->Query($sql);
		$this->CerrarConexion();
		$Fila = $this->FetchArray($rs);

		$varTabla=array("id"=>"tabla", "name"=>"table", "tamano"=>"500", "clase"=>"FormTitulo", "titulo"=>$this->varTitulo." - DETALLE",					
						"formu"=>array("id"=>"form", "name"=>"form", "metodo"=>"POST", "onsubmit"=>"return false;"),
						"ocult"=>array(array("tipo"=>"oculto", "id"=>"titu", "name"=>"titu", "valor"=>$this->varTitulo." - ".$Fila["LISTA"]),
									   array("tipo"=>"oculto", "id"=>"opt", "name"=>"opt",   "valor"=>"DET")
									  ),
						"conte"=>array(array("titulo"=>"Ide :", "clase1"=>"FormCampo1", "clase2"=>"interior", "tamano"=>"80",
											 "campo" =>array("tipo"=>"texto", "id"=>"cod", "name"=>"cod", "clase"=>"inputDisable",
											 "valor"=>$Fila["IDE"], "alinear"=>"center", "locked"=>"SI", "ancho"=>"70")),
									   array("titulo"=>"Fecha Emision :", "clase1"=>"FormCampo1", "clase2"=>"interior", 
											 "texto"=>$Fila["FEMI"], "tamano"=>"120"),
									   array("titulo"=>"Fecha Movimiento :", "clase1"=>"FormCampo1", "clase2"=>"interior", 
											 "texto"=>$Fila["FMOV"]),
									   array("titulo"=>"Documento :", "clase1"=>"FormCampo1", "clase2"=>"interior", 
									   		 "texto"=>$Fila["CTIP"]." &nbsp; ".$Fila["NDOC"]),
									   array("titulo"=>"Proveedor :", "clase1"=>"FormCampo1", "clase2"=>"interior",
										     "texto"=>$Fila["CPRO"].' - '.$Fila["PROVEEDOR"]),
									   
									   array("titulo"=>"Sub Total :", "clase1"=>"FormCampo1", "clase2"=>"interior",
											 "campo"=>array("tipo"=>"varios",
															"contenido"=>array(array("tipo"=>"simple", "valor"=>number_format($Fila["SUBTOTAL"], 2,'.',','),
																					 "alinear"=>"right", "ancho"=>"70"),
																			   array("tipo"=>"simple", "valor"=>"IGV :", "ancho"=>"60", "clase_in"=>"FormCampo1"),
																			   array("tipo"=>"simple", "valor"=>number_format($Fila["IGV"], 2,'.',','),
																					 "alinear"=>"right", "ancho"=>"70"),
																			   array("tipo"=>"simple", "valor"=>"Total :", "ancho"=>"60", "clase_in"=>"FormCampo1"),
																			   array("tipo"=>"simple", "valor"=>number_format($Fila["TOTAL"], 2,'.',','),
																					 "alinear"=>"right", "ancho"=>"70"),
																			   )
														 )
											 ),
									   array("titulo"=>"Estado :", "clase1"=>"FormCampo1", "clase2"=>"interior",
										     "texto"=>$Fila["ESTADO"]),
									   array("titulo"=>"F/U Creado :", "clase1"=>"FormCampo1", "clase2"=>"interior",
										     "texto"=>$Fila["USER_CREATE"]." &nbsp; - &nbsp; ".$Fila["DATE_CREATE"]),
									   array("titulo"=>"F/U Modificado :", "clase1"=>"FormCampo1", "clase2"=>"interior",
										     "texto"=>$Fila["USER_UPDATE"]." &nbsp; - &nbsp; ".$Fila["DATE_UPDATE"])
									   ),
							  "boton"=>array(array("tipo"=>"button", "id"=>"breg", "name"=>"breg", "ancho"=>"100",
											   "clase"=>"boton_cancelar", "texto"=>"Cerrar", "click"=>"window.close()")
										)
						);		
		$varReturn = $this->setTablaForm($varTabla);
		
		$sql = "CALL spQuery_Registro_Compras_Detalle($varCod)";
		$varTabla=array("id"=>"theTable", "name"=>"theTable", "tamano"=>"800", "sql_cab"=>$sql, "pages"=>50,
						"conte"=>array(array("tamano"=>20, "titulo"=>"CMOV", "alinear"=>"center"),
									   array("tamano"=>200,"titulo"=>"MOVIMIENTO", "fijo"=>"SI"),
									   array("tamano"=>20, "titulo"=>"CPRO", "alinear"=>"center"),
									   array("tamano"=>400,"titulo"=>"PRODUCTO", "fijo"=>"SI", "funcion"=>array("contar")),
									   array("tamano"=>50, "titulo"=>"UM", "alinear"=>"center"),
									   array("tamano"=>50, "titulo"=>"PRE. SIN_IGV", "alinear"=>"right", "decimal"=>5),
									   array("tamano"=>50, "titulo"=>"PRE. CON_IGV", "alinear"=>"right", "decimal"=>5),
									   array("tamano"=>50, "titulo"=>"CANTIDAD", "alinear"=>"right"),
									   array("tamano"=>50, "titulo"=>"% DESC1", "alinear"=>"center", "tipodat"=>"porc"),
									   array("tamano"=>50, "titulo"=>"% DESC2", "alinear"=>"center", "tipodat"=>"porc"),
									   array("tamano"=>50, "titulo"=>"SUBTOTAL", "alinear"=>"right", "funcion"=>array("autosuma")),
									   array("tamano"=>50, "titulo"=>"IGV", "alinear"=>"right", "funcion"=>array("autosuma")),
									   array("tamano"=>50, "titulo"=>"TOTAL", "alinear"=>"right", "funcion"=>array("autosuma"))
									   )
						);
		$varReturn.= "<div id=\"divDatos\">";
		$varReturn.= $this->SetGridTabla($varTabla);
		$varReturn.= "</div>";
		
		return $varReturn;
		}
	function Imprimir ($varPro = NULL, 
					   $varTip = NULL, 
					   $varIni = NULL,
					   $varFin = NULL,
					   $varEst = NULL
					   )  {
						  
		$varPro = (isset($varPro) && $varPro<>'')?$varPro:"NULL";
		$varTip = (isset($varTip) && $varTip<>'')?$varTip:"NULL";
		$varIni = (isset($varIni) && $varIni<>'')?"'".FechaMySql($varIni)."'":"NULL";
		$varFin = (isset($varFin) && $varFin<>'')?"'".FechaMySql($varFin)."'":"NULL";
		$varEst = (isset($varEst) && $varEst<>'Ninguno')?"'".$varEst."'":"NULL";
		
		$sql = "call spQuery_CXP_Registro_Compras('101',$varPro, $varTip, $varIni, $varFin, $varEst, 'FEMI', NULL);";
		
		$html.='<table style="width: 95%; padding: 0; margin-top:10px; margin-bottom:10px; border-collapse:collapse;" align="center">';
		$html.='<thead>';
		$html.='<tr>';
		$html.='<td>';
			$html.='<table style="width: 100%;">';
			$html.='<tr>';
			$html.='<td style="width: 50%; vertical-align: middle; text-align:left;"><b>'.Config("SYSEMP").'</b></td>';
			$html.='<td style="width: 50%; vertical-align: middle; text-align:right;"><b>'.$this->varTitulo.'</b></td>';
			$html.='</tr>';
			$html.='<tr>';
			$html.='<td style="width: 50%; vertical-align: middle; text-align:left;"><b></b></td>';
			$html.='<td style="width: 50%; vertical-align: middle; text-align:right;"><b>'.MostrarFechaActual().'</b></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="head">';
			$html.='<td width="30" align="center">FEMI</td>';
			$html.='<td width="30" align="center">FVEN</td>';
			$html.='<td width="30">TIPO</td>';
			$html.='<td width="50" align="center">NDOC</td>';
			$html.='<td width="20" class="center">CPRO</td>';
			$html.='<td width="150">PROVEEDOR</td>';
			$html.='<td width="20" align="center">EST</td>';
			$html.='<td width="25" class="right" nowrap>SUBTOTAL</td>';
			$html.='<td width="25" class="right">IGV</td>';
			$html.='<td width="25" class="right">TOTAL</td>';
			$html.='<td width="25" class="right">SALDO</td>';
			$html.='<td width="30">CREADO</td>';
			$html.='<td width="30">MODIFICA</td>';
			$html.='</tr>';
			$html.='</thead>';
			$this->AbrirConexion();
			$rs = $this->Query($sql);
			$this->CerrarConexion();
			$varTotal1 = 0;
			$varTotal2 = 0;
			$varTotal3 = 0;
			$varTotal4 = 0;
			$varNumDoc = 0;
			while($fila = $this->FetchArray($rs))	{
				$varTot1 = $varTot1 + $fila["SUBTOTAL"];
				$varTot2 = $varTot2 + $fila["IGV"];
				$varTot3 = $varTot3 + $fila["TOTAL"];
				$varTot4 = $varTot4 + $fila["SALDO"];
				$varNumDoc++;
				$html.='<tr class="list_row">
						<td NOWRAP align="center">'.$fila["FEMI"].'</td>
						<td NOWRAP align="center">'.$fila["FVEN"].'</td>
						<td NOWRAP>'.$fila["TIPO"].'</td>
						<td NOWRAP align="center">'.$fila["DOCUMENTO"].'</td>
						<td class="center">'.$fila["CPRO"].'</td>
						<td NOWRAP>'.$fila["PROVEEDOR"].'</td>
						<td align="center">'.$fila["ESTADO"].'</td>
						<td class="right">'.number_format($fila["SUBTOTAL"],"2",".",",").'</td>
						<td class="right">'.number_format($fila["IGV"],"2",".",",").'</td>
						<td class="right">'.number_format($fila["TOTAL"],"2",".",",").'</td>
						<td class="right">'.number_format($fila["SALDO"],"2",".",",").'</td>
						<td>'.$fila["USER_CREADO"].'</td>
						<td>'.$fila["USER_MODIFI"].'</td>
						</tr>';
				}
			$html.='<tr class="head">';
			$html.='<td colspan="3" class="left"><strong>Totales :</strong></td>';
			$html.='<td colspan="3" class="left">'.number_format($varNumDoc,"0",".",",").' Documentos</td>';
			$html.='<td class="right"></td>';
			$html.='<td class="right">'.number_format($varTot1,"2",".",",").'</td>';
			$html.='<td class="right">'.number_format($varTot2,"2",".",",").'</td>';
			$html.='<td class="right">'.number_format($varTot3,"2",".",",").'</td>';
			$html.='<td class="right">'.number_format($varTot4,"2",".",",").'</td>';
			$html.='<td class="right"></td>';
			$html.='<td class="right"></td>';
			$html.='</tr>';
	
			$html.='</table>';
		$html.='</td>';
		$html.='</tr>';
				
		$html.='</table>';
		return $html;
		}
	}
	
?>