D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
var
/
www
/
html
/
rosario
/
adm
/
app
/
gre
/
Views
/
Trade
/
Filename :
VieTradeRepasseImprime.php
back
Copy
<?php ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); ob_start(); $path = getcwd(); //VAR_DUMP(URLFPDF); $Dados = $_GET; //var_dump($Dados); $Lanc = new \App\gre\Models\ModTradeRepasseLer(); $arr = $Lanc->lerLanc($Dados); $num_linhas = 35; $cont_linha = 9999; $total_repasse = 0; $total_meta = 0; $total_realizado = 0; $inicio = ''; $fim = ''; //var_dump($arr); //REQUIRE($_SERVER['DOCUMENT_ROOT'].'idoso/adm/app/gre/Views/include/fpdf/fpdf.php'); $data_imp = date("d/m/Y H:i:s"); //REQUIRE($_SERVER['DOCUMENT_ROOT'].URLFPDF.'app/gre/Views/include/fpdf/fpdf.php'); REQUIRE($_SERVER['DOCUMENT_ROOT'].'/rosario/adm/app/gre/Views/include/fpdf/fpdf.php'); define('FPDF_FONTPATH','font/'); $pdf = new FPDF(); $pdf->SetAutoPageBreak(0); foreach ($arr as $lcto) { extract($lcto); if ($cont_linha > $num_linhas) { if($cont_linha = 9999) { $inicio = $mesanoini; $fim = $mesanofim; } $pdf->AddPage('P','A4'); $pdf->SetFont('Arial','B',12 ); $pdf->SetX(15); $pdf->Image(URLADM . 'assets/imagens/logo_login/logo.png',20,11,15,0,'PNG'); $pdf->Cell(140,12,utf8_decode('DEMONSTRATIVO DE VERBAS ' ),1,0,'C'); $pdf->Cell(50,12,utf8_decode($data_imp.' hs'),1,1,'R'); $pdf->SetX(15); $pdf->Cell(130,10,utf8_decode($marca_nome ),1,0,'C'); $pdf->Cell(60,10,utf8_decode('De: '. $inicio. ' à '. $fim) ,1,1,'C'); $pdf->SetX(15); $pdf->SetFont('arial','B',10); $pdf->Cell(20,7, utf8_decode('MES/ANO'),'1',0,'C'); $pdf->SetFont('arial','B',10); $pdf->Cell(50,7, utf8_decode('BASE DO REPASSE'),'1',0,'C'); $pdf->SetFont('arial','B',10); $pdf->Cell(30,7, utf8_decode('META'),'1',0,'C'); $pdf->SetFont('arial','B',10); $pdf->Cell(30,7, utf8_decode('REALIZADO'),'1',0,'C'); $pdf->SetFont('arial','B',10); $pdf->Cell(15,7, utf8_decode('ATING.'),'1',0,'C'); $pdf->Cell(15,7, utf8_decode('%'),'1',0,'C'); $pdf->Cell(30,7, utf8_decode('VERBA'),'1',1,'C'); $cont_linha = 0; } $pdf->SetX(15); $pdf->SetFont('arial','',10); $pdf->Cell(20,7, utf8_decode($mesano),1,0,'C'); $pdf->Cell(50,7, utf8_decode($tipo_nome),1,0,'C'); $pdf->Cell(30,7, number_format($valor,2,',','.'),1,0,'R'); if($tipo_contrato_id == 2){ if($compra > 0) { $atingido = round((( $compra)*100 / $valor), 1); }else{ $atingido = 0; } $pdf->Cell(30,7, number_format($compra,2,',','.'),1,0,'R'); $total_realizado += $compra; }elseif ($tipo_contrato_id == 3){ if($venda > 0) { $atingido = round((($valor - $venda) / $valor)*100, 1); }else{ $atingido = 0; } $pdf->Cell(30,7, number_format($venda,2,',','.'),1,0,'R'); $total_realizado += $venda; } $pdf->Cell(15,7, number_format($atingido,1,',','.').'%',1,0,'C'); $pdf->Cell(15,7, number_format($percentual,2,',','.').'%',1,0,'C'); if($tipo_contrato_id == 2){ if($atingido > 99.9) { $repasse = round($compra *($percentual/100), 2); }else{ $repasse = 0; } $pdf->Cell(30,7, number_format($repasse,2,',','.'),1,1,'R'); } $total_repasse += $repasse; $total_meta += $valor; $cont_linha = $cont_linha + 1; } $pdf->SetX(15); $pdf->SetFont('arial','B',10); $pdf->Cell(70,7, utf8_decode('Totais no período: '),'1',0,'R'); $pdf->Cell(30,7, 'R$ '.number_format($total_meta,2,',','.'),1,0,'R'); $pdf->Cell(30,7, 'R$ '.number_format($total_realizado,2,',','.'),1,0,'R'); $perc = round((($total_realizado/$total_meta)*100),2); $pdf->Cell(15,7, number_format($perc,1,',','.').'%',1,0,'R'); $pdf->Cell(30,7, 'R$ '.number_format($total_repasse,2,',','.'),1,1,'R'); $pdf->Output(); ?>