viernes, 16 de enero de 2015

Ejemplo de reporte en scriptcase


//variables
$ideperiodoevaluar=[evacodperiodo] ;//4;//eva_periodo
$ideuser=[sm_global_login]; //79864589;
$idecolegioperiodo=[codcolegioperiodo];//159;//col_colegio_periodo
list($nomdoc, $apedoc,$tipodoc)=return_datospersonales($ideuser);
list($nomperevalua,$fecperevalua,$nomperacadem)= return_datosperiodo($ideperiodoevaluar);
//DATOS PARA LLENAR EL REPORTE
list($nestudiates, $promestudiantes, $evalestudiantes, $docporcentaj)=return_evaldocente($idecolegioperiodo, $ideuser, $ideperiodoevaluar);
$promestudiantes=round($promestudiantes,2);
$docporcentajapl=round(($promestudiantes*$docporcentaj)/100,2);

list($promjefe, $dirporcentaj)=return_evaldirector($idecolegioperiodo, $ideperiodoevaluar, 15, 2, $ideuser);
$promjefe=round($promjefe,2);
$dirporcentajapl=round(($promjefe*$dirporcentaj)/100,2);

list($promautoeval, $autporcentaj)=return_evalauto($idecolegioperiodo, $ideperiodoevaluar, 2, 2, $ideuser);
$promautoeval=round($promautoeval,2);
$autporcentajapl=round(($promautoeval*$autporcentaj)/100,2);

$promcuantitativo = round(($promestudiantes+$promjefe+$promautoeval)/3,2);

//cosultamos la escala
$escala = array();$txt_escala='';
$descualitativo='NO APLICA';
$check_sql = "SELECT
    eva_escalavalores.val_inicial
    , eva_escalavalores.val_final
    , eva_escalavalores.val_letrasdescripcion
    , eva_escalavalores.val_letrassiglas
FROM
    eva_escalavalores
    INNER JOIN eva_escala 
        ON (eva_escalavalores.ide_escala = eva_escala.ide_escala)
    INNER JOIN eva_periodo 
        ON (eva_periodo.ide_escala = eva_escala.ide_escala)
WHERE (eva_periodo.cod_periodo ='".$ideperiodoevaluar."')
ORDER BY val_inicial, val_final";
sc_select(rs, $check_sql);
if (false == {rs})     // Error while accessing database
{
    sc_error_message('Error while accessing database.');
}
else
{
$i=0;
   while(!$rs->EOF)
    {
$escala[$i]['ini']= $rs->fields[0];
$escala[$i]['end']= $rs->fields[1];
$escala[$i]['des']= $rs->fields[2];
$escala[$i]['sig']= $rs->fields[3];
$txt_escala.=$rs->fields[2].'('.$rs->fields[0].'-'.$rs->fields[1].')  ';
//consultamos el cualitativo
if($promcuantitativo>=$rs->fields[0] && $promcuantitativo<=$rs->fields[1])
{
$descualitativo=$rs->fields[2];
} 
$i++;
$rs->MoveNext();
    }
    $rs->Close();
}

$pdf=new PDF();
$pdf->AddPage('P','Letter');
$pdf->SetMargins(10, 20, 10);
$pdf->SetFillColor(211,211,211);
$pdf->SetDrawColor(192,192,192);
$pdf->SetFont('Times','B',12);
$pdf->Ln(10);
$pdf->Cell(10);
$pdf->Cell(60,8,'NOMBRES Y APELLIDOS ' ,0,0,'L');
$pdf->SetFont('Times','',12);
$pdf->Cell(110,8,$nomdoc." ".$apedoc ,1,0,'C');
$pdf->SetFont('Times','B',12);
$pdf->Ln(9);
$pdf->Cell(10);
$pdf->Cell(60,8,'PERIODO EVALUADO' ,0,0,'L');
$pdf->SetFont('Times','',12);
$pdf->Cell(110,8,$nomperevalua ,1,0,'C');
$pdf->SetFont('Times','B',12);
$pdf->Ln(9);
$pdf->Cell(10);
$pdf->Cell(60,8,'FECHA ',0,0,'L');
$pdf->SetFont('Times','',12);
$pdf->Cell(110,8,$fecperevalua ,1,0,'C');
$pdf->SetFont('Times','B',10);
$pdf->Ln(12);
$pdf->Cell(10);
$pdf->Cell(60,8,'CUANTITATIVO',1,0,'C');
$pdf->Cell(60,8,'REFERENTE' ,1,0,'C');
$pdf->Cell(15,8,'NOTA' ,1,0,'C');
$pdf->Cell(35,8,'PORCENTAJE' ,1,0,'C');
//$pdf->Cell(20,8,'%' ,1,0,'C');
$pdf->SetFont('Times','',10);
$pdf->Ln(8);
$pdf->Cell(10);
$pdf->Cell(60,8,$promcuantitativo,1,0,'C');
$pdf->Cell(60,8,'Estudiantes ('.$evalestudiantes.'/'.$nestudiates.')' ,1,0,'C');
$pdf->Cell(15,8,$promestudiantes ,1,0,'C');
$pdf->Cell(35,8,$docporcentaj.'% - '.$docporcentajapl ,1,0,'C');
//$pdf->Cell(20,8,$docporcentaj.'%' ,1,0,'C');
$pdf->Ln(8);
$pdf->Cell(10);
$pdf->SetFont('Times','B',10);
$pdf->Cell(60,8,'CUALITATIVO',1,0,'C');
$pdf->SetFont('Times','',10);
$pdf->Cell(60,8,'Director de Programa' ,1,0,'C');
$pdf->Cell(15,8,$promjefe ,1,0,'C');
$pdf->Cell(35,8,$dirporcentaj.'% - '.$dirporcentajapl,1,0,'C');
//$pdf->Cell(20,8,$dirporcentaj.'%' ,1,0,'C');
$pdf->Ln(8);
$pdf->Cell(10);
$pdf->Cell(60,8,$descualitativo,1,0,'C');
$pdf->Cell(60,8,'Autoevaluacion' ,1,0,'C');
$pdf->Cell(15,8,$promautoeval ,1,0,'C');
$pdf->Cell(35,8,$autporcentaj.'% - '.$autporcentajapl ,1,0,'C');
//$pdf->Cell(20,8,$autporcentaj.'%' ,1,0,'C');
$pdf->Ln(8);
$pdf->SetFont('Times','I',8);
$pdf->Cell(0,8,$txt_escala,0,0,'C');
$pdf->SetFont('Times','B',9);
//IMPRIME GRAFICA
$data = array('Estudiantes' => $promestudiantes, 'Director Programa' => $promjefe, 'Autoevaluacion' => $promautoeval);
$pdf->Ln(8);
$valX = $pdf->GetX();
$valY = $pdf->GetY();
$pdf->BarDiagram(170, 60, $data, '%l: %v(%p)', array(126,134,220));
$pdf->SetXY($valX, $valY + 80);

//IMPRIME FIRMA DEL VICERRECTOR
$pdf->SetFont('Times','',12);
list($_idevice,$_nomvice, $_apevice, $_firvice) = return_viceacademico();
$pdf->Ln(10);
$x=$pdf->GetX()+70;
$y=$pdf->GetY();
$pdf->Image('../_lib/file/imgimg_firmapersonal/'.$_firvice,$x,$y);
$pdf->Ln(25);
$pdf->Cell(0,5,$_nomvice.' '.$_apevice,0,1,'C');
$pdf->Cell(0,5,'VICERRECTOR ACADÉMICO',0,1,'C');

//IMPRIME LAS OBSERVACIONES SI EXISTEN
$existen=0;
$check_sql = "SELECT
    eva_cuestionario_estudiantedocente.observacion
    , eva_cuestionario_estudiantedocente.fec_evaluacion
FROM
    col_colegio_periodo
    INNER JOIN col_periodo 
        ON (col_colegio_periodo.cod_periodo = col_periodo.cod_periodo)
    INNER JOIN eva_periodo 
        ON (eva_periodo.cod_periodoacademico = col_periodo.cod_periodo)
    INNER JOIN eva_fechaevaluacion 
        ON (eva_fechaevaluacion.cod_periodo = eva_periodo.cod_periodo)
    INNER JOIN eva_cuestionario_estudiantedocente 
        ON (eva_cuestionario_estudiantedocente.ide_fechaevaluacion = eva_fechaevaluacion.ide_fechaevaluacion)
    INNER JOIN col_colegio_asignatura_docente 
        ON (eva_cuestionario_estudiantedocente.cod_colegioasignaturadocente = col_colegio_asignatura_docente.cod_colegio_asignatura_docente)
WHERE (col_colegio_periodo.cod_colegio_periodo ='".$idecolegioperiodo."'
    AND eva_periodo.cod_periodo ='".$ideperiodoevaluar."'
    AND col_colegio_asignatura_docente.ide_persona ='".$ideuser."'
    AND eva_cuestionario_estudiantedocente.observacion IS NOT NULL)";

sc_select(rs, $check_sql);
if (false == {rs})     // Error while accessing database
{
    sc_error_message('Error while accessing database.');
}
else
{
   while(!$rs->EOF)
    {
if($existen==0)
{
$pdf->AddPage('P','Letter');
$pdf->SetFont('Times','B',16);
$pdf->Cell(0,8,'OBSERVACIONES',0,1,'C');
$pdf->Ln(5);
$pdf->SetFont('Times','B',12);
$pdf->Cell(10);
$pdf->Cell(60,8,'NOMBRES Y APELLIDOS ' ,0,0,'L');
$pdf->SetFont('Times','',12);
$pdf->Cell(110,8,$nomdoc." ".$apedoc ,1,0,'C');
$pdf->SetFont('Times','B',12);
$pdf->Ln(9);
$pdf->Cell(10);
$pdf->Cell(60,8,'PERIODO EVALUADO' ,0,0,'L');
$pdf->SetFont('Times','',12);
$pdf->Cell(110,8,$nomperevalua ,1,0,'C');
$pdf->SetFont('Times','B',12);
$pdf->Ln(9);
$pdf->Cell(10);
$pdf->Cell(60,8,'FECHA ',0,0,'L');
$pdf->SetFont('Times','',12);
$pdf->Cell(110,8,$fecperevalua ,1,0,'C');
$pdf->SetFont('Times','B',10);
$pdf->Ln(10);
$existen=1;
} 
$obs= $rs->fields[0];
$fec= $rs->fields[1];
$obs= utf8_decode($obs);
$pdf->SetFont('Times','',10);
$pdf->MultiCell(0, 8, '['.$fec.'] '.$obs, 1, 'J');
$pdf->Ln(5);
$rs->MoveNext();
    }
    $rs->Close();
}

$pdf->output();

No hay comentarios:

Publicar un comentario

Visualizador de windows predefinido para abrir imagenes

 abrir regedit Equipo\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations nuevas entrada valor de todas...