
04/12/2006, 11:02
|
| | Fecha de Ingreso: diciembre-2006
Mensajes: 4
Antigüedad: 18 años, 4 meses Puntos: 0 | |
//OBTENIENDO LA VIGENCIA A TRABAJAR
$vigencia=$_POST['vigencia'];
if($vigencia=="Vigentes")
$vigencia="1";
else
$vigencia="0";
/***********REALIZANDO CONSULTA PARA OBTENER LA INFORMACION PARA EL INFORME*****/
$result = mysql_query("SELECT * FROM alumnos where vigencia='$vigencia'",$conexion)
or die("La consulta contiene algún error:<br>nSQL: <b></b>");
/********************** CREANDO EL INFORME ****************************/
$pdf=new PDF();
$pdf->AddPage();
$pdf->SetMargins(30,40);
//Arial bold 15
$pdf->SetFont('Arial','B',18);
//Movernos a la derecha
$pdf->Cell(80);
//Título
if($vigencia==1)
$pdf->Cell(30,10,"Alumnos Vigentes",0,0,'C');
if($vigencia==0)
$pdf->Cell(30,10,"Alumnos NO Vigentes",0,0,'C');
$pdf->Ln(30);
//$pdf->Cell(80);
$pdf->SetFont('Arial','',12);
$html='<table border="1">
<tr><b>
<td width="50" height="30" ALIGN="" BGCOLOR=" ">Nº</td>
<td width="300" height="30" ALIGN="" BGCOLOR=" ">NOMBRE</td>
<td width="150" height="30" ALIGN="" BGCOLOR=" ">RUT</td>
<td width="150" height="30" ALIGN="" BGCOLOR=" ">TELEFONO</td>
</b></tr>
</table>';
$pdf->WriteHTML($html);
$i=1;
while ($row = mysql_fetch_array($result)){
$html="<table border='1'>
<tr>
<td width='50' height='30' ALIGN='C' BGCOLOR=''>$i</td>
<td width='300' height='30' ALIGN='C' BGCOLOR=''>$row[nombres] $row[apellido_paterno] $row[apellido_materno]</td>
<td width='150' height='30' ALIGN='C' BGCOLOR=''>$row[rut]</td>
<td width='150' height='30' ALIGN='C' BGCOLOR=''>$row[telefono]</td>
</tr>
</table>";
$pdf->WriteHTML($html);
$i++;
}
$pdf->AddPage();
$pdf->Output();
/********************* FIN INFORME *********************/
/****************GENERANDO GRAFICO *******************/
$pdf = new PDF_Diag();
//$pdf->Open();
//$pdf->AddPage();
/***************REALIZAR CONSULTA QUE CUENTE CUANTOS ALUMNOS POR TIPO DE PUBLICIDAD EXISTEN*********/
$vig = mysql_query("SELECT count(vigencia) AS conta FROM alumnos WHERE vigencia=1 ",$conexion)
or die("La consulta contiene algún error:<br>nSQL: <b></b>");
$result_vig=mysql_fetch_array($vig);
$vig2 = mysql_query("SELECT count(vigencia)AS conta FROM alumnos WHERE vigencia=0 ",$conexion)
or die("La consulta contiene algún error:<br>nSQL: <b></b>");
$result_vig2=mysql_fetch_array($vig2);
/**********************ALMACENO LOS VALORES DE LA CONSULTA EN UN VECTOR****************************/
$data = array('Vigente' =>$result_vig['conta'], 'No Vigente' =>$result_vig2['conta']);
/*************grafico de barras****************/
$pdf->SetFont('Arial', 'B', 12);
$pdf->Cell(0,90, ' ALUMNOS POR VIGENCIA', 0,1,'C');
$pdf->Ln(8);
$valX = $pdf->GetX();
$valY = $pdf->GetY();
$pdf->BarDiagram(190, 70, $data, '%l : %v (%p)', array(100,175,100));
$pdf->SetXY($valX, $valY + 80);
$pdf->Output(); |