<?php

//phone2.php?currentPage=0&sortColumn=&sortDesc=&rowsPerPage=20&variable=55

	require('include/configuracion.php');
	require('include/lib.php');
		conexion();



$currentpage=parametro('currentPage',0);
$sortcolumn=parametro('sortColumn',0);
$sortdesc=parametro('sortDesc',0);
$rowsperpage=parametro('rowsPerPage',5);
$variable=parametro('variable',0);
$iniciolectura=$rowsperpage*$currentpage;


switch ($variable) {
	case 'PROVEEDOR':
		echo "{'fields':[\n";	
		echo ",{'title':'Id','columnWidth':'50'}\n";
		echo ",{'title':'Nombre','Nombre del Productor':'100'}\n";
		echo "]\n";
		
	

		$sql="select * from pf_productor order by id_productor";
		$filas=0;
		$resultado="";
		ejecutarsql($sql,&$filas,&$resultado);	
		echo ",'rows':[\n";		
		for ($i=$iniciolectura;$i<$iniciolectura+$rowsperpage;$i++) {
			if ($i<$filas) { 
				$t1=mssql_result($resultado,$i, "id_productor");	
				$t2=mssql_result($resultado,$i, "nombre_productor");	
				echo ",{'cells':[{'v':'$i'},{'v':'$t1'},{'v':'$t2'}]}\n";
			}
		}
		echo "],'totalRows':".($iniciolectura).",'displayedRows':$filas,'currentPage':$currentpage}\n";					
		break;
	case 'CAMARA':
		echo "{'fields':[\n";	
		echo ",{'title':'Id','columnWidth':'50'}\n";
		echo ",{'title':'Nombre','Nombre del Productor':'100'}\n";
		echo "]\n";
		
		require('include/configuracion.php');
		conexion();

		$sql="select * from pf_camara order by id_camara";
		$filas=0;
		$resultado="";
		ejecutarsql($sql,&$filas,&$resultado);	
		echo ",'rows':[\n";		
		for ($i=$iniciolectura;$i<$iniciolectura+$rowsperpage;$i++) {
			if ($i<$filas) { 
				$t1=mssql_result($resultado,$i, "id_camara");	
				$t2=mssql_result($resultado,$i, "nombre_camara");	
				$t3=mssql_result($resultado,$i, "estado_actual");	
				echo ",{'cells':[{'v':'$i'},{'v':'$t1'},{'v':'$t2'},{'v':'$t3'}]}\n";
			}
		}
		echo "],'totalRows':".($iniciolectura).",'displayedRows':$filas,'currentPage':$currentpage}\n";					
		break;
		
	default:
		echo "{'fields':[\n";	
		echo "{'title':'Item','dataType':'int','columnWidth':'35','columnRange':{'min':1,'minValue':1,'max':139,'maxValue':139}}\n";
		echo ",{'title':'Fecha','columnWidth':'140'}\n";
		echo ",{'title':'Time','dataType':'time','columnWidth':'46'}\n";
		echo ",{'title':'Rate Period','columnWidth':'70','columnRange':{'min':'O','minValue':'O','max':'W','maxValue':'W'}}\n";
		echo ",{'title':'Phone Number','columnWidth':'87'}\n";
		echo ",{'title':'Minutes','dataType':'int','columnWidth':'47','columnRange':{'min':1,'minValue':1,'max':9,'maxValue':9}}\n";
		echo ",{'title':'Total Charges','dataType':'float','columnWidth':'80'}";
		echo "]\n";
		echo ",'rows':[\n";
		echo "{'cells':[{'v':$currentpage},{'v':'11\\/08'},{'v':'09:30AM'},{'v':'P'},{'v':'(911)504-7207'},{'v':1},{'v':0.5}]}\n";
		echo ",{'cells':[{'v':2},{'v':'11\\/08'},{'v':'10:39AM'},{'v':'P'},{'v':'(910) $variable 525-7522aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'},{'v':3},{'v':1.5}]}\n";
		echo ",{'cells':[{'v':3},{'v':'11\\/08'},{'v':'12:11PM'},{'v':'P'},{'v':'(981)483-3140'},{'v':5},{'v':0.7}]}\n";
		echo ",{'cells':[{'v':4},{'v':'11\\/08'},{'v':'03:41PM'},{'v':'P'},{'v':'(910)504-8168'},{'v':2},{'v':0.2}]}\n";
		echo ",{'cells':[{'v':5},{'v':'11\\/09'},{'v':'09:50AM'},{'v':'P'},{'v':'(910)642-8345'},{'v':1},{'v':0.1}]}\n";
		echo ",{'cells':[{'v':6},{'v':'11\\/09'},{'v':'02:49PM'},{'v':'P'},{'v':'(000)000-0086'},{'v':1},{'v':1.23}]}\n";
		echo ",{'cells':[{'v':7},{'v':'11\\/09'},{'v':'03:05PM'},{'v':'P'},{'v':'(910)504-8168'},{'v':6},{'v':0.4}]}\n";
		echo ",{'cells':[{'v':8},{'v':'11\\/09'},{'v':'03:53PM'},{'v':'P'},{'v':'(910)873-0894'},{'v':5},{'v':2}]}\n";
		echo ",{'cells':[{'v':9},{'v':'11\\/10'},{'v':'11:35AM'},{'v':'P'},{'v':'(910)525-7522'},{'v':5},{'v':1}]}\n";
		echo ",{'cells':[{'v':10},{'v':'11\\/10'},{'v':'09:41PM'},{'v':'O'},{'v':'(000)000-0086'},{'v':1},{'v':0.1}]}]\n";
		echo ",'totalRows':".($currentpage*10).",'displayedRows':139,'currentPage':$currentpage}\n";	
		break;

}





?>