D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
var
/
www
/
html
/
crsys_ant
/
adm
/
app
/
gre
/
Views
/
Material
/
Filename :
VieMaterialImprime.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($Dados); $data = strftime('%d de %B de %Y', strtotime('today')); $mat = new \App\gre\Models\Material\ModLerMaterial(); $arr_material = $mat->listarMaterial(); //var_dump($arr_material); //die; $num_linhas = 28; $cont_linha = 9999; date_default_timezone_set ("America/Sao_Paulo"); $data_imp = date("d/m/Y H:i"); REQUIRE($_SERVER['DOCUMENT_ROOT'].'/crsys/adm/app/gre/Views/include/fpdf/fpdf.php'); define('FPDF_FONTPATH','font/'); $pdf = new FPDF(); $pdf->SetAutoPageBreak(0); $pdf->AddPage('L','A4'); foreach ($arr_material as $mat) { extract($mat); if ($cont_linha > $num_linhas) { if ($cont_linha <> 9999) { $pdf->AddPage('L','A4'); } $pdf->SetX(5); $pdf->SetFont('Arial','B',10 ); $pdf->Image(URLADM . 'assets/imagens/logo_login/logo.png',17,13,15,0,'PNG'); $pdf->Cell(190,11,utf8_decode('LISTA DE MATERIAIS' ),1,0,'C'); $pdf->Cell(45,11,utf8_decode('MB-P: ' ).number_format($margem_padrao,2,',','.'),1,0,'C'); $pdf->Cell(50,11,utf8_decode($data_imp ).'hs',1,1,'C'); $pdf->SetX(5); $pdf->Cell(10,11,utf8_decode('CÓD.'),1,0,'C'); $pdf->Cell(100,11,utf8_decode('NOME MATERIAL'),1,0,'C'); $pdf->Cell(40,11,utf8_decode('BENEFICIAMENTO'),1,0,'C'); $pdf->Cell(27,11,utf8_decode('PREÇO CUSTO'),1,0,'C'); $pdf->Cell(27,11,utf8_decode('PR.MAT'),1,0,'C'); $pdf->Cell(27,11,utf8_decode('PR.BENEF'),1,0,'C'); $pdf->Cell(27,11,utf8_decode('PR.VENDA'),1,0,'C'); $pdf->Cell(27,11,utf8_decode('MB'),1,1,'C'); $cont_linha = 0; } $pdf->SetX(5); $pdf->SetFont('Arial','', 10); $pdf->Cell(10,6, $codigo_material ,'1',0,'L'); $pdf->Cell(100,6, utf8_decode($nome_material) ,'1',0,'L'); $pdf->Cell(40,6, utf8_decode($nome_beneficiamento) ,'1',0,'L'); $pdf->Cell(27,6, number_format($preco_custo,2,',','.') ,'1',0,'R'); $pdf->Cell(27,6, number_format($preco_venda,2,',','.') ,'1',0,'R'); $pdf->Cell(27,6, number_format($preco_beneficiamento,2,',','.') ,'1',0,'R'); $pdf->Cell(27,6, number_format($preco_total,2,',','.') ,'1',0,'R'); if($margem < $margem_padrao) { $pdf->Cell(27,6, number_format($margem,2,',','.').'%*' ,'1',1,'R'); }else{ $pdf->Cell(27,6, number_format($margem,2,',','.').'% ' ,'1',1,'R'); } $cont_linha ++; } /* 'codigo_material' => string '111' (length=3) 'nome_material' => string 'A definir' (length=9) 'padrao' => string '0' (length=1) 'nome_beneficiamento' => string 'Padrao' (length=6) 'preco_custo' => string '0.00' (length=4) 'preco_venda' => string '0.00' (length=4) 'preco_beneficiamento' => string '0.00' (length=4) 'preco_total' => string '0.00' (length=4) 'margem' => null $pdf->Cell(43,6, 'CPF: '.utf8_decode($cpfi) ,'T',0,'L'); $pdf->SetFont('Arial','', 11); $pdf->Cell(90,6, 'Nome: '.utf8_decode($titu_nome) ,'TR',1,'L'); $pdf->SetX(15); $pdf->SetFont('Arial','', 11); $pdf->Cell(48,6, 'Celular: '.utf8_decode($celular) ,'L',0,'L'); $pdf->Cell(40,6, 'Nasc: '.utf8_decode($nascimento) ,'',0,'L'); $pdf->Cell(50,6, 'Incluido em: '.utf8_decode($data_inclusao) ,'',0,'L'); $pdf->Cell(40,6, utf8_decode('Situação: ').utf8_decode($situ_nome) ,'R',1,'L'); $pdf->SetX(15); $pdf->SetFont('Arial','', 11); $pdf->Cell(178,6, utf8_decode('Endereço: '.$endereco) ,'LR',1,'L'); $cont_linha = $cont_linha + 5; $pdf->SetX(15); if($nome_pagador <> ''){ $pdf->Cell(63,6, 'CPF Pagador: '.utf8_decode($cpf_pagador) ,'L',0,'L'); $pdf->SetFont('Arial','', 11); $pdf->Cell(115,6, 'Nome Pagador: '.utf8_decode($nome_pagador) ,'R',1,'L'); $pdf->SetFont('Arial','', 11); $pdf->SetX(15); $pdf->Cell(178,6, 'Celular Pagador: '.utf8_decode($celular_pagador) ,'LR',1,'L'); $cont_linha = $cont_linha + 2; } $pdf->SetX(15); if ($empr_nome == '') { $pdf->Cell(178,6, 'Cidade: '.utf8_decode($municipio) ,'LRB',1,'L'); }else{ $pdf->Cell(68,6, 'Cidade: '.utf8_decode($municipio) ,'LB',0,'L'); $pdf->Cell(110,6, 'Empresa: '.utf8_decode($empr_nome) ,'RB',1,'L'); } $pdf->SetX(15); $pdf->SetFont('Arial','', 11); $pdf->SetX(50); $pdf->SetFont('Arial','', 12); */ $pdf->Output(); ob_end_flush(); ?>