D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
var
/
www
/
html
/
rosario
/
adm
/
app
/
gre
/
Views
/
Trade
/
Filename :
VieTradePacoteImprime.php
back
Copy
<?php ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); ob_start(); $path = getcwd(); $Dados = $_GET; $data = strftime('%d de %B de %Y', strtotime('today')); $pacote = new \App\gre\Models\ModTradePacoteLer(); $arr_pacote = $pacote->lerPacote(); $avulso = new \App\gre\Models\ModTradePacoteLer(); $arr_avulso = $avulso->lerAvulso(); //var_dump($arr_avulso); $pacote_ant = 0; $tipo_ant = 0; $sub_tipo_ant = 0; $cont_linha = 9999; $num_linhas = 23; $data_imp = date("d/m/Y H:i:s"); 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_pacote as $pacote) { extract($pacote); if ($cont_linha > $num_linhas) { $pdf->AddPage('L','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(225,12,utf8_decode('CADASTRO DE PACOTES - TRADE' ),1,0,'C'); $pdf->Cell(50,12,utf8_decode($data_imp.' hs'),1,1,'R'); $pdf->SetX(15); $pdf->SetX(15); $pdf->SetFont('Arial','B', 12); $pdf->Cell(225,8,utf8_decode( $plano_nome ),1,0,'C'); $pdf->Cell(50,8, utf8_decode('PREÇO: '. $preco_venda ),'1',1,'C'); $cont_linha = 1; $pdf->SetX(15); $pdf->SetFont('Arial','B', 10); $pdf->Cell(100,6, utf8_decode('GRUPO'),'1',0,'C'); $pdf->Cell(110,6, utf8_decode('AÇÃO'),'1',0,'C'); $pdf->Cell(20,6, utf8_decode('QT.AÇÃO'),'1',0,'C'); $pdf->Cell(20,6, utf8_decode('PERÍODO'),'1',0,'C'); $pdf->Cell(25,6, utf8_decode('BASE'),'1',1,'C'); $pacote_ant = $plano_id; } if($pacote_ant <> $plano_id){ $pdf->AddPage('L','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(225,12,utf8_decode('CADASTRO DE PACOTES - TRADE' ),1,0,'C'); $pdf->Cell(50,12,utf8_decode($data_imp.' hs'),1,1,'R'); $pdf->SetX(15); $pdf->SetFont('Arial','B', 12); $pdf->Cell(225,8,utf8_decode( $plano_nome ),1,0,'C'); $pdf->Cell(50,8, utf8_decode('PREÇO: '. $preco_venda ),'1',1,'C'); $pdf->SetX(15); $pdf->SetFont('Arial','B', 10); $pdf->Cell(100,6, utf8_decode('GRUPO'),'1',0,'C'); $pdf->Cell(110,6, utf8_decode('AÇÃO'),'1',0,'C'); $pdf->Cell(20,6, utf8_decode('QT.AÇÃO'),'1',0,'C'); $pdf->Cell(20,6, utf8_decode('PERÍODO'),'1',0,'C'); $pdf->Cell(25,6, utf8_decode('BASE'),'1',1,'C'); $cont_linha = 2; $pacote_ant = $plano_id; } if($tipo_ant <> $tipo_id){ $pdf->SetX(15); $pdf->SetFont('Arial','B', 10); $pdf->Cell(275,6, utf8_decode(' '. $tipo_nome),'1',1,'L'); $cont_linha = $cont_linha + 1; $tipo_ant = $tipo_id; } $pdf->SetX(15); $pdf->SetFont('Arial','', 10); if ($sub_tipo_ant <> $sub_tipo_id) { $pdf->Cell(100,6, utf8_decode(' '.$sub_tipo_nome),'1',0,'L'); $sub_tipo_ant = $sub_tipo_id; }else{ $pdf->Cell(100,6, utf8_decode(' '),'1',0,'L'); } $pdf->Cell(110,6, utf8_decode($acao_nome),'1',0,'L'); $pdf->Cell(20,6, $qtde_acao,'1',0,'C'); $pdf->Cell(20,6, $periodo,'1',0,'C'); $pdf->Cell(25,6, utf8_decode($base_nome),'1',1,'C'); $cont_linha = $cont_linha + 1; } $pacote_ant = 0; $tipo_ant = 0; $cont_linha = 9999; $num_linhas = 23; foreach ($arr_avulso as $avulso) { extract($avulso); if ($cont_linha > $num_linhas) { $pdf->AddPage('L','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(225,12,utf8_decode('CADASTRO DE PACOTES - TRADE' ),1,0,'C'); $pdf->Cell(50,12,utf8_decode($data_imp.' hs'),1,1,'R'); $pdf->SetX(15); $pdf->SetX(15); $pdf->SetFont('Arial','B', 12); $pdf->Cell(275,8,utf8_decode( $plano_nome ),1,1,'C'); $cont_linha = 1; $pdf->SetX(15); $pdf->SetFont('Arial','B', 10); $pdf->Cell(80,6, utf8_decode('GRUPO'),'1',0,'C'); $pdf->Cell(100,6, utf8_decode('AÇÃO'),'1',0,'C'); $pdf->Cell(20,6, utf8_decode('QT.AÇÃO'),'1',0,'C'); $pdf->Cell(20,6, utf8_decode('PERÍODO'),'1',0,'C'); $pdf->Cell(25,6, utf8_decode('BASE'),'1',0,'C'); $pdf->Cell(30,6, utf8_decode('PREÇO VENDA'),'1',1,'C'); $pacote_ant = $plano_id; } if($pacote_ant <> $plano_id){ $pdf->AddPage('L','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(225,12,utf8_decode('CADASTRO DE PACOTES - TRADE' ),1,0,'C'); $pdf->Cell(50,12,utf8_decode($data_imp.' hs'),1,1,'R'); $pdf->SetX(15); $pdf->SetFont('Arial','B', 12); $pdf->Cell(275,8,utf8_decode( $plano_nome ),1,1,'C'); $pdf->SetX(15); $pdf->SetFont('Arial','B', 10); $pdf->Cell(80,6, utf8_decode('GRUPO'),'1',0,'C'); $pdf->Cell(100,6, utf8_decode('AÇÃO'),'1',0,'C'); $pdf->Cell(20,6, utf8_decode('QT.AÇÃO'),'1',0,'C'); $pdf->Cell(20,6, utf8_decode('PERÍODO'),'1',0,'C'); $pdf->Cell(25,6, utf8_decode('BASE'),'1',0,'C'); $pdf->Cell(30,6, utf8_decode('PREÇO VENDA'),'1',1,'C'); $cont_linha = 2; $pacote_ant = $plano_id; } if($tipo_ant <> $tipo_id){ $pdf->SetX(15); $pdf->SetFont('Arial','B', 10); $pdf->Cell(275,6, utf8_decode(' '. $tipo_nome),'1',1,'L'); $cont_linha = $cont_linha + 1; $tipo_ant = $tipo_id; } $pdf->SetX(15); $pdf->SetFont('Arial','', 10); if ($sub_tipo_ant <> $sub_tipo_id) { $pdf->Cell(80,6, utf8_decode(' '.$sub_tipo_nome),'1',0,'L'); $sub_tipo_ant = $sub_tipo_id; }else{ $pdf->Cell(80,6, utf8_decode(' '),'1',0,'L'); } $pdf->Cell(100,6, utf8_decode($acao_nome),'1',0,'L'); $pdf->Cell(20,6, $qtde_acao,'1',0,'C'); $pdf->Cell(20,6, $periodo,'1',0,'C'); $pdf->Cell(25,6, utf8_decode($base_nome),'1',0,'C'); $pdf->Cell(30,6, utf8_decode($preco_venda_acao),'1',1,'C'); ; $cont_linha = $cont_linha + 1; } $pdf->Output(); ob_end_flush(); ?>