Bueno de nuevo yo otra vez por acá, mi duda es la sgt:
yo realizo la consulta y hago un reporte(pdf), el cual queda de la sgt manera:CODIGO NIV PNom P ape S APE Concepto
20032042 1 MATEO RODRIGUEZ DEL VALLE actividades bachillerato 500000
20032042 1 MATEO RODRIGUEZ DEL VALLE Pension 1000000 
20032042 1 MATEO RODRIGUEZ DEL VALLE otros 1050000 
20042089 1 DANIEL OTERO GOMEZ actividades bachillerato 500000
20042089 1 DANIEL OTERO GOMEZ Pension 1000000 20042089 1 DANIEL OTERO GOMEZ otros 1050000 
20052015 1 JORGE LUIS GUTIERREZ TRONCOSO actividades bachil 500000
20052015 1 JORGE LUIS GUTIERREZ TRONCOSO Pension 1000000 
20052015 1 JORGE LUIS GUTIERREZ TRONCOSO otros 1050000 
 
entonces lo que yo quiero es hacer lo sgt:
CODIGO NIV PNom P ape S APE Concepto
20032042 1 MATEO RODRIGUEZ DEL VALLE actividades bachillerato 500000
20032042 1 MATEO RODRIGUEZ DEL VALLE Pension 1000000 
20032042 1 MATEO RODRIGUEZ DEL VALLE otros 1050000 
subtotal****************************************** ******* 2550000
 
20042089  1 DANIEL OTERO GOMEZ actividades bachillerato 500000
20042089 1 DANIEL OTERO GOMEZ Pension 1000000 20042089 1 DANIEL OTERO GOMEZ otros 1050000 
subtotal****************************************** ******* 2550000
 
20052015 1 JORGE LUIS GUTIERREZ TRONCOSO actividades bachil 500000
20052015 1 JORGE LUIS GUTIERREZ TRONCOSO Pension 1000000 
20052015 1 JORGE LUIS GUTIERREZ TRONCOSO otros 1050000
subtotal****************************************** ******* 2550000
 
total pension******************************************* ** 3000000
 
total actividades bachillerato*********************************15000 00
 
total otros********************************************* **3150000
 
total********************************************* *******7650000
 
lo debo hacer en php, el código que tengo hasta ahora es este
$sql="SELECT     facPreli.preCodEst, facPreli.preValor, nucEstu.estPriNom, nucEstu.estSegNom, nucEstu.estPriApe, nucEstu.estSegApe, facConcep.conDescrip, 
                      facPreli.prePerCau
 
 
 
FROM         facPreli INNER JOIN
                      nucEstu ON facPreli.preCodEst = nucEstu.estCod INNER JOIN
                      facConcep ON facPreli.preCodCon = facConcep.conCodigo
GROUP BY nucEstu.estSegNom, facPreli.preCodEst, facPreli.preValor, nucEstu.estPriNom, nucEstu.estPriApe, nucEstu.estSegApe, facConcep.conDescrip, facPreli.prePerCau"; //realiza la busqueda en la b.d
// ejecutamos la consulta 
$rs = odbc_exec( $conexion, $sql ) or die ( "Error en la consulta SQL" );
//initialize counter 
$i = 0; 
 
//Set maximum rows per page 
$max = 75; 
 
//Set Row Height 
//$row_height = 1; 
 
while($row =odbc_fetch_array($rs)) 
{ 
 
 
    //If the current row is the last one, create new page and print column title 
    if ($i == $max) 
    { 
        $pdf->AddPage(); 
        $y_axis=40;
 
        //print column titles for the current page 
        $pdf->SetY($y_axis_initial); 
        $pdf->SetX(8); 
		$pdf->Cell(12,3,'CODIGO',1,0,'C',1); 
        $pdf->Cell(30,3,'PRIMER_NOMBRE',1,0,'C',1);
        $pdf->Cell(30,3,'SEGUNDO_NOMBRE',1,0,'C',1);
        $pdf->Cell(30,3,'PRIMER_APELLIDO',1,0,'C',1);
        $pdf->Cell(30,3,'SEGUNDO_APELLIDO',1,0,'C',1); 
        $pdf->Cell(25,3,'PERIODO',1,0,'C',1);
		$pdf->Cell(25,3,'CONCEPTO',1,0,'C',1); 
        $pdf->Cell(15,3,'VALOR',1,0,'C',1); 
 
 
        //Go to next row 
        $y_axis = $y_axis + $row_height; 
 
        //Set $i variable to 0 (first row) 
        $i = 0; 
    } 
    $Codigo=$row['preCodEst']; 
    $PriNomb=$row['estPriNom'];
    $SegNomb=$row['estSegNom'];
    $PriApe=$row['estPriApe'];
    $SegApe=$row['estSegApe']; 
    $Periodo=$row['prePerCau'];
    $Concep=$row['conDescrip']; 
    $Valor=$row['preValor'];
 
 
    $pdf->SetY($y_axis); 
    $pdf->SetX(8); 
	$pdf->Cell(12,3,$Codigo,1,0,'L'); 
    $pdf->Cell(30,3,$PriNomb,1,0,'L');
    $pdf->Cell(30,3,$SegNomb,1,0,'L');
    $pdf->Cell(30,3,$PriApe,1,0,'L');
    $pdf->Cell(30,3,$SegApe,1,0,'L'); 
    $pdf->Cell(25,3,$Periodo,1,0,'C'); 
    $pdf->Cell(25,3,$Concep,1,0,'C');
    $pdf->Cell(15,3,$Valor,1,0,'R'); 
 
    //Go to next row 
    $y_axis = $y_axis + $row_height; 
    $i = $i + 1; 
} 
  
 

