<?php
ini_set("display_errors","1");
ini_set("display_startup_errors","1");
header("Expires: Thu, 01 Jan 1970 00:00:01 GMT"); 
set_magic_quotes_runtime(0);

include("include/dbcommon.php");
include("include/pf_sistemalog_variables.php");



include('libs/Smarty.class.php');
$smarty = new Smarty();



$conn=db_connect();


if (@$_REQUEST["a"]=="") 
	$strSQL=$_SESSION[$strTableName."_sql"];
else
{
	
$sWhere = "1=0";	
foreach(@$_REQUEST["mdelete"] as $ind)
{
	$sWhere = $sWhere . " or ";
		$sWhere = $sWhere . GetFullFieldName("id","") . "=" . make_db_value("id", $_REQUEST["mdelete1"][$ind-1],"","");
        
}
$strSQL = AddWhere($gstrSQL,$sWhere);

}


LogInfo($strSQL);


//	 Pagination:
$numrows=GetRowCount($strSQL);
$mypage=(integer)$_SESSION[$strTableName."_pagenumber"];
if(!$mypage)
	$mypage=1;

//	page size
$PageSize=(integer)$_SESSION[$strTableName."_pagesize"];
if(!$PageSize)
	$PageSize=$gPageSize;

$recno=1;
	
if($numrows)
{
	$maxRecords = $numrows;
	$maxpages=ceil($maxRecords/$PageSize);
	if($mypage > $maxpages)
		$mypage = $maxpages;
	if($mypage<1) 
		$mypage=1;
	$maxrecs=$PageSize;
	$strSQL = AddTop($strSQL, $mypage*$PageSize);
}
$rs=db_query($strSQL,$conn);
db_pageseek($rs,$PageSize,$mypage);

//	hide colunm headers if needed
$recordsonpage=$numrows-($mypage-1)*$PageSize;
if($recordsonpage>$PageSize)
	$recordsonpage=$PageSize;
	if($recordsonpage>=1)
		$smarty->assign("column1show",true);
	else
		$smarty->assign("column1show",false);



//	fill $rowinfo array
	$rowinfo = array();

	$data=db_fetch_array($rs);

	while($data && $recno<=$PageSize)
	{
		$row=array();
		for($col=1;$data && $recno<=$PageSize && $col<=1;$col++)
		{

			$recno++;
			$keylink="";
			$keylink.="&key1=".htmlspecialchars(urlencode($data["id"]));


//	id - 
			$value="";
				$value = ProcessLargeText(GetData($data,"id", ""),"field=id".$keylink,MODE_PRINT);
			$row[$col."id_value"]=$value;

//	stringerror - 
			$value="";
				$value = ProcessLargeText(GetData($data,"stringerror", ""),"field=stringerror".$keylink,MODE_PRINT);
			$row[$col."stringerror_value"]=$value;

//	fecha - Short Date
			$value="";
				$value = ProcessLargeText(GetData($data,"fecha", "Short Date"),"field=fecha".$keylink,MODE_PRINT);
			$row[$col."fecha_value"]=$value;

//	procedimiento - 
			$value="";
				$value = ProcessLargeText(GetData($data,"procedimiento", ""),"field=procedimiento".$keylink,MODE_PRINT);
			$row[$col."procedimiento_value"]=$value;
			$row[$col."show"]=true;
			$data=db_fetch_array($rs);
		}
		$rowinfo[]=$row;
	}
	$smarty->assign("rowinfo",$rowinfo);


	

$strSQL=$_SESSION[$strTableName."_sql"];

$templatefile = "pf_sistemalog_print.htm";
if(function_exists("BeforeShowPrint"))
	BeforeShowPrint($smarty,$templatefile);

$smarty->display($templatefile);

