|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace NFePHP\DA\BPe; |
|
4
|
|
|
/** |
|
5
|
|
|
* Classe para a impressão em PDF do Documento Auxiliar de NFe Consumidor |
|
6
|
|
|
* NOTA: Esta classe não é a indicada para quem faz uso de impressoras térmicas ESCPOS |
|
7
|
|
|
* |
|
8
|
|
|
* @category Library |
|
9
|
|
|
* @package nfephp-org/sped-da |
|
10
|
|
|
* @copyright 2009-2019 NFePHP |
|
11
|
|
|
* @license http://www.gnu.org/licenses/lesser.html LGPL v3 |
|
12
|
|
|
* @link http://github.com/nfephp-org/sped-da for the canonical source repository |
|
13
|
|
|
* @author Roberto Spadim <roberto at spadim dot com dot br> |
|
14
|
|
|
*/ |
|
15
|
|
|
|
|
16
|
|
|
|
|
17
|
|
|
use Exception; |
|
18
|
|
|
use InvalidArgumentException; |
|
19
|
|
|
use NFePHP\DA\Legacy\Dom; |
|
20
|
|
|
use NFePHP\DA\Legacy\Pdf; |
|
21
|
|
|
use NFePHP\DA\Legacy\Common; |
|
22
|
|
|
use Com\Tecnick\Barcode\Barcode; |
|
23
|
|
|
use DateTime; |
|
24
|
|
|
|
|
25
|
|
|
|
|
26
|
|
|
class Dabpe extends Common |
|
27
|
|
|
{ |
|
28
|
|
|
protected $papel; |
|
29
|
|
|
protected $paperwidth = 80; |
|
30
|
|
|
protected $creditos; |
|
31
|
|
|
protected $xml; // string XML BPe |
|
32
|
|
|
protected $logomarca = ''; // path para logomarca em jpg |
|
33
|
|
|
protected $formatoChave = "#### #### #### #### #### #### #### #### #### #### ####"; |
|
34
|
|
|
protected $debugMode = 0; //ativa ou desativa o modo de debug |
|
35
|
|
|
protected $tpImp; //ambiente |
|
36
|
|
|
protected $fontePadrao = 'Times'; |
|
37
|
|
|
protected $nfeProc; |
|
38
|
|
|
protected $infBPeSupl; |
|
39
|
|
|
protected $nfe; |
|
40
|
|
|
protected $infBPe; |
|
41
|
|
|
protected $ide; |
|
42
|
|
|
protected $enderDest; |
|
43
|
|
|
protected $ICMSTot; |
|
44
|
|
|
protected $imposto; |
|
45
|
|
|
protected $agencia; |
|
46
|
|
|
protected $enderAgencia; |
|
47
|
|
|
protected $emit; |
|
48
|
|
|
protected $enderEmit; |
|
49
|
|
|
protected $qrCode; |
|
50
|
|
|
protected $urlChave; |
|
51
|
|
|
protected $det; |
|
52
|
|
|
protected $infAdic; |
|
53
|
|
|
protected $textoAdic; |
|
54
|
|
|
protected $tpEmis; |
|
55
|
|
|
protected $Comp; |
|
56
|
|
|
protected $pag; |
|
57
|
|
|
protected $vTroco; |
|
58
|
|
|
protected $dest; |
|
59
|
|
|
protected $imgQRCode; |
|
60
|
|
|
protected $urlQR = ''; |
|
61
|
|
|
protected $pdf; |
|
62
|
|
|
protected $margemInterna = 2; |
|
63
|
|
|
protected $hMaxLinha = 9; |
|
64
|
|
|
protected $hBoxLinha = 6; |
|
65
|
|
|
protected $hLinha = 3; |
|
66
|
|
|
protected $protBPe; |
|
67
|
|
|
protected $ICMSSN; |
|
68
|
|
|
protected $dhCont; |
|
69
|
|
|
|
|
70
|
|
|
/** |
|
71
|
|
|
* __contruct |
|
72
|
|
|
* |
|
73
|
|
|
* @param string $docXML |
|
74
|
|
|
* @param string $sPathLogo |
|
75
|
|
|
* @param string $mododebug |
|
76
|
|
|
* @param string $idToken |
|
77
|
|
|
* @param string $Token |
|
|
|
|
|
|
78
|
|
|
*/ |
|
79
|
|
|
public function __construct( |
|
80
|
|
|
$docXML, |
|
81
|
|
|
$sPathLogo = '', |
|
82
|
|
|
$mododebug = 0, |
|
83
|
|
|
// habilita os erros do sistema |
|
84
|
|
|
$idToken = '', |
|
|
|
|
|
|
85
|
|
|
$emitToken = '', |
|
|
|
|
|
|
86
|
|
|
$urlQR = '' |
|
|
|
|
|
|
87
|
|
|
) |
|
88
|
|
|
{ |
|
89
|
|
|
if (is_numeric($mododebug)) { |
|
90
|
|
|
$this->debugMode = $mododebug; |
|
|
|
|
|
|
91
|
|
|
} |
|
92
|
|
|
if ($this->debugMode) { |
|
93
|
|
|
//ativar modo debug |
|
94
|
|
|
error_reporting(E_ALL); |
|
95
|
|
|
ini_set('display_errors', 'On'); |
|
96
|
|
|
} else { |
|
97
|
|
|
//desativar modo debug |
|
98
|
|
|
error_reporting(0); |
|
99
|
|
|
ini_set('display_errors', 'Off'); |
|
100
|
|
|
} |
|
101
|
|
|
$this->xml = $docXML; |
|
102
|
|
|
$this->logomarca = $sPathLogo; |
|
103
|
|
|
|
|
104
|
|
|
$this->fontePadrao = empty($fonteDABPE) ? 'Times' : $fonteDABPE; |
|
|
|
|
|
|
105
|
|
|
$this->aFontTit = array('font' => $this->fontePadrao, 'size' => 9, 'style' => 'B'); |
|
|
|
|
|
|
106
|
|
|
$this->aFontTex = array('font' => $this->fontePadrao, 'size' => 8, 'style' => ''); |
|
|
|
|
|
|
107
|
|
|
if (!empty($this->xml)) { |
|
108
|
|
|
$this->dom = new Dom(); |
|
|
|
|
|
|
109
|
|
|
$this->dom->loadXML($this->xml); |
|
110
|
|
|
$this->infBPe = $this->dom->getElementsByTagName("infBPe")->item(0); |
|
111
|
|
|
$this->ide = $this->dom->getElementsByTagName("ide")->item(0); |
|
112
|
|
|
$this->agencia = $this->dom->getElementsByTagName("agencia")->item(0); |
|
113
|
|
|
$this->enderAgencia = $this->dom->getElementsByTagName("enderAgencia")->item(0); |
|
114
|
|
|
$this->emit = $this->dom->getElementsByTagName("emit")->item(0); |
|
115
|
|
|
$this->enderEmit = $this->dom->getElementsByTagName("enderEmit")->item(0); |
|
116
|
|
|
$this->infViagem = $this->dom->getElementsByTagName("infViagem")->item(0); |
|
|
|
|
|
|
117
|
|
|
$this->infPassagem = $this->dom->getElementsByTagName("infPassagem")->item(0); |
|
|
|
|
|
|
118
|
|
|
$this->infPassageiro = $this->dom->getElementsByTagName("infPassageiro")->item(0); |
|
|
|
|
|
|
119
|
|
|
$this->infValorBPe = $this->dom->getElementsByTagName("infValorBPe")->item(0); |
|
|
|
|
|
|
120
|
|
|
$this->Comp = $this->dom->getElementsByTagName("Comp"); |
|
121
|
|
|
$this->pag = $this->dom->getElementsByTagName("pag"); |
|
122
|
|
|
$this->infProt = $this->dom->getElementsByTagName("infProt")->item(0); |
|
|
|
|
|
|
123
|
|
|
$this->tpEmis = $this->dom->getElementsByTagName('tpEmis')->item(0)->nodeValue; |
|
124
|
|
|
$this->nBP = $this->dom->getElementsByTagName("nBP")->item(0); |
|
|
|
|
|
|
125
|
|
|
$this->protBPe = $this->dom->getElementsByTagName("protBPe")->item(0); |
|
126
|
|
|
$this->ICMSSN = $this->dom->getElementsByTagName("ICMSSN")->item(0); |
|
127
|
|
|
$this->dhCont = $this->getTagValue($this->ide, "dhCont") ?? ''; |
|
128
|
|
|
} |
|
129
|
|
|
$this->qrCodBPe = !empty($this->dom->getElementsByTagName('qrCodBPe')->item(0)->nodeValue) |
|
|
|
|
|
|
130
|
|
|
? $this->dom->getElementsByTagName('qrCodBPe')->item(0)->nodeValue : null; |
|
131
|
|
|
|
|
132
|
|
|
$this->urlChave = $this->urlConsulta($this->cUF); |
|
|
|
|
|
|
133
|
|
|
if ($this->getTagValue($this->ide, "mod") != '63') { |
|
134
|
|
|
throw new InvalidArgumentException("O xml do DOCUMENTO deve ser uma BP-e modelo 63"); |
|
135
|
|
|
} |
|
136
|
|
|
} |
|
137
|
|
|
|
|
138
|
|
|
protected function urlConsulta($uf) |
|
139
|
|
|
{ |
|
140
|
|
|
switch ($uf) { |
|
141
|
|
|
case "11": // Rondônia |
|
142
|
|
|
return "https://dfe-portal.svrs.rs.gov.br/BPE/Consulta"; |
|
143
|
|
|
break; |
|
|
|
|
|
|
144
|
|
|
case "12": //Acre |
|
145
|
|
|
return "https://dfe-portal.svrs.rs.gov.br/BPE/Consulta"; |
|
146
|
|
|
break; |
|
|
|
|
|
|
147
|
|
|
case "13": //Amazonas |
|
148
|
|
|
return "https://dfe-portal.svrs.rs.gov.br/BPE/Consulta"; |
|
149
|
|
|
break; |
|
|
|
|
|
|
150
|
|
|
case "14": //Roraima |
|
151
|
|
|
return "https://dfe-portal.svrs.rs.gov.br/BPE/Consulta"; |
|
152
|
|
|
break; |
|
|
|
|
|
|
153
|
|
|
case "15": //Pará |
|
154
|
|
|
return "https://dfe-portal.svrs.rs.gov.br/BPE/Consulta"; |
|
155
|
|
|
break; |
|
|
|
|
|
|
156
|
|
|
case "16": //Amapá |
|
157
|
|
|
return "https://dfe-portal.svrs.rs.gov.br/BPE/Consulta"; |
|
158
|
|
|
break; |
|
|
|
|
|
|
159
|
|
|
case "17": //Tocantins |
|
160
|
|
|
return "https://dfe-portal.svrs.rs.gov.br/BPE/Consulta"; |
|
161
|
|
|
break; |
|
|
|
|
|
|
162
|
|
|
case "21": //Maranhão |
|
163
|
|
|
return "https://dfe-portal.svrs.rs.gov.br/BPE/Consulta"; |
|
164
|
|
|
break; |
|
|
|
|
|
|
165
|
|
|
case "22": //Piauí |
|
166
|
|
|
return "https://dfe-portal.svrs.rs.gov.br/BPE/Consulta"; |
|
167
|
|
|
break; |
|
|
|
|
|
|
168
|
|
|
case "23": //Ceará |
|
169
|
|
|
return "https://dfe-portal.svrs.rs.gov.br/BPE/Consulta"; |
|
170
|
|
|
break; |
|
|
|
|
|
|
171
|
|
|
case "24": //Rio Grande do Norte |
|
172
|
|
|
return "https://dfe-portal.svrs.rs.gov.br/BPE/Consulta"; |
|
173
|
|
|
break; |
|
|
|
|
|
|
174
|
|
|
case "25": //Paraíba |
|
175
|
|
|
return "https://www.sefaz.pb.gov.br/bpe/consulta"; |
|
176
|
|
|
break; |
|
|
|
|
|
|
177
|
|
|
case "26": //Pernambuco |
|
178
|
|
|
return "https://dfe-portal.svrs.rs.gov.br/BPE/Consulta"; |
|
179
|
|
|
break; |
|
|
|
|
|
|
180
|
|
|
case "27": //Alagoas |
|
181
|
|
|
return "https://dfe-portal.svrs.rs.gov.br/BPE/Consulta"; |
|
182
|
|
|
break; |
|
|
|
|
|
|
183
|
|
|
case "28": //Sergipe |
|
184
|
|
|
return "https://dfe-portal.svrs.rs.gov.br/BPE/Consulta"; |
|
185
|
|
|
break; |
|
|
|
|
|
|
186
|
|
|
case "29": //Bahia |
|
187
|
|
|
return "https://dfe-portal.svrs.rs.gov.br/BPE/Consulta"; |
|
188
|
|
|
break; |
|
|
|
|
|
|
189
|
|
|
case "31": //Minas Gerais |
|
190
|
|
|
return "https://bpe.fazenda.mg.gov.br/portalbpe/sistema/consultaarg.xhtml"; |
|
191
|
|
|
break; |
|
|
|
|
|
|
192
|
|
|
case "32": //Espírito Santo |
|
193
|
|
|
return "https://dfe-portal.svrs.rs.gov.br/BPE/Consulta"; |
|
194
|
|
|
break; |
|
|
|
|
|
|
195
|
|
|
case "33": //Rio de Janeiro |
|
196
|
|
|
return "https://dfe-portal.svrs.rs.gov.br/BPE/Consulta"; |
|
197
|
|
|
break; |
|
|
|
|
|
|
198
|
|
|
case "35": //São Paulo |
|
199
|
|
|
return "https://bpe.fazenda.sp.gov.br/BPe/"; |
|
200
|
|
|
break; |
|
|
|
|
|
|
201
|
|
|
case "41": //Paraná |
|
202
|
|
|
return "http://www.sped.fazenda.pr.gov.br/modules/conteudo/bpe.php?consulta=completa"; |
|
203
|
|
|
break; |
|
|
|
|
|
|
204
|
|
|
case "42": //Santa Catarina(Não usa BPE) |
|
205
|
|
|
return ""; |
|
206
|
|
|
break; |
|
|
|
|
|
|
207
|
|
|
case "43": //Rio Grande do Sul (*) |
|
208
|
|
|
return "https://dfe-portal.svrs.rs.gov.br/BPE/Consulta"; |
|
209
|
|
|
break; |
|
|
|
|
|
|
210
|
|
|
case "50": //Mato Grosso do Sul |
|
211
|
|
|
return "http://www.dfe.ms.gov.br/bpe/#/consulta"; |
|
212
|
|
|
break; |
|
|
|
|
|
|
213
|
|
|
case "51": //Mato Grosso |
|
214
|
|
|
return "https://www.sefaz.mt.gov.br/BPe/consulta"; |
|
215
|
|
|
break; |
|
|
|
|
|
|
216
|
|
|
case "52": //Goiás |
|
217
|
|
|
return "https://dfe-portal.svrs.rs.gov.br/BPE/Consulta"; |
|
218
|
|
|
break; |
|
|
|
|
|
|
219
|
|
|
case "53": //Distrito Federal |
|
220
|
|
|
return "https://dfe-portal.svrs.rs.gov.br/BPE/Consulta"; |
|
221
|
|
|
break; |
|
|
|
|
|
|
222
|
|
|
} |
|
223
|
|
|
} |
|
224
|
|
|
|
|
225
|
|
|
protected static function getCardName($tBand) |
|
226
|
|
|
{ |
|
227
|
|
|
switch ($tBand) { |
|
228
|
|
|
case '01': |
|
229
|
|
|
$tBandNome = 'VISA'; |
|
230
|
|
|
break; |
|
231
|
|
|
case '02': |
|
232
|
|
|
$tBandNome = 'MASTERCARD'; |
|
233
|
|
|
break; |
|
234
|
|
|
case '03': |
|
235
|
|
|
$tBandNome = 'AMERICAM EXPRESS'; |
|
236
|
|
|
break; |
|
237
|
|
|
case '04': |
|
238
|
|
|
$tBandNome = 'SOROCRED'; |
|
239
|
|
|
break; |
|
240
|
|
|
case '99': |
|
241
|
|
|
$tBandNome = 'OUTROS'; |
|
242
|
|
|
break; |
|
243
|
|
|
default: |
|
244
|
|
|
$tBandNome = ''; |
|
245
|
|
|
} |
|
246
|
|
|
return $tBandNome; |
|
247
|
|
|
} |
|
248
|
|
|
|
|
249
|
|
|
/** |
|
250
|
|
|
* Ativa ou desativa o modo debug |
|
251
|
|
|
* @param bool $activate |
|
252
|
|
|
* @return bool |
|
253
|
|
|
*/ |
|
254
|
|
|
public function debugMode($activate = null) |
|
255
|
|
|
{ |
|
256
|
|
|
if (isset($activate) && is_bool($activate)) { |
|
257
|
|
|
$this->debugmode = $activate; |
|
|
|
|
|
|
258
|
|
|
} |
|
259
|
|
|
if ($this->debugmode) { |
|
|
|
|
|
|
260
|
|
|
//ativar modo debug |
|
261
|
|
|
error_reporting(E_ALL); |
|
262
|
|
|
ini_set('display_errors', 'On'); |
|
263
|
|
|
} else { |
|
264
|
|
|
//desativar modo debug |
|
265
|
|
|
error_reporting(0); |
|
266
|
|
|
ini_set('display_errors', 'Off'); |
|
267
|
|
|
} |
|
268
|
|
|
return $this->debugmode; |
|
|
|
|
|
|
269
|
|
|
} |
|
270
|
|
|
|
|
271
|
|
|
/** |
|
272
|
|
|
* Add the credits to the integrator in the footer message |
|
273
|
|
|
* @param string $message |
|
274
|
|
|
*/ |
|
275
|
|
|
public function creditsIntegratorFooter($message = '') |
|
276
|
|
|
{ |
|
277
|
|
|
$this->creditos = trim($message); |
|
278
|
|
|
} |
|
279
|
|
|
|
|
280
|
|
|
/** |
|
281
|
|
|
* Dados brutos do PDF |
|
282
|
|
|
* @return string |
|
283
|
|
|
*/ |
|
284
|
|
|
public function render() |
|
285
|
|
|
{ |
|
286
|
|
|
if (empty($this->pdf)) { |
|
287
|
|
|
$this->monta(); |
|
288
|
|
|
} |
|
289
|
|
|
return $this->pdf->getPdf(); |
|
290
|
|
|
|
|
291
|
|
|
} |
|
292
|
|
|
|
|
293
|
|
|
public function monta( |
|
294
|
|
|
$logo = null, |
|
295
|
|
|
$depecNumReg = '', |
|
296
|
|
|
$logoAlign = 'C' |
|
297
|
|
|
) |
|
298
|
|
|
{ |
|
299
|
|
|
$this->logomarca = $logo; |
|
300
|
|
|
$qtdItens = $this->Comp->length; |
|
301
|
|
|
$qtdPgto = $this->pag->length; |
|
302
|
|
|
$hMaxLinha = $this->hMaxLinha; |
|
|
|
|
|
|
303
|
|
|
$hBoxLinha = $this->hBoxLinha; |
|
|
|
|
|
|
304
|
|
|
$hLinha = $this->hLinha; |
|
305
|
|
|
$tamPapelVert = 140 + 16 + 12 + (($qtdItens - 1) * $hLinha) + ($qtdPgto * $hLinha); |
|
306
|
|
|
// verifica se existe informações adicionais |
|
307
|
|
|
$this->textoAdic = ''; |
|
308
|
|
|
if (isset($this->infAdic)) { |
|
309
|
|
|
$this->textoAdic .= !empty($this->infAdic->getElementsByTagName('infCpl')->item(0)->nodeValue) ? 'Inf. Contribuinte: ' . trim($this->anfaveaDANFE($this->infAdic->getElementsByTagName('infCpl')->item(0)->nodeValue)) : ''; |
|
|
|
|
|
|
310
|
|
|
if (!empty($this->textoAdic)) { |
|
311
|
|
|
$this->textoAdic = str_replace(";", "\n", $this->textoAdic); |
|
312
|
|
|
$alinhas = explode("\n", $this->textoAdic); |
|
313
|
|
|
$numlinhasdados = 0; |
|
314
|
|
|
$tempPDF = new Pdf(); // cria uma instancia temporaria da class pdf |
|
315
|
|
|
$tempPDF->setFont('times', '', '8'); // seta a font do PDF |
|
316
|
|
|
foreach ($alinhas as $linha) { |
|
317
|
|
|
$linha = trim($linha); |
|
318
|
|
|
$numlinhasdados += $tempPDF->wordWrap($linha, 76 - 0.2); |
|
|
|
|
|
|
319
|
|
|
} |
|
320
|
|
|
$hdadosadic = round(($numlinhasdados + 1) * $tempPDF->fontSize, 0); |
|
321
|
|
|
if ($hdadosadic < 5) { |
|
322
|
|
|
$hdadosadic = 5; |
|
323
|
|
|
} |
|
324
|
|
|
// seta o tamanho do papel |
|
325
|
|
|
$tamPapelVert += $hdadosadic; |
|
326
|
|
|
} |
|
327
|
|
|
} |
|
328
|
|
|
|
|
329
|
|
|
if (!empty($this->agencia)) { |
|
330
|
|
|
$hagencia = 20; |
|
331
|
|
|
$tamPapelVert += 18; |
|
332
|
|
|
} |
|
333
|
|
|
$this->orientacao = 'P'; |
|
|
|
|
|
|
334
|
|
|
$this->papel = [$this->paperwidth, $tamPapelVert]; |
|
335
|
|
|
$this->logoAlign = $logoAlign; |
|
|
|
|
|
|
336
|
|
|
//$this->situacao_externa = $situacaoExterna; |
|
337
|
|
|
$this->numero_registro_dpec = $depecNumReg; |
|
|
|
|
|
|
338
|
|
|
$this->pdf = new Pdf($this->orientacao, 'mm', $this->papel); |
|
|
|
|
|
|
339
|
|
|
|
|
340
|
|
|
//margens do PDF, em milímetros. Obs.: a margem direita é sempre igual à |
|
341
|
|
|
//margem esquerda. A margem inferior *não* existe na FPDF, é definida aqui |
|
342
|
|
|
//apenas para controle se necessário ser maior do que a margem superior |
|
343
|
|
|
$margSup = 2; |
|
344
|
|
|
$margEsq = 2; |
|
345
|
|
|
$margInf = 2; |
|
346
|
|
|
// posição inicial do conteúdo, a partir do canto superior esquerdo da página |
|
347
|
|
|
$xInic = $margEsq; |
|
348
|
|
|
$yInic = $margSup; |
|
349
|
|
|
$maxW = 80; |
|
350
|
|
|
$maxH = $tamPapelVert; |
|
351
|
|
|
//total inicial de paginas |
|
352
|
|
|
$totPag = 1; |
|
|
|
|
|
|
353
|
|
|
//largura imprimivel em mm: largura da folha menos as margens esq/direita |
|
354
|
|
|
$this->wPrint = $maxW - ($margEsq * 2); |
|
|
|
|
|
|
355
|
|
|
//comprimento (altura) imprimivel em mm: altura da folha menos as margens |
|
356
|
|
|
//superior e inferior |
|
357
|
|
|
$this->hPrint = $maxH - $margSup - $margInf; |
|
|
|
|
|
|
358
|
|
|
// estabelece contagem de paginas |
|
359
|
|
|
$this->pdf->aliasNbPages(); |
|
360
|
|
|
$this->pdf->setMargins($margEsq, $margSup); // fixa as margens |
|
361
|
|
|
$this->pdf->setDrawColor(0, 0, 0); |
|
362
|
|
|
$this->pdf->setFillColor(255, 255, 255); |
|
363
|
|
|
$this->pdf->open(); // inicia o documento |
|
364
|
|
|
$this->pdf->addPage($this->orientacao, $this->papel); // adiciona a primeira página |
|
|
|
|
|
|
365
|
|
|
$this->pdf->setLineWidth(0.1); // define a largura da linha |
|
366
|
|
|
$this->pdf->setTextColor(0, 0, 0); |
|
367
|
|
|
$this->pdf->textBox(0, 0, $maxW, $maxH); // POR QUE PRECISO DESA LINHA? |
|
368
|
|
|
$hcabecalho = 16;//para cabeçalho (dados emitente mais logomarca) (FIXO) |
|
369
|
|
|
$hcabecalhoSecundario = 18;//para cabeçalho secundário (cabeçalho sefaz) (FIXO) |
|
370
|
|
|
$hprodutos = $hLinha + ($qtdItens * $hLinha);//box poduto |
|
371
|
|
|
$hTotal = 12; //box total (FIXO) |
|
372
|
|
|
$hpagamentos = (2 * $hLinha) + ($qtdPgto * $hLinha);//para pagamentos |
|
373
|
|
|
if (!empty($this->vTroco)) { |
|
374
|
|
|
$hpagamentos += $hLinha; |
|
375
|
|
|
} |
|
376
|
|
|
|
|
377
|
|
|
$hmsgfiscal = 28; // para imposto (FIXO) |
|
378
|
|
|
$hcliente = !isset($this->dest) ? 6 : 12; // para cliente (FIXO) |
|
379
|
|
|
$hcontingencia = $this->tpEmis == 9 ? 6 : 0; // para contingência (FIXO) |
|
|
|
|
|
|
380
|
|
|
$hQRCode = 50; // para qrcode (FIXO) |
|
381
|
|
|
$hCabecItens = 4; //cabeçalho dos itens |
|
382
|
|
|
|
|
383
|
|
|
$hUsado = $hCabecItens; |
|
|
|
|
|
|
384
|
|
|
$w2 = round($this->wPrint * 0.31, 0); |
|
|
|
|
|
|
385
|
|
|
$totPag = 1; |
|
386
|
|
|
$pag = 1; |
|
387
|
|
|
$x = $xInic; |
|
388
|
|
|
//COLOCA CABEÇALHO |
|
389
|
|
|
$y = $yInic; |
|
390
|
|
|
if (!empty($this->agencia)) { |
|
391
|
|
|
$y = $this->cabecalhoAgencia($x, $y, $hagencia, $pag, $totPag); |
|
|
|
|
|
|
392
|
|
|
$y = $hagencia; |
|
393
|
|
|
if (!empty($this->dhCont)) { |
|
394
|
|
|
$hcabecalho = $hcabecalho + ($this->hLinha * 2); |
|
395
|
|
|
} |
|
396
|
|
|
$y = $this->cabecalhoDABPE($x, $y, $hcabecalho); |
|
|
|
|
|
|
397
|
|
|
$hcabecalho = $hcabecalho + $hagencia; |
|
398
|
|
|
} else { |
|
399
|
|
|
if (!empty($this->dhCont)) { |
|
400
|
|
|
$hcabecalho = $hcabecalho + ($this->hLinha * 2); |
|
401
|
|
|
} |
|
402
|
|
|
$y = $this->cabecalhoDABPE($x, $y, $hcabecalho, $pag, $totPag); |
|
|
|
|
|
|
403
|
|
|
} |
|
404
|
|
|
//COLOCA CABEÇALHO SECUNDÁRIO |
|
405
|
|
|
$y = $hcabecalho + 4;// Adiciona-se +4 na altura para servir como "margem" Após o término da Box Anterior |
|
406
|
|
|
$y = $this->cabecalhoSecundarioDABPE($x, $y, $hcabecalhoSecundario); |
|
|
|
|
|
|
407
|
|
|
$jj = $hcabecalho + $hcabecalhoSecundario; |
|
|
|
|
|
|
408
|
|
|
//COLOCA PRODUTOS |
|
409
|
|
|
$y = $xInic + $hcabecalho + $hcabecalhoSecundario + 6; // +6 devido a um aumento na BOX2 do cabecalhosecundariodabpe |
|
410
|
|
|
$y = $this->produtosDABPE($x, $y, $hprodutos); |
|
|
|
|
|
|
411
|
|
|
//COLOCA TOTAL |
|
412
|
|
|
$y = $yInic + $hcabecalho + $hcabecalhoSecundario + 6 + $hprodutos; |
|
413
|
|
|
$y = $this->totalDABPE($x, $y, $hTotal); |
|
|
|
|
|
|
414
|
|
|
//COLOCA PAGAMENTOS |
|
415
|
|
|
$y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos + $hTotal; |
|
416
|
|
|
$y = $this->pagamentosDABPE($x, $y, $hpagamentos); |
|
|
|
|
|
|
417
|
|
|
//COLOCA MENSAGEM FISCAL |
|
418
|
|
|
$y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos + $hTotal + $hpagamentos; |
|
419
|
|
|
$y = $this->fiscalDABPE($x, $y, $hmsgfiscal); |
|
|
|
|
|
|
420
|
|
|
//COLOCA CONSUMIDOR |
|
421
|
|
|
$y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos + $hTotal + $hpagamentos + $hmsgfiscal; |
|
|
|
|
|
|
422
|
|
|
//COLOCA QRCODE |
|
423
|
|
|
$y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos + $hTotal + $hpagamentos + $hmsgfiscal; |
|
424
|
|
|
$y = $this->qrCodeDABPE($x, $y, $hQRCode); |
|
|
|
|
|
|
425
|
|
|
|
|
426
|
|
|
//adiciona as informações opcionais |
|
427
|
|
|
if (!empty($this->textoAdic)) { |
|
428
|
|
|
$y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos |
|
429
|
|
|
+ $hTotal + $hpagamentos + $hmsgfiscal + $hcliente + $hQRCode; |
|
430
|
|
|
$hInfAdic = 0; |
|
431
|
|
|
$y = $this->infAdic($x, $y, $hInfAdic); |
|
|
|
|
|
|
432
|
|
|
} |
|
433
|
|
|
} |
|
434
|
|
|
|
|
435
|
|
|
/** |
|
436
|
|
|
* anfavea |
|
437
|
|
|
* Função para transformar o campo cdata do padrão ANFAVEA para |
|
438
|
|
|
* texto imprimível |
|
439
|
|
|
* |
|
440
|
|
|
* @param string $cdata campo CDATA |
|
441
|
|
|
* @return string conteúdo do campo CDATA como string |
|
|
|
|
|
|
442
|
|
|
*/ |
|
443
|
|
|
|
|
444
|
|
|
protected function cabecalhoAgencia($x = 0, $y = 0, $h = 0, $pag = '1', $totPag = '1') |
|
|
|
|
|
|
445
|
|
|
{ |
|
446
|
|
|
$agenciaRazao = $this->getTagValue($this->agencia, "xNome"); |
|
447
|
|
|
$agenciaCnpj = $this->getTagValue($this->agencia, "CNPJ"); |
|
448
|
|
|
$agenciaCnpj = $this->formatField($agenciaCnpj, "##.###.###/####-##"); |
|
449
|
|
|
$agenciaLgr = $this->getTagValue($this->enderAgencia, "xLgr"); |
|
450
|
|
|
$agenciaNro = $this->getTagValue($this->enderAgencia, "nro"); |
|
451
|
|
|
$agenciaCpl = $this->getTagValue($this->enderAgencia, "xCpl", ""); |
|
452
|
|
|
$agenciaBairro = $this->getTagValue($this->enderAgencia, "xBairro"); |
|
453
|
|
|
$agenciaCEP = $this->formatField($this->getTagValue($this->enderAgencia, "CEP"), "#####-###"); |
|
454
|
|
|
$agenciaMun = $this->getTagValue($this->enderAgencia, "xMun"); |
|
455
|
|
|
$agenciaUF = $this->getTagValue($this->enderAgencia, "UF"); |
|
456
|
|
|
// CONFIGURAÇÃO DE POSIÇÃO |
|
457
|
|
|
$margemInterna = $this->margemInterna; |
|
458
|
|
|
$maxW = $this->wPrint; |
|
459
|
|
|
$h = $h - ($margemInterna); |
|
460
|
|
|
//COLOCA LOGOMARCA |
|
461
|
|
|
if (is_file($this->logomarca)) { |
|
462
|
|
|
$xImg = $margemInterna; |
|
463
|
|
|
$yImg = $margemInterna + 1; |
|
464
|
|
|
$this->pdf->image($this->logomarca, $xImg, $yImg, 30, 22.5); |
|
465
|
|
|
$xRs = ($maxW * 0.4) + $margemInterna; |
|
466
|
|
|
$wRs = ($maxW * 0.6); |
|
467
|
|
|
$alignEmit = 'R'; |
|
468
|
|
|
} else { |
|
469
|
|
|
$xRs = $margemInterna; |
|
470
|
|
|
$wRs = ($maxW * 1); |
|
471
|
|
|
$alignEmit = 'C'; |
|
472
|
|
|
} |
|
473
|
|
|
//COLOCA RAZÃO SOCIAL |
|
474
|
|
|
$texto = "CNPJ:" . $agenciaCnpj; |
|
475
|
|
|
$texto = $texto . "\n" . $agenciaRazao; |
|
476
|
|
|
|
|
477
|
|
|
$texto = $texto . "\n" . $agenciaLgr . "," . $agenciaNro . " " . $agenciaCpl . "," . $agenciaBairro |
|
478
|
|
|
. ". CEP:" . $agenciaCEP . ". " . $agenciaMun . "-" . $agenciaUF . "\n____________________________________________________"; |
|
479
|
|
|
$aFont = array('font' => $this->fontePadrao, 'size' => 8, 'style' => ''); |
|
480
|
|
|
$this->pdf->textBox($xRs, $y, $wRs, $h, $texto, $aFont, 'T', $alignEmit, 0, '', false); |
|
481
|
|
|
} |
|
482
|
|
|
|
|
483
|
|
|
protected function cabecalhoDABPE($x = 0, $y = 0, $h = 0, $pag = '1', $totPag = '1') |
|
|
|
|
|
|
484
|
|
|
{ |
|
485
|
|
|
$emitRazao = $this->getTagValue($this->emit, "xNome"); |
|
486
|
|
|
$emitCnpj = $this->getTagValue($this->emit, "CNPJ"); |
|
487
|
|
|
$emitCnpj = $this->formatField($emitCnpj, "##.###.###/####-##"); |
|
488
|
|
|
$emitIE = $this->getTagValue($this->emit, "IE"); |
|
489
|
|
|
$emitIM = $this->getTagValue($this->emit, "IM"); |
|
|
|
|
|
|
490
|
|
|
$emitFone = $this->getTagValue($this->enderEmit, "fone"); |
|
491
|
|
|
$foneLen = strlen($emitFone); |
|
492
|
|
|
if ($foneLen > 0) { |
|
493
|
|
|
$ddd = substr($emitFone, 0, 2); |
|
494
|
|
|
$fone1 = substr($emitFone, -8); |
|
495
|
|
|
$digito9 = ' '; |
|
496
|
|
|
if ($foneLen == 11) { |
|
497
|
|
|
$digito9 = substr($emitFone, 2, 1); |
|
498
|
|
|
} |
|
499
|
|
|
$emitFone = ' - (' . $ddd . ') ' . $digito9 . ' ' . substr($fone1, 0, 4) . '-' . substr($fone1, -4); |
|
500
|
|
|
} else { |
|
501
|
|
|
$emitFone = ''; |
|
502
|
|
|
} |
|
503
|
|
|
$emitLgr = $this->getTagValue($this->enderEmit, "xLgr"); |
|
504
|
|
|
$emitNro = $this->getTagValue($this->enderEmit, "nro"); |
|
505
|
|
|
$emitCpl = $this->getTagValue($this->enderEmit, "xCpl", ""); |
|
506
|
|
|
$emitBairro = $this->getTagValue($this->enderEmit, "xBairro"); |
|
507
|
|
|
$emitCEP = $this->formatField($this->getTagValue($this->enderEmit, "CEP"), "#####-###"); |
|
508
|
|
|
$emitMun = $this->getTagValue($this->enderEmit, "xMun"); |
|
509
|
|
|
$emitUF = $this->getTagValue($this->enderEmit, "UF"); |
|
510
|
|
|
// CONFIGURAÇÃO DE POSIÇÃO |
|
511
|
|
|
$margemInterna = $this->margemInterna; |
|
512
|
|
|
$maxW = $this->wPrint; |
|
513
|
|
|
//COLOCA LOGOMARCA |
|
514
|
|
|
if (is_file($this->logomarca)) { |
|
515
|
|
|
$xImg = $margemInterna; |
|
516
|
|
|
$yImg = $margemInterna + 1; |
|
517
|
|
|
$this->pdf->image($this->logomarca, $xImg, $yImg, 30, 22.5); |
|
518
|
|
|
$xRs = ($maxW * 0.4) + $margemInterna; |
|
519
|
|
|
$wRs = ($maxW * 0.6); |
|
520
|
|
|
$alignEmit = 'C'; |
|
521
|
|
|
} else { |
|
522
|
|
|
$xRs = $margemInterna; |
|
523
|
|
|
$wRs = ($maxW * 1); |
|
524
|
|
|
$alignEmit = 'C'; |
|
525
|
|
|
} |
|
526
|
|
|
//COLOCA RAZÃO SOCIAL |
|
527
|
|
|
$texto = $emitRazao; |
|
528
|
|
|
$aFont = array('font' => $this->fontePadrao, 'size' => 8, 'style' => 'B'); |
|
529
|
|
|
$this->pdf->textBox($xRs, $y, $wRs, $this->hLinha + 1, $texto, $aFont, 'T', $alignEmit, 0, '', false); |
|
530
|
|
|
$y = $y + 3; |
|
531
|
|
|
$texto = "CNPJ: " . $emitCnpj; |
|
532
|
|
|
$texto = $texto . " IE: " . $emitIE; |
|
533
|
|
|
$texto = $texto . "\n" . $emitLgr . "," . $emitNro . " " . $emitCpl . "," . $emitBairro . ". CEP: " . $emitCEP . " . " . $emitMun . "-" . $emitUF . $emitFone . "\nDocumento Auxiliar do Bilhete de Passagem Eletrônico"; |
|
534
|
|
|
$aFont = array('font' => $this->fontePadrao, 'size' => 8, 'style' => ''); |
|
535
|
|
|
if (empty($this->dhCont)) { |
|
536
|
|
|
$texto = $texto . "\n____________________________________________________"; |
|
537
|
|
|
$this->pdf->textBox($xRs, $y, $wRs, $h, $texto, $aFont, 'T', $alignEmit, 0, '', false); |
|
538
|
|
|
} else { |
|
539
|
|
|
$texto = $texto . "\n____________________________________________________"; |
|
540
|
|
|
$this->pdf->textBox($xRs, $y, $wRs, $this->hLinha, $texto, $aFont, 'T', $alignEmit, 0, '', false); |
|
541
|
|
|
$texto = "\nEMITIDA EM CONTINGÊNCIA\nPendente de autorização\n____________________________________________________"; |
|
542
|
|
|
$aFont = array('font' => $this->fontePadrao, 'size' => 8, 'style' => 'B'); |
|
543
|
|
|
$this->pdf->textBox($xRs, $h - $this->hLinha, $wRs, $this->hlinha * 2, $texto, $aFont, 'T', $alignEmit, 0, '', false); |
|
|
|
|
|
|
544
|
|
|
} |
|
545
|
|
|
|
|
546
|
|
|
} |
|
547
|
|
|
|
|
548
|
|
|
protected function cabecalhoSecundarioDABPE($x = 0, $y = 0, $h = 0) |
|
|
|
|
|
|
549
|
|
|
{ |
|
550
|
|
|
$margemInterna = $this->margemInterna; |
|
|
|
|
|
|
551
|
|
|
$maxW = $this->wPrint; |
|
552
|
|
|
$w = ($maxW * 1); |
|
553
|
|
|
$hBox1 = 12; |
|
554
|
|
|
$hBox2 = 12; |
|
555
|
|
|
$yBox2 = $y + $hBox1; |
|
556
|
|
|
$origem = $this->getTagValue($this->infPassagem, "xLocOrig"); |
|
557
|
|
|
$uforigem = $this->getTagValue($this->ide, "UFIni"); |
|
558
|
|
|
$texto = "\nOrigem:" . $origem . "(" . $uforigem . ")"; |
|
559
|
|
|
$destino = $this->getTagValue($this->infPassagem, "xLocDest"); |
|
560
|
|
|
$ufdestino = $this->getTagValue($this->ide, "UFFim"); |
|
561
|
|
|
$texto = $texto . "\nDestino:" . $destino . "(" . $ufdestino . ")"; |
|
562
|
|
|
$dhViagem = $this->getTagValue($this->infViagem, "dhViagem"); |
|
563
|
|
|
$dhViagemformatado = new \DateTime($dhViagem); |
|
564
|
|
|
$data = $dhViagemformatado->format('d/m/Y'); |
|
565
|
|
|
$hora = $dhViagemformatado->format('H:i:s'); |
|
566
|
|
|
$texto = $texto . "\nData: " . $data . " | Horário: " . $hora; |
|
567
|
|
|
$aFont = array('font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'); |
|
568
|
|
|
$this->pdf->textBox($x, $y, $w, $hBox1, $texto, $aFont, 'T', 'C', 0, '', false); |
|
569
|
|
|
if ($this->getTagValue($this->infViagem, "prefixo") !== null) { |
|
570
|
|
|
$prefixo = $this->getTagValue($this->infViagem, "prefixo"); |
|
571
|
|
|
} else { |
|
572
|
|
|
$prefixo = ""; |
|
573
|
|
|
} |
|
574
|
|
|
$linha = $this->getTagValue($this->infViagem, "xPercurso"); |
|
575
|
|
|
$tpServ = $this->getTagValue($this->infViagem, "tpServ"); |
|
576
|
|
|
switch ($tpServ) { |
|
577
|
|
|
case "1": |
|
578
|
|
|
$tipo = "Convencional com sanitário"; |
|
579
|
|
|
break; |
|
580
|
|
|
case "2": |
|
581
|
|
|
$tipo = "Convencional sem sanitário"; |
|
582
|
|
|
break; |
|
583
|
|
|
case "3": |
|
584
|
|
|
$tipo = "Semileito"; |
|
585
|
|
|
break; |
|
586
|
|
|
case "4": |
|
587
|
|
|
$tipo = "Leito com ar condicionado"; |
|
588
|
|
|
break; |
|
589
|
|
|
case "5": |
|
590
|
|
|
$tipo = "Leito sem ar condicionado"; |
|
591
|
|
|
break; |
|
592
|
|
|
case "6": |
|
593
|
|
|
$tipo = "Executivo"; |
|
594
|
|
|
break; |
|
595
|
|
|
case "7": |
|
596
|
|
|
$tipo = "Semiurbano"; |
|
597
|
|
|
break; |
|
598
|
|
|
case "8": |
|
599
|
|
|
$tipo = "Longitudinal"; |
|
600
|
|
|
break; |
|
601
|
|
|
case "9": |
|
602
|
|
|
$tipo = "Travessia"; |
|
603
|
|
|
break; |
|
604
|
|
|
} |
|
605
|
|
|
|
|
606
|
|
|
$texto = "\n(Poltrona: " . $this->getTagValue($this->infViagem, "poltrona") . " Plataforma: " . $this->getTagValue($this->infViagem, "plataforma") . ")"; |
|
607
|
|
|
$texto = $texto . "\nPrefixo: " . $prefixo . " Linha: " . $linha . "\nTipo: " . $tipo . "\n_____________________________________________________________"; |
|
|
|
|
|
|
608
|
|
|
$aFont = array('font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'); |
|
609
|
|
|
$this->pdf->textBox($x, $yBox2, $w, $hBox2, $texto, $aFont, 'T', 'C', 0, '', false); |
|
610
|
|
|
} |
|
611
|
|
|
|
|
612
|
|
|
protected function produtosDABPE($x = 0, $y = 0, $h = 0) |
|
|
|
|
|
|
613
|
|
|
{ |
|
614
|
|
|
$qtdItens = $this->Comp->length; |
|
615
|
|
|
$hMaxLinha = $this->hMaxLinha; |
|
|
|
|
|
|
616
|
|
|
$maxW = $this->wPrint; |
|
617
|
|
|
$w = $maxW; |
|
618
|
|
|
$hLinha = $this->hLinha; |
|
619
|
|
|
$cont = 0; |
|
620
|
|
|
$aFontComp = array('font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'); |
|
621
|
|
|
if ($qtdItens > 0) { |
|
622
|
|
|
foreach ($this->Comp as $compI) { |
|
623
|
|
|
$item = $compI; |
|
624
|
|
|
$tpComp = $this->getTagValue($item, "tpComp"); |
|
625
|
|
|
switch ($tpComp) { |
|
626
|
|
|
case "01": |
|
627
|
|
|
$xtpComp = "TARIFA"; |
|
628
|
|
|
break; |
|
629
|
|
|
case "02": |
|
630
|
|
|
$xtpComp = "PEDAGIO"; |
|
631
|
|
|
break; |
|
632
|
|
|
case "03": |
|
633
|
|
|
$xtpComp = "TAXA EMBARQUE"; |
|
634
|
|
|
break; |
|
635
|
|
|
case "04": |
|
636
|
|
|
$xtpComp = "SEGURO"; |
|
637
|
|
|
break; |
|
638
|
|
|
case "05": |
|
639
|
|
|
$xtpComp = "TMR"; |
|
640
|
|
|
break; |
|
641
|
|
|
case "06": |
|
642
|
|
|
$xtpComp = "SVI"; |
|
643
|
|
|
break; |
|
644
|
|
|
case "99": |
|
645
|
|
|
$xtpComp = "OUTROS"; |
|
646
|
|
|
break; |
|
647
|
|
|
|
|
648
|
|
|
default: |
|
649
|
|
|
$xtpComp = "Outro"; |
|
650
|
|
|
break; |
|
651
|
|
|
} |
|
652
|
|
|
//COLOCA DESCRIÇÃO DO COMPONENTE(tpComp) |
|
653
|
|
|
$wBoxComp = $w / 2; |
|
654
|
|
|
$texto = $xtpComp; |
|
655
|
|
|
$yBoxComp = $y + $hLinha + ($cont * $hLinha); |
|
656
|
|
|
$this->pdf->textBox( |
|
657
|
|
|
$x, |
|
658
|
|
|
$yBoxComp, |
|
659
|
|
|
$wBoxComp, |
|
660
|
|
|
$hLinha, |
|
661
|
|
|
$texto, |
|
662
|
|
|
$aFontComp, |
|
663
|
|
|
'C', |
|
664
|
|
|
'L', |
|
665
|
|
|
0, |
|
666
|
|
|
'', |
|
667
|
|
|
false |
|
668
|
|
|
); |
|
669
|
|
|
$vComp = number_format($this->getTagValue($item, "vComp"), 2, ",", "."); |
|
670
|
|
|
//COLOCA VALOR DO COMPONENTE |
|
671
|
|
|
$wBoxValor = $w / 2; |
|
672
|
|
|
$xBoxValor = ($w / 2) + 2; |
|
673
|
|
|
$texto = $vComp; |
|
674
|
|
|
$this->pdf->textBox( |
|
675
|
|
|
$xBoxValor, |
|
676
|
|
|
$yBoxComp, |
|
677
|
|
|
$wBoxValor, |
|
678
|
|
|
$hLinha, |
|
679
|
|
|
$texto, |
|
680
|
|
|
$aFontComp, |
|
681
|
|
|
'C', |
|
682
|
|
|
'R', |
|
683
|
|
|
0, |
|
684
|
|
|
'', |
|
685
|
|
|
false |
|
686
|
|
|
); |
|
687
|
|
|
|
|
688
|
|
|
$cont++; |
|
689
|
|
|
} |
|
690
|
|
|
} |
|
691
|
|
|
} |
|
692
|
|
|
|
|
693
|
|
|
protected function totalDABPE($x = 0, $y = 0, $h = 0) |
|
|
|
|
|
|
694
|
|
|
{ |
|
695
|
|
|
$maxW = $this->wPrint; |
|
696
|
|
|
$hLinha = 3; |
|
697
|
|
|
$wColEsq = ($maxW * 0.7); |
|
698
|
|
|
$wColDir = ($maxW * 0.3); |
|
699
|
|
|
$xValor = $x + $wColEsq; |
|
700
|
|
|
$qtdItens = $this->Comp->length; |
|
|
|
|
|
|
701
|
|
|
|
|
702
|
|
|
$vBP = number_format($this->getTagValue($this->infValorBPe, "vBP"), 2, ",", "."); |
|
703
|
|
|
$vDesconto = number_format($this->getTagValue($this->infValorBPe, "vDesconto"), 2, ",", "."); |
|
704
|
|
|
$vTroco = number_format($this->getTagValue($this->infValorBPe, "vTroco"), 2, ",", "."); |
|
|
|
|
|
|
705
|
|
|
$vPgto = number_format($this->getTagValue($this->infValorBPe, "vPgto"), 2, ",", "."); |
|
706
|
|
|
$yTotal = $y + ($hLinha); |
|
707
|
|
|
|
|
708
|
|
|
$texto = "Valor total R$"; |
|
709
|
|
|
$aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => '']; |
|
710
|
|
|
$this->pdf->textBox($x, $y, $wColEsq, $hLinha, $texto, $aFont, 'T', 'L', 0, '', false); |
|
711
|
|
|
|
|
712
|
|
|
$texto = $vBP; |
|
713
|
|
|
$aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => '']; |
|
714
|
|
|
$this->pdf->textBox($xValor, $y, $wColDir, $hLinha, $texto, $aFont, 'T', 'R', 0, '', false); |
|
715
|
|
|
|
|
716
|
|
|
$yDesconto = $y + ($hLinha * 2); |
|
717
|
|
|
$texto = "Desconto R$"; |
|
718
|
|
|
$aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => '']; |
|
719
|
|
|
$this->pdf->textBox($x, $yTotal, $wColEsq, $hLinha, $texto, $aFont, 'T', 'L', 0, '', false); |
|
720
|
|
|
|
|
721
|
|
|
$texto = $vDesconto; |
|
722
|
|
|
$aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => '']; |
|
723
|
|
|
$this->pdf->textBox($xValor, $yTotal, $wColDir, $hLinha, $texto, $aFont, 'T', 'R', 0, '', false); |
|
724
|
|
|
|
|
725
|
|
|
$yFrete = $y + ($hLinha * 3); |
|
|
|
|
|
|
726
|
|
|
$texto = "Valor a Pagar R$"; |
|
727
|
|
|
$aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B']; |
|
728
|
|
|
$this->pdf->textBox($x, $yDesconto, $wColEsq, $hLinha, $texto, $aFont, 'T', 'L', 0, '', false); |
|
729
|
|
|
|
|
730
|
|
|
$texto = $vPgto; |
|
731
|
|
|
$aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B']; |
|
732
|
|
|
$this->pdf->textBox($xValor, $yDesconto, $wColDir, $hLinha, $texto, $aFont, 'T', 'R', 0, '', false); |
|
733
|
|
|
|
|
734
|
|
|
} |
|
735
|
|
|
|
|
736
|
|
|
protected function fiscalDABPE($x = 0, $y = 0, $h = 0) |
|
737
|
|
|
{ |
|
738
|
|
|
$y += 8; |
|
739
|
|
|
$margemInterna = $this->margemInterna; |
|
|
|
|
|
|
740
|
|
|
$maxW = $this->wPrint; |
|
741
|
|
|
$w = ($maxW * 1); |
|
742
|
|
|
$hLinha = $this->hLinha; |
|
743
|
|
|
$aFontTit = ['font' => $this->fontePadrao, 'size' => 8, 'style' => 'B']; |
|
744
|
|
|
$aFontTex = ['font' => $this->fontePadrao, 'size' => 8, 'style' => '']; |
|
745
|
|
|
$chBPe = str_replace('BPe', '', $this->infBPe->getAttribute("Id")); |
|
746
|
|
|
|
|
747
|
|
|
if ($this->checkCancelada()) { |
|
748
|
|
|
//101 Cancelamento |
|
749
|
|
|
$this->pdf->setTextColor(255, 0, 0); |
|
750
|
|
|
$texto = "BPe CANCELADO"; |
|
751
|
|
|
$this->pdf->textBox($x, $y - 25, $w, $h, $texto, ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'], 'T', 'C', 0, ''); |
|
752
|
|
|
$this->pdf->setTextColor(0, 0, 0); |
|
753
|
|
|
} |
|
754
|
|
|
|
|
755
|
|
|
if (!$this->checkNaoAutorizada()) { |
|
|
|
|
|
|
756
|
|
|
//'' Não Aprovada |
|
757
|
|
|
$this->pdf->setTextColor(255, 0, 0); |
|
758
|
|
|
$texto = "SEM VALOR FISCAL"; |
|
759
|
|
|
$this->pdf->textBox($x, $y - 25, $w, $h, $texto, ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'], 'T', 'C', 0, ''); |
|
760
|
|
|
$this->pdf->setTextColor(0, 0, 0); |
|
761
|
|
|
} |
|
762
|
|
|
|
|
763
|
|
|
if ($this->checkSubstituto()) { |
|
764
|
|
|
//uso denegado |
|
765
|
|
|
$this->pdf->setTextColor(255, 0, 0); |
|
766
|
|
|
$texto = "BPe Substituto"; |
|
767
|
|
|
$this->pdf->textBox($x, $y - 25, $w, $h, $texto, $aFontTit, 'T', 'C', 0, ''); |
|
768
|
|
|
$this->pdf->SetTextColor(0, 0, 0); |
|
769
|
|
|
} |
|
770
|
|
|
|
|
771
|
|
|
$cUF = $this->getTagValue($this->ide, 'cUF'); |
|
|
|
|
|
|
772
|
|
|
$nBP = $this->getTagValue($this->ide, 'nBP'); |
|
773
|
|
|
$serieBPe = str_pad($this->getTagValue($this->ide, "serie"), 3, "0", STR_PAD_LEFT); |
|
774
|
|
|
$dhEmi = $this->getTagValue($this->ide, "dhEmi"); |
|
775
|
|
|
$dhEmilocal = new \DateTime($dhEmi); |
|
776
|
|
|
$dhEmiLocalFormat = $dhEmilocal->format('d/m/Y H:i:s'); |
|
777
|
|
|
|
|
778
|
|
|
$texto = "Consulte pela chave de acesso em \n"; |
|
779
|
|
|
$this->pdf->textBox($x, $y, $w, $hLinha, $texto, $aFontTex, 'T', 'C', 0, '', false); |
|
780
|
|
|
|
|
781
|
|
|
$texto = $this->urlConsulta($this->getTagValue($this->ide, 'cUF')); |
|
782
|
|
|
$y = $y + $hLinha; |
|
783
|
|
|
$this->pdf->textBox($x, $y, $w, $hLinha, $texto, $aFontTit, 'T', 'C', 0, '', false); |
|
784
|
|
|
|
|
785
|
|
|
$texto = $chBPe ?? 'Chave Não Localizada no XML'; |
|
786
|
|
|
$y = $y + $hLinha; |
|
787
|
|
|
$this->pdf->textBox($x, $y, $w, $hLinha, $texto, $aFontTex, 'T', 'C', 0, '', false); |
|
788
|
|
|
|
|
789
|
|
|
$y = $y + $hLinha; |
|
790
|
|
|
$hTex1 = $hLinha * 2; |
|
|
|
|
|
|
791
|
|
|
|
|
792
|
|
|
if (isset($this->infPassageiro)) { |
|
793
|
|
|
$xNome = $this->getTagValue($this->infPassageiro, "xNome"); |
|
794
|
|
|
$nDoc = $this->getTagValue($this->infPassageiro, "nDoc"); |
|
795
|
|
|
$texto = "PASSAGEIRO: DOC: " . $nDoc . " - " . $xNome; |
|
796
|
|
|
$y = $y + $hLinha; |
|
797
|
|
|
$this->pdf->textBox($x, $y, $w, $hLinha * 2, $texto, $aFontTex, 'T', 'C', 0, '', false); |
|
798
|
|
|
} |
|
799
|
|
|
|
|
800
|
|
|
if (!empty($this->getTagValue($this->infValorBPe, "tpDesconto"))) { |
|
801
|
|
|
|
|
802
|
|
|
switch ($this->getTagValue($this->infValorBPe, "tpDesconto")) { |
|
803
|
|
|
case "01": |
|
804
|
|
|
$xtpDesconto = "Tarifa promocional"; |
|
805
|
|
|
break; |
|
806
|
|
|
case "02": |
|
807
|
|
|
$xtpDesconto = "Idoso"; |
|
808
|
|
|
break; |
|
809
|
|
|
case "03": |
|
810
|
|
|
$xtpDesconto = "Criança"; |
|
811
|
|
|
break; |
|
812
|
|
|
case "04": |
|
813
|
|
|
$xtpDesconto = "Deficiente"; |
|
814
|
|
|
break; |
|
815
|
|
|
case "05": |
|
816
|
|
|
$xtpDesconto = "Estudante"; |
|
817
|
|
|
break; |
|
818
|
|
|
case "06": |
|
819
|
|
|
$xtpDesconto = "Animal Doméstico"; |
|
820
|
|
|
break; |
|
821
|
|
|
case "07": |
|
822
|
|
|
$xtpDesconto = "Acordo Coletivo"; |
|
823
|
|
|
break; |
|
824
|
|
|
case "08": |
|
825
|
|
|
$xtpDesconto = "Profissional em Deslocamento"; |
|
826
|
|
|
break; |
|
827
|
|
|
case "09": |
|
828
|
|
|
$xtpDesconto = "Profissional da Empresa"; |
|
829
|
|
|
break; |
|
830
|
|
|
case "10": |
|
831
|
|
|
$xtpDesconto = "Jovem"; |
|
832
|
|
|
break; |
|
833
|
|
|
case "99": |
|
834
|
|
|
$xtpDesconto = "Outros"; |
|
835
|
|
|
break; |
|
836
|
|
|
} |
|
837
|
|
|
$y = $y + $hLinha * 3; |
|
838
|
|
|
$texto = "TIPO DE DESCONTO: " . $xtpDesconto; |
|
|
|
|
|
|
839
|
|
|
$this->pdf->textBox($x, $y, $w, $hLinha, $texto, $aFontTex, 'T', 'C', 0, '', false); |
|
840
|
|
|
} |
|
841
|
|
|
|
|
842
|
|
|
$texto = "BP-e nº " . $nBP . " Série " . $serieBPe . " " . $dhEmiLocalFormat; |
|
843
|
|
|
$y = $y + ($hLinha * 3); |
|
844
|
|
|
$this->pdf->textBox($x, $y, $w, $hLinha, $texto, $aFontTit, 'T', 'C', 0, '', false); |
|
845
|
|
|
|
|
846
|
|
|
$y = $y + $hLinha * 2; |
|
847
|
|
|
if (empty($this->dhCont)) { |
|
848
|
|
|
|
|
849
|
|
|
$nProt = $this->getTagValue($this->protBPe, "nProt"); |
|
850
|
|
|
$dhRecbto = $this->getTagValue($this->protBPe, "dhRecbto"); |
|
851
|
|
|
$dhRecbto = new \DateTime($dhRecbto); |
|
852
|
|
|
$texto = "Protocolo de autorização: " . $nProt; |
|
853
|
|
|
$this->pdf->textBox($x, $y, $w, $hLinha, $texto, $aFontTex, 'T', 'C', 0, '', false); |
|
854
|
|
|
$y = $y + $hLinha * 2; |
|
855
|
|
|
$texto = "\nData de autorização: " . $dhRecbto->format('d/m/Y H:i:s'); |
|
856
|
|
|
$this->pdf->textBox($x, $y, $w, $hLinha, $texto, $aFontTex, 'T', 'C', 0, '', false); |
|
857
|
|
|
|
|
858
|
|
|
} else { |
|
859
|
|
|
$texto = "EMITIDA EM CONTINGÊNCIA"; |
|
860
|
|
|
$aFontTex = ['font' => $this->fontePadrao, 'size' => 12, 'style' => 'B']; |
|
861
|
|
|
$this->pdf->textBox($x, $yTex3 + $hLinha, $w, $hLinha, $texto, $aFontTex, 'T', 'C', 0, '', false); |
|
|
|
|
|
|
862
|
|
|
$yTex4 = $y + ($hLinha * 8); |
|
863
|
|
|
$texto = "\nPendente de autorização "; |
|
864
|
|
|
$aFontTex = ['font' => $this->fontePadrao, 'size' => 8, 'style' => '']; |
|
865
|
|
|
$this->pdf->textBox($x, $yTex4 + $hLinha, $w, $hLinha, $texto, $aFontTex, 'T', 'C', 0, '', false); |
|
866
|
|
|
} |
|
867
|
|
|
} |
|
868
|
|
|
|
|
869
|
|
|
protected function checkCancelada() |
|
870
|
|
|
{ |
|
871
|
|
|
if (!isset($this->infProt)) { |
|
872
|
|
|
return false; |
|
873
|
|
|
} |
|
874
|
|
|
$cStat = $this->getTagValue($this->infProt, "cStat"); |
|
875
|
|
|
return $cStat == '101'; |
|
876
|
|
|
} |
|
877
|
|
|
|
|
878
|
|
|
protected function checkNaoAutorizada() |
|
879
|
|
|
{ |
|
880
|
|
|
if (!isset($this->infProt)) { |
|
881
|
|
|
$cStat = $this->getTagValue($this->infProt, "cStat"); |
|
|
|
|
|
|
882
|
|
|
return $cStat == ''; |
|
883
|
|
|
} |
|
884
|
|
|
} |
|
885
|
|
|
|
|
886
|
|
|
protected function checkSubstituto() |
|
887
|
|
|
{ |
|
888
|
|
|
if (!isset($this->infProt)) { |
|
889
|
|
|
return false; |
|
890
|
|
|
} |
|
891
|
|
|
//NÃO ERA NECESSÁRIO ESSA FUNÇÃO POIS SÓ SE USA |
|
892
|
|
|
//1 VEZ NO ARQUIVO INTEIRO |
|
893
|
|
|
$cStat = $this->getTagValue($this->infProt, "cStat"); |
|
894
|
|
|
return $cStat == '102'; |
|
895
|
|
|
} |
|
896
|
|
|
|
|
897
|
|
|
protected function qrCodeDABPE($x = 0, $y = 0, $h = 0) |
|
|
|
|
|
|
898
|
|
|
{ |
|
899
|
|
|
$y += 15; |
|
900
|
|
|
$margemInterna = $this->margemInterna; |
|
901
|
|
|
$maxW = $this->wPrint; |
|
902
|
|
|
$w = ($maxW * 1) + 4; |
|
903
|
|
|
$hLinha = $this->hLinha; |
|
|
|
|
|
|
904
|
|
|
$hBoxLinha = $this->hBoxLinha; |
|
905
|
|
|
$aFontTit = array('font' => $this->fontePadrao, 'size' => 8, 'style' => 'B'); |
|
|
|
|
|
|
906
|
|
|
$aFontTex = array('font' => $this->fontePadrao, 'size' => 8, 'style' => ''); |
|
907
|
|
|
$dhRecbto = ''; |
|
908
|
|
|
$nProt = ''; |
|
|
|
|
|
|
909
|
|
|
if (isset($this->infBPeSupl)) { |
|
910
|
|
|
$nProt = $this->getTagValue($this->nfeProc, "nProt"); |
|
|
|
|
|
|
911
|
|
|
$dhRecbto = $this->getTagValue($this->nfeProc, "dhRecbto"); |
|
912
|
|
|
} |
|
913
|
|
|
|
|
914
|
|
|
$barcode = new Barcode(); |
|
915
|
|
|
$bobj = $barcode->getBarcodeObj( |
|
916
|
|
|
'QRCODE,M', |
|
917
|
|
|
$this->qrCodBPe, |
|
918
|
|
|
-4, |
|
919
|
|
|
-4, |
|
920
|
|
|
'black', |
|
921
|
|
|
array(-2, -2, -2, -2) |
|
922
|
|
|
)->setBackgroundColor('white'); |
|
923
|
|
|
$qrcode = $bobj->getPngData(); |
|
924
|
|
|
$wQr = 50; |
|
925
|
|
|
$hQr = 50; |
|
926
|
|
|
$yQr = ($y + $margemInterna); |
|
927
|
|
|
$xQr = ($w / 2) - ($wQr / 2); |
|
928
|
|
|
// prepare a base64 encoded "data url" |
|
929
|
|
|
$pic = 'data://text/plain;base64,' . base64_encode($qrcode); |
|
930
|
|
|
$info = getimagesize($pic); |
|
|
|
|
|
|
931
|
|
|
$this->pdf->image($pic, $xQr, $yQr, $wQr, $hQr, 'PNG'); |
|
932
|
|
|
$dt = new DateTime($dhRecbto); |
|
|
|
|
|
|
933
|
|
|
$yQr = ($yQr + $hQr + $margemInterna); |
|
934
|
|
|
|
|
935
|
|
|
if (isset($this->ICMSSN)) { |
|
936
|
|
|
$vTotTrib = $this->getTagValue($this->ICMSSN, "vTotTrib"); |
|
937
|
|
|
$this->pdf->textBox($x, $yQr, $w - 4, $hBoxLinha, "Tributos Totais Incidentes(Lei Federal 12.741/2012): R$" . $vTotTrib, $aFontTex, 'C', 'C', 0, '', false); |
|
938
|
|
|
} |
|
939
|
|
|
|
|
940
|
|
|
} |
|
941
|
|
|
|
|
942
|
|
|
protected function infAdic($x = 0, $y = 0, $h = 0) |
|
|
|
|
|
|
943
|
|
|
{ |
|
944
|
|
|
$y += 17; |
|
945
|
|
|
$margemInterna = $this->margemInterna; |
|
|
|
|
|
|
946
|
|
|
$maxW = $this->wPrint; |
|
947
|
|
|
$w = ($maxW * 1); |
|
948
|
|
|
$hLinha = $this->hLinha; |
|
949
|
|
|
$aFontTit = ['font' => $this->fontePadrao, 'size' => 8, 'style' => 'B']; |
|
950
|
|
|
$aFontTex = ['font' => $this->fontePadrao, 'size' => 8, 'style' => '']; |
|
951
|
|
|
// seta o textbox do titulo |
|
952
|
|
|
$texto = "INFORMAÇÃO ADICIONAL"; |
|
953
|
|
|
$heigthText = $this->pdf->textBox($x, $y, $w, $hLinha, $texto, $aFontTit, 'C', 'C', 0, '', false); |
|
|
|
|
|
|
954
|
|
|
|
|
955
|
|
|
// seta o textbox do texto adicional |
|
956
|
|
|
$this->pdf->textBox($x, $y + 3, $w - 2, $hLinha - 3, $this->textoAdic, $aFontTex, 'T', 'L', 0, '', false); |
|
957
|
|
|
} |
|
958
|
|
|
|
|
959
|
|
|
public function paperWidth($width = 80) |
|
960
|
|
|
{ |
|
961
|
|
|
if (is_int($width) && $width > 60) { |
|
962
|
|
|
$this->paperwidth = $width; |
|
963
|
|
|
} |
|
964
|
|
|
return $this->paperwidth; |
|
965
|
|
|
} |
|
966
|
|
|
|
|
967
|
|
|
// public function inicia($id) |
|
968
|
|
|
// { |
|
969
|
|
|
// $pdo = Conexao::getInstance(); |
|
970
|
|
|
// $bpe = $pdo->prepare('SELECT chbpe, CNPJ FROM bpe WHERE id = ? ') |
|
971
|
|
|
// ->execute([ |
|
972
|
|
|
// $id, |
|
973
|
|
|
// ]); |
|
974
|
|
|
// $pastaxml = 'homologacao'; // Pegar do Banco de dados, se emissão em homologação ou produção |
|
975
|
|
|
// $filename = "../../../../_backend/XML/{$bpe->CNPJ}/BP-e/{$pastaxml}/assinadas/{$bpe->chBPe}-bpe.xml"; // Ambiente Windows |
|
976
|
|
|
// file_get_contents($filename, $xml); |
|
977
|
|
|
// try { |
|
978
|
|
|
// $this->__construct($xml, '', 1); |
|
979
|
|
|
// $pdf = $this->render(); |
|
980
|
|
|
// header('Content-Type: application/pdf'); |
|
981
|
|
|
// echo $pdf; |
|
982
|
|
|
// } |
|
983
|
|
|
// } |
|
984
|
|
|
|
|
985
|
|
|
protected function pagamentosDABPE($x = 0, $y = 0, $h = 0) |
|
|
|
|
|
|
986
|
|
|
{ |
|
987
|
|
|
$y += 6; |
|
988
|
|
|
$margemInterna = $this->margemInterna; |
|
|
|
|
|
|
989
|
|
|
$maxW = $this->wPrint; |
|
990
|
|
|
$qtdPgto = $this->pag->length; |
|
991
|
|
|
$w = ($maxW * 1); |
|
992
|
|
|
$hLinha = $this->hLinha; |
|
993
|
|
|
$wColEsq = ($maxW * 0.7); |
|
994
|
|
|
$wColDir = ($maxW * 0.3); |
|
|
|
|
|
|
995
|
|
|
$xValor = $x + $wColEsq; |
|
|
|
|
|
|
996
|
|
|
$aFontPgto = array('font' => $this->fontePadrao, 'size' => 7, 'style' => ''); |
|
997
|
|
|
$wBoxEsq = $w * 0.7; |
|
998
|
|
|
$texto = "FORMA PAGAMENTO"; |
|
999
|
|
|
$this->pdf->textBox($x, $y, $wBoxEsq, $hLinha, $texto, $aFontPgto, 'T', 'L', 0, '', false); |
|
1000
|
|
|
$wBoxDir = $w * 0.3; |
|
1001
|
|
|
$xBoxDescricao = $x + $wBoxEsq; |
|
1002
|
|
|
$texto = "VALOR PAGO"; |
|
1003
|
|
|
$this->pdf->textBox($xBoxDescricao, $y, $wBoxDir, $hLinha, $texto, $aFontPgto, 'T', 'R', 0, '', false); |
|
1004
|
|
|
$vTroco = number_format($this->getTagValue($this->infValorBPe, "vTroco"), 2, ",", "."); |
|
1005
|
|
|
$cont = 0; |
|
1006
|
|
|
if ($qtdPgto > 0) { |
|
1007
|
|
|
foreach ($this->pag as $pagI) { |
|
1008
|
|
|
$tPag = $this->getTagValue($pagI, "tPag"); |
|
1009
|
|
|
switch ($tPag) { |
|
1010
|
|
|
case "01": |
|
1011
|
|
|
$tPagNome = "Dinheiro R$"; |
|
1012
|
|
|
break; |
|
1013
|
|
|
case "02": |
|
1014
|
|
|
$tPagNome = "Cheque R$"; |
|
1015
|
|
|
break; |
|
1016
|
|
|
case "03": |
|
1017
|
|
|
$tPagNome = "Cartão de Crédito R$"; |
|
1018
|
|
|
break; |
|
1019
|
|
|
case "04": |
|
1020
|
|
|
$tPagNome = "Cartão de Débito R$"; |
|
1021
|
|
|
break; |
|
1022
|
|
|
case "05": |
|
1023
|
|
|
$tPagNome = "Vale Transporte R$"; |
|
1024
|
|
|
break; |
|
1025
|
|
|
case "99": |
|
1026
|
|
|
$tPagNome = "Outros"; |
|
1027
|
|
|
break; |
|
1028
|
|
|
} |
|
1029
|
|
|
$vPag = number_format($this->getTagValue($pagI, "vPag"), 2, ",", "."); |
|
1030
|
|
|
$yBoxProd = $y + $hLinha + ($cont * $hLinha); |
|
1031
|
|
|
$texto = $tPagNome; |
|
|
|
|
|
|
1032
|
|
|
$this->pdf->textBox($x, $yBoxProd, $wBoxEsq, $hLinha, $texto, $aFontPgto, 'T', 'L', 0, '', false); |
|
1033
|
|
|
//COLOCA PRODUTO DESCRIÇÃO |
|
1034
|
|
|
$xBoxDescricao = $wBoxEsq + $x; |
|
1035
|
|
|
$texto = $vPag; |
|
1036
|
|
|
$this->pdf->textBox( |
|
1037
|
|
|
$xBoxDescricao, |
|
1038
|
|
|
$yBoxProd, |
|
1039
|
|
|
$wBoxDir, |
|
1040
|
|
|
$hLinha, |
|
1041
|
|
|
$texto, |
|
1042
|
|
|
$aFontPgto, |
|
1043
|
|
|
'C', |
|
1044
|
|
|
'R', |
|
1045
|
|
|
0, |
|
1046
|
|
|
'', |
|
1047
|
|
|
false |
|
1048
|
|
|
); |
|
1049
|
|
|
$cont++; |
|
1050
|
|
|
} |
|
1051
|
|
|
$ytroco = $qtdPgto; |
|
1052
|
|
|
} else { |
|
1053
|
|
|
$ytroco = 1; |
|
1054
|
|
|
} |
|
1055
|
|
|
$yBoxProd = $y + $hLinha + ($ytroco * $hLinha); |
|
1056
|
|
|
$texto = "Troco"; |
|
1057
|
|
|
$this->pdf->textBox($x, $yBoxProd, $wBoxEsq, $hLinha, $texto, $aFontPgto, 'T', 'L', 0, '', false); |
|
1058
|
|
|
|
|
1059
|
|
|
$texto = $vTroco; |
|
1060
|
|
|
$this->pdf->textBox( |
|
1061
|
|
|
$xBoxDescricao, |
|
1062
|
|
|
$yBoxProd, |
|
1063
|
|
|
$wBoxDir, |
|
1064
|
|
|
$hLinha, |
|
1065
|
|
|
$texto, |
|
1066
|
|
|
$aFontPgto, |
|
1067
|
|
|
'C', |
|
1068
|
|
|
'R', |
|
1069
|
|
|
0, |
|
1070
|
|
|
'', |
|
1071
|
|
|
false |
|
1072
|
|
|
); |
|
1073
|
|
|
} |
|
1074
|
|
|
} |
|
1075
|
|
|
|
|
1076
|
|
|
/* |
|
1077
|
|
|
$pdf = $dabpe->render(); |
|
1078
|
|
|
header('Content-Type: application/pdf'); |
|
1079
|
|
|
echo $pdf; |
|
1080
|
|
|
$xml = file_get_contents($filename, $xml); |
|
1081
|
|
|
$dabpe = new Dabpe($xml); |
|
1082
|
|
|
|
|
1083
|
|
|
} catch (Exception $e) { |
|
1084
|
|
|
echo $e->getMessage(); |
|
1085
|
|
|
} |
|
1086
|
|
|
*/ |
|
1087
|
|
|
|
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italyis not defined by the methodfinale(...).The most likely cause is that the parameter was removed, but the annotation was not.