|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace NFePHP\DA\NFe\Traits; |
|
4
|
|
|
|
|
5
|
|
|
/** |
|
6
|
|
|
* Bloco Informações sobre impostos aproximados |
|
7
|
|
|
*/ |
|
8
|
|
|
trait TraitBlocoIX |
|
9
|
|
|
{ |
|
10
|
|
|
protected function blocoIX($y) |
|
11
|
|
|
{ |
|
12
|
|
|
$aFont = ['font'=> $this->fontePadrao, 'size' => 7, 'style' => '']; |
|
|
|
|
|
|
13
|
|
|
$valor = $this->getTagValue($this->ICMSTot, 'vTotTrib'); |
|
|
|
|
|
|
14
|
|
|
$trib = !empty($valor) ? number_format((float) $valor, 2, ',', '.') : '-----'; |
|
15
|
|
|
$texto = "Tributos totais Incidentes (Lei Federal 12.741/2012): R$ {$trib}"; |
|
16
|
|
|
$aFont = ['font'=> $this->fontePadrao, 'size' => 7, 'style' => '']; |
|
17
|
|
|
$this->pdf->textBox( |
|
|
|
|
|
|
18
|
|
|
$this->margem, |
|
|
|
|
|
|
19
|
|
|
$y, |
|
20
|
|
|
$this->wPrint, |
|
|
|
|
|
|
21
|
|
|
$this->bloco9H, |
|
|
|
|
|
|
22
|
|
|
$texto, |
|
23
|
|
|
$aFont, |
|
24
|
|
|
'T', |
|
25
|
|
|
'C', |
|
26
|
|
|
false, |
|
27
|
|
|
'', |
|
28
|
|
|
true |
|
29
|
|
|
); |
|
30
|
|
|
if ($this->paperwidth < 70) { |
|
|
|
|
|
|
31
|
|
|
$fsize = 5; |
|
|
|
|
|
|
32
|
|
|
$aFont = ['font'=> $this->fontePadrao, 'size' => 5, 'style' => '']; |
|
33
|
|
|
} |
|
34
|
|
|
$this->pdf->textBox( |
|
35
|
|
|
$this->margem, |
|
36
|
|
|
$y+3, |
|
37
|
|
|
$this->wPrint, |
|
38
|
|
|
$this->bloco9H-4, |
|
39
|
|
|
$this->infCpl, |
|
|
|
|
|
|
40
|
|
|
$aFont, |
|
41
|
|
|
'T', |
|
42
|
|
|
'L', |
|
43
|
|
|
false, |
|
44
|
|
|
'', |
|
45
|
|
|
false |
|
46
|
|
|
); |
|
47
|
|
|
return $this->bloco9H + $y; |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* Calcula a altura do bloco IX |
|
52
|
|
|
* Depende do conteudo de infCpl |
|
53
|
|
|
* |
|
54
|
|
|
* @return int |
|
55
|
|
|
*/ |
|
56
|
|
|
protected function calculateHeighBlokIX() |
|
57
|
|
|
{ |
|
58
|
|
|
$papel = [$this->paperwidth, 100]; |
|
59
|
|
|
$wprint = $this->paperwidth - (2 * $this->margem); |
|
60
|
|
|
$logoAlign = 'L'; |
|
|
|
|
|
|
61
|
|
|
$orientacao = 'P'; |
|
62
|
|
|
$pdf = new \NFePHP\DA\Legacy\Pdf($orientacao, 'mm', $papel); |
|
|
|
|
|
|
63
|
|
|
$fsize = 7; |
|
64
|
|
|
$aFont = ['font'=> $this->fontePadrao, 'size' => 7, 'style' => '']; |
|
65
|
|
|
if ($this->paperwidth < 70) { |
|
66
|
|
|
$fsize = 5; |
|
67
|
|
|
$aFont = ['font'=> $this->fontePadrao, 'size' => 5, 'style' => '']; |
|
68
|
|
|
} |
|
69
|
|
|
$hfont = (imagefontheight($fsize)/72)*13; |
|
70
|
|
|
$numlinhas = $pdf->getNumLines($this->infCpl, $wprint, $aFont); |
|
71
|
|
|
return (int) ($numlinhas * $hfont) + 2; |
|
72
|
|
|
} |
|
73
|
|
|
} |
|
74
|
|
|
|
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: