| Server IP : 20.75.53.88 / Your IP : 216.73.217.72 [ Web Server : Apache System : Linux VMRALP-3 4.4.0-256-generic #290~14.04.1-Ubuntu SMP Thu Jun 20 09:24:50 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29+esm15 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, Domains : 3 Domains MySQL : ON | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/merenda/vicosa23/modulos/cardapio/ |
Upload File : |
<?php
/**
* Created by PhpStorm.
* User: RalpAlves
* Date: 14/01/2016
* Time: 09:02
*/
include_once("../../includes/conexao.php");
include "../../fpdf/fpdf.php";
session_start();
$entida = $_SESSION['prefeitura'];
$secret = $_SESSION['secretaria'];
$v_id = $_GET['id'];
$ano = date('Y');
$rs_sql = mysql_query("SELECT * FROM v_lista_preparacao WHERE pre_id=$v_id");
$row = mysql_fetch_array($rs_sql);
$rs_ip = mysql_query("SELECT * FROM v_lista_preparacao_prod WHERE prd_preid=$v_id");
$rs_tp = mysql_query("SELECT * FROM v_lista_preparacao_prod_tot where cod_pre = $v_id");
$p = mysql_fetch_array($rs_tp);
class PDF extends FPDF
{
public function Header()
{
global $entida;
global $secret;
global $row;
$this->AliasNbPages();
$this->image('../../logo/logo.jpg', 10, 10, 40);
$this->SetFont('Arial', 'B', 12);
$this->Cell(0, 5, $entida, 0, 1, "C");
$this->Cell(0, 5, $secret, 0, 1, "C");
$this->SetFont('Arial', 'B', 10);
$this->Cell(0, 5, 'Preparação nº ' . $row['pre_id'], 0, 1, "C");
$this->Ln(3);
$this->Cell(0, 1, "", "B", 1);
}
function Footer()
{
$this->SetY(-17);
$this->Cell(0, 4, "", "B", 1);
$this->SetFont('Arial', '', 8);
$this->Cell(0, 4, 'Emiss�o: ' . date('d/m/Y'), 0, 0, "L");
$this->Cell(0, 4, 'SGAE | Gestão da Merenda Escolar', 0, 0, 'R');
}
}
$pdf = new PDF();
$pdf->AddPage('Portrait', 'A4');
$pdf->SetFont('Arial', 'B', 9);
$pdf->Cell(60, 5, 'Data', 0, 0, "L");
$pdf->Cell(60, 5, 'Tipo card�pio', 0, 0, "L");
$pdf->Cell(60, 5, 'Tipo prepara��o', 0, 1, "L");
$pdf->SetFont('Arial', '', 7);
$pdf->Cell(60, 5, date('d/m/Y', strtotime($row['pre_data'])), 0, 0, "L");
$pdf->Cell(60, 5, utf8_decode($row['tpe_tipoescola']), 0, 0, "L");
$pdf->Cell(60, 5, utf8_decode($row['tpr_tipo']), 0, 1, "L");
$pdf->Ln(1);
$pdf->SetFont('Arial', 'B', 9);
$pdf->Cell(60, 5, 'Prepara��o', 0, 0, "L");
$pdf->Cell(60, 5, 'Medida', 0, 1, "L");
$pdf->SetFont('Arial', '', 7);
$pdf->Cell(60, 5, utf8_decode($row['pre_nmpreparacao']), 0, 0, "L");
$pdf->Cell(60, 5, utf8_decode($row['med_desc']), 0, 1, "L");
$pdf->Ln(1);
$pdf->SetFont('Arial', 'B', 9);
$pdf->Cell(60, 5, 'Modo preparo', 0, 1, "L");
$pdf->SetFont('Arial', '', 7);
$pdf->SetFillColor(255, 255, 255);
$pdf->MultiCell(190, 5, utf8_decode($row['pre_modopreparo']), 0, 1, "L");
$pdf->Ln(1);
$pdf->SetFont('Arial', 'B', 9);
$pdf->Cell(60, 5, 'Observa��es/Medidas', 0, 1, "L");
$pdf->SetFont('Arial', '', 7);
$pdf->SetFillColor(255, 255, 255);
$pdf->MultiCell(190, 5, utf8_decode($row['pre_obs']), 0, 1, "L");
//itens da preparacao
$pdf->Ln(3);
$pdf->Cell(0, 1, "", "B", 1);
$pdf->SetFont('Arial', 'B', 9);
$pdf->Cell(190, 5, 'Itens da prepara��o', 0, 1, "C");
$pdf->Cell(0, 1, "", "B", 1);
$pdf->SetFont('Arial', '', 7);
$pdf->Cell(57, 5, 'Produto', 0, 0, "L");
$pdf->Cell(10, 5, "Cal.", '', 0, 'R');
$pdf->Cell(10, 5, "Carb.", '', 0, 'R');
$pdf->Cell(10, 5, "Prot.", '', 0, 'R');
$pdf->Cell(10, 5, "Lip.", '', 0, 'R');
$pdf->Cell(10, 5, "Fib.", '', 0, 'R');
$pdf->Cell(10, 5, "Vit. A", '', 0, 'R');
$pdf->Cell(10, 5, "Vit. C", '', 0, 'R');
$pdf->Cell(10, 5, "C�l.", '', 0, 'R');
$pdf->Cell(10, 5, "Ferro", '', 0, 'R');
$pdf->Cell(10, 5, "Mag.", '', 0, 'R');
$pdf->Cell(10, 5, "Zinco", '', 0, 'R');
$pdf->Cell(10, 5, "S�dio", '', 0, 'R');
$pdf->Cell(10, 5, "PC", '', 1, 'R');
$pdf->Cell(0, 1, "", "B", 1);
$i = 0;
while ($l = mysql_fetch_array($rs_ip)) {
$pdf->SetFont('Arial', '', 7);
$pdf->Cell(57, 5, utf8_decode($l['pro_produto']), 0, 0, "L");
$pdf->Cell(10, 5, number_format($l['prd_energia'], 2, ',', '.'), '', 0, 'R');
$pdf->Cell(10, 5, number_format($l['prd_carboidrato'], 2, ',', '.'), '', 0, 'R');
$pdf->Cell(10, 5, number_format($l['prd_proteinas'], 2, ',', '.'), '', 0, 'R');
$pdf->Cell(10, 5, number_format($l['prd_lipidios'], 2, ',', '.'), '', 0, 'R');
$pdf->Cell(10, 5, number_format($l['prd_fibras'], 2, ',', '.'), '', 0, 'R');
$pdf->Cell(10, 5, number_format($l['prd_vitamina_a'], 2, ',', '.'), '', 0, 'R');
$pdf->Cell(10, 5, number_format($l['prd_vitamina_c'], 2, ',', '.'), '', 0, 'R');
$pdf->Cell(10, 5, number_format($l['prd_calcio'], 2, ',', '.'), '', 0, 'R');
$pdf->Cell(10, 5, number_format($l['prd_ferro'], 2, ',', '.'), '', 0, 'R');
$pdf->Cell(10, 5, number_format($l['prd_magnesio'], 2, ',', '.'), '', 0, 'R');
$pdf->Cell(10, 5, number_format($l['prd_zinco'], 2, ',', '.'), '', 0, 'R');
$pdf->Cell(10, 5, number_format($l['prd_sodio'], 2, ',', '.'), '', 0, 'R');
$pdf->Cell(10, 5, number_format($l['prd_percapta'], 2, ',', '.'), '', 1, 'R');
$i++;
}
$pdf->Cell(0, 1, "", "B", 1);
$pdf->SetFont('Arial', 'B', 8);
$pdf->Cell(0, 5, 'Itens: ' . $i, 0, 1, "R");
//Totais da preparacao
$pdf->Ln(3);
$pdf->Cell(0, 1, "", "B", 1);
$pdf->SetFont('Arial', 'B', 9);
$pdf->Cell(190, 5, 'Totais da prepara��o', 0, 1, "C");
$pdf->Cell(0, 1, "", "B", 1);
$pdf->SetFont('Arial', '', 7);
$pdf->Cell(16, 5, "Cal.", '', 0, 'C');
$pdf->Cell(16, 5, "Carb.", '', 0, 'C');
$pdf->Cell(16, 5, "Prot.", '', 0, 'C');
$pdf->Cell(16, 5, "Lip.", '', 0, 'C');
$pdf->Cell(16, 5, "Fib.", '', 0, 'C');
$pdf->Cell(16, 5, "Vit. A", '', 0, 'C');
$pdf->Cell(16, 5, "Vit. C", '', 0, 'C');
$pdf->Cell(16, 5, "C�l.", '', 0, 'C');
$pdf->Cell(16, 5, "Ferro", '', 0, 'C');
$pdf->Cell(16, 5, "Mag.", '', 0, 'C');
$pdf->Cell(16, 5, "Zinco", '', 0, 'C');
$pdf->Cell(16, 5, "S?dio", '', 1, 'C');
$pdf->Cell(0, 1, "", "B", 1);
//
$pdf->SetFont('Arial', '', 7);
$pdf->Cell(16, 5, number_format($p['energia'], 2, ',', '.'), '', 0, 'C');
$pdf->Cell(16, 5, number_format($p['carboidrato'], 2, ',', '.'), '', 0, 'C');
$pdf->Cell(16, 5, number_format($p['proteina'], 2, ',', '.'), '', 0, 'C');
$pdf->Cell(16, 5, number_format($p['lipidio'], 2, ',', '.'), '', 0, 'C');
$pdf->Cell(16, 5, number_format($p['fibras'], 2, ',', '.'), '', 0, 'C');
$pdf->Cell(16, 5, number_format($p['vit_a'], 2, ',', '.'), '', 0, 'C');
$pdf->Cell(16, 5, number_format($p['vit_c'], 2, ',', '.'), '', 0, 'C');
$pdf->Cell(16, 5, number_format($p['calcio'], 2, ',', '.'), '', 0, 'C');
$pdf->Cell(16, 5, number_format($p['ferro'], 2, ',', '.'), '', 0, 'C');
$pdf->Cell(16, 5, number_format($p['magnesio'], 2, ',', '.'), '', 0, 'C');
$pdf->Cell(16, 5, number_format($p['zinco'], 2, ',', '.'), '', 0, 'C');
$pdf->Cell(16, 5, number_format($p['sodio'], 2, ',', '.'), '', 1, 'C');
$pdf->Cell(0, 1, "", "B", 1);
ob_clean();
$pdf->Output('preparacoes.pdf', 'I');
exit;