|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace NFePHP\DA\CTe; |
|
4
|
|
|
|
|
5
|
|
|
/** |
|
6
|
|
|
* Classe para ageração do PDF da CTe, conforme regras e estruturas |
|
7
|
|
|
* estabelecidas pela SEFAZ. |
|
8
|
|
|
* |
|
9
|
|
|
* @category Library |
|
10
|
|
|
* @package nfephp-org/sped-da |
|
11
|
|
|
* @name Dacte .php |
|
12
|
|
|
* @copyright 2009-2019 NFePHP |
|
13
|
|
|
* @license http://www.gnu.org/licenses/lesser.html LGPL v3 |
|
14
|
|
|
* @link http://github.com/nfephp-org/sped-da for the canonical source repository |
|
15
|
|
|
* @author Roberto L. Machado <linux dot rlm at gmail dot com> |
|
16
|
|
|
*/ |
|
17
|
|
|
|
|
18
|
|
|
use Com\Tecnick\Barcode\Barcode; |
|
19
|
|
|
use Exception; |
|
20
|
|
|
use NFePHP\DA\Legacy\Dom; |
|
21
|
|
|
use NFePHP\DA\Legacy\Pdf; |
|
22
|
|
|
use NFePHP\DA\Common\DaCommon; |
|
23
|
|
|
|
|
24
|
|
|
class DacteOS extends DaCommon |
|
25
|
|
|
{ |
|
26
|
|
|
protected $yDados = 0; |
|
27
|
|
|
protected $xml; |
|
28
|
|
|
protected $errMsg = ''; |
|
29
|
|
|
protected $errStatus = false; |
|
30
|
|
|
|
|
31
|
|
|
protected $dom; |
|
32
|
|
|
protected $infCte; |
|
33
|
|
|
protected $infPercurso; |
|
34
|
|
|
protected $infCteComp; |
|
35
|
|
|
protected $chaveCTeRef; |
|
36
|
|
|
protected $tpCTe; |
|
37
|
|
|
protected $ide; |
|
38
|
|
|
protected $emit; |
|
39
|
|
|
protected $enderEmit; |
|
40
|
|
|
protected $infCarga; |
|
41
|
|
|
protected $infQ; |
|
42
|
|
|
protected $seg; |
|
43
|
|
|
protected $modal; |
|
44
|
|
|
protected $rodo; |
|
45
|
|
|
protected $moto; |
|
46
|
|
|
protected $veic; |
|
47
|
|
|
protected $ferrov; |
|
48
|
|
|
protected $Comp; |
|
49
|
|
|
protected $infNF; |
|
50
|
|
|
protected $infNFe; |
|
51
|
|
|
protected $compl; |
|
52
|
|
|
protected $ICMS; |
|
53
|
|
|
protected $imp; |
|
54
|
|
|
protected $toma4; |
|
55
|
|
|
protected $toma03; |
|
56
|
|
|
protected $tpEmis; |
|
57
|
|
|
protected $tpImp; |
|
58
|
|
|
protected $tpAmb; |
|
59
|
|
|
protected $vPrest; |
|
60
|
|
|
protected $infServico; |
|
61
|
|
|
protected $aquav; |
|
62
|
|
|
|
|
63
|
|
|
protected $wAdic = 150; |
|
64
|
|
|
protected $textoAdic = ''; |
|
65
|
|
|
protected $formatPadrao; |
|
66
|
|
|
protected $formatNegrito; |
|
67
|
|
|
|
|
68
|
|
|
protected $preVisualizar; |
|
69
|
|
|
protected $flagDocOrigContinuacao; |
|
70
|
|
|
protected $arrayNFe = array(); |
|
71
|
|
|
protected $siteDesenvolvedor; |
|
72
|
|
|
protected $nomeDesenvolvedor; |
|
73
|
|
|
protected $totPag; |
|
74
|
|
|
protected $idDocAntEle = []; |
|
75
|
|
|
protected $lota; |
|
76
|
|
|
protected $formatoChave = "#### #### #### #### #### #### #### #### #### #### ####"; |
|
77
|
|
|
protected $margemInterna = 0; |
|
78
|
|
|
|
|
79
|
|
|
/** |
|
80
|
|
|
* __construct |
|
81
|
|
|
* |
|
82
|
|
|
* @param string $xml Arquivo XML da CTeOS |
|
83
|
|
|
*/ |
|
84
|
|
|
public function __construct( |
|
85
|
|
|
$xml |
|
86
|
|
|
) { |
|
87
|
|
|
$this->loadDoc($xml); |
|
88
|
|
|
} |
|
89
|
|
|
|
|
90
|
|
|
private function loadDoc($xml) |
|
91
|
|
|
{ |
|
92
|
|
|
$this->xml = $xml; |
|
93
|
|
|
if (!empty($xml)) { |
|
94
|
|
|
$this->dom = new Dom(); |
|
95
|
|
|
$this->dom->loadXML($this->xml); |
|
96
|
|
|
$this->cteProc = $this->dom->getElementsByTagName("cteOSProc")->item(0); |
|
|
|
|
|
|
97
|
|
|
if (empty($this->dom->getElementsByTagName("infCte")->item(0))) { |
|
98
|
|
|
throw new \Exception('Isso não é um CT-e.'); |
|
99
|
|
|
} |
|
100
|
|
|
$this->infCte = $this->dom->getElementsByTagName("infCte")->item(0); |
|
101
|
|
|
$this->ide = $this->dom->getElementsByTagName("ide")->item(0); |
|
102
|
|
|
if ($this->getTagValue($this->ide, "mod") != '67') { |
|
103
|
|
|
throw new \Exception("O xml deve ser CT-e modelo 67."); |
|
104
|
|
|
} |
|
105
|
|
|
$this->emit = $this->dom->getElementsByTagName("emit")->item(0); |
|
106
|
|
|
$this->enderEmit = $this->dom->getElementsByTagName("enderEmit")->item(0); |
|
107
|
|
|
$this->infPercurso = $this->dom->getElementsByTagName("infPercurso"); |
|
108
|
|
|
$this->infCarga = $this->dom->getElementsByTagName("infCarga")->item(0); |
|
109
|
|
|
$this->infQ = $this->dom->getElementsByTagName("infQ"); |
|
110
|
|
|
$this->seg = $this->dom->getElementsByTagName("seg")->item(0); |
|
111
|
|
|
$this->rodo = $this->dom->getElementsByTagName("rodoOS")->item(0); |
|
112
|
|
|
$this->veic = $this->dom->getElementsByTagName("veic"); |
|
113
|
|
|
$this->ferrov = $this->dom->getElementsByTagName("ferrov")->item(0); |
|
114
|
|
|
// adicionar outros modais |
|
115
|
|
|
$this->infCteComp = $this->dom->getElementsByTagName("infCteComp")->item(0); |
|
116
|
|
|
$this->chaveCTeRef = $this->getTagValue($this->infCteComp, "chave"); |
|
117
|
|
|
$this->vPrest = $this->dom->getElementsByTagName("vPrest")->item(0); |
|
118
|
|
|
$this->Comp = $this->dom->getElementsByTagName("Comp"); |
|
119
|
|
|
$this->infNF = $this->dom->getElementsByTagName("infNF"); |
|
120
|
|
|
$this->infNFe = $this->dom->getElementsByTagName("infNFe"); |
|
121
|
|
|
$this->infOutros = $this->dom->getElementsByTagName("infOutros"); |
|
|
|
|
|
|
122
|
|
|
$this->infServico = $this->dom->getElementsByTagName("infServico"); |
|
123
|
|
|
$this->compl = $this->dom->getElementsByTagName("compl"); |
|
124
|
|
|
$this->ICMS = $this->dom->getElementsByTagName("ICMS")->item(0); |
|
125
|
|
|
$this->ICMSSN = $this->dom->getElementsByTagName("ICMSSN")->item(0); |
|
|
|
|
|
|
126
|
|
|
$this->imp = $this->dom->getElementsByTagName("imp")->item(0); |
|
127
|
|
|
|
|
128
|
|
|
$vTrib = $this->getTagValue($this->imp, "vTotTrib"); |
|
129
|
|
|
if (!is_numeric($vTrib)) { |
|
130
|
|
|
$vTrib = 0; |
|
131
|
|
|
} |
|
132
|
|
|
$textoAdic = number_format($vTrib, 2, ",", "."); |
|
133
|
|
|
$this->textoAdic = "o valor aproximado de tributos incidentes sobre o preço deste serviço é de R$" |
|
134
|
|
|
.$textoAdic; |
|
135
|
|
|
$this->toma = $this->dom->getElementsByTagName("toma")->item(0); |
|
|
|
|
|
|
136
|
|
|
$this->enderToma = $this->getTagValue($this->toma, "enderToma"); |
|
|
|
|
|
|
137
|
|
|
//modal aquaviário |
|
138
|
|
|
$this->aquav = $this->dom->getElementsByTagName("aquav")->item(0); |
|
139
|
|
|
$seguro = $this->getTagValue($this->seg, "respSeg"); |
|
140
|
|
|
$this->xSeg = $this->getTagValue($this->seg, "xSeg"); |
|
|
|
|
|
|
141
|
|
|
$this->nApol = $this->getTagValue($this->seg, "nApol"); |
|
|
|
|
|
|
142
|
|
|
switch ($seguro) { |
|
143
|
|
|
case '4': |
|
144
|
|
|
$this->respSeg = 'Emitente'; |
|
|
|
|
|
|
145
|
|
|
break; |
|
146
|
|
|
case '5': |
|
147
|
|
|
$this->respSeg = 'Tomador do Serviço'; |
|
148
|
|
|
break; |
|
149
|
|
|
default: |
|
150
|
|
|
$this->respSeg = ''; |
|
151
|
|
|
break; |
|
152
|
|
|
} |
|
153
|
|
|
$this->tpEmis = $this->getTagValue($this->ide, "tpEmis"); |
|
154
|
|
|
$this->tpImp = $this->getTagValue($this->ide, "tpImp"); |
|
155
|
|
|
$this->tpAmb = $this->getTagValue($this->ide, "tpAmb"); |
|
156
|
|
|
$this->tpCTe = $this->getTagValue($this->ide, "tpCTe"); |
|
157
|
|
|
$this->protCTe = $this->dom->getElementsByTagName("protCTe")->item(0); |
|
|
|
|
|
|
158
|
|
|
$this->qrCodMDFe = $this->dom->getElementsByTagName('qrCodCTe')->item(0) ? |
|
|
|
|
|
|
159
|
|
|
$this->dom->getElementsByTagName('qrCodCTe')->item(0)->nodeValue : 'SEM INFORMAÇÃO DE QRCODE'; |
|
160
|
|
|
//01-Rodoviário; //02-Aéreo; //03-Aquaviário; //04-Ferroviário;//05-Dutoviário |
|
161
|
|
|
$this->modal = $this->getTagValue($this->ide, "modal"); |
|
162
|
|
|
} |
|
163
|
|
|
} |
|
164
|
|
|
|
|
165
|
|
|
/** |
|
166
|
|
|
* montaDACTE |
|
167
|
|
|
* Esta função monta a DACTE conforme as informações fornecidas para a classe |
|
168
|
|
|
* durante sua construção. |
|
169
|
|
|
* A definição de margens e posições iniciais para a impressão são estabelecidas no |
|
170
|
|
|
* pelo conteúdo da funçao e podem ser modificados. |
|
171
|
|
|
* |
|
172
|
|
|
* @param string $logo |
|
173
|
|
|
* @return string O ID da NFe numero de 44 digitos extraido do arquivo XML |
|
174
|
|
|
*/ |
|
175
|
|
|
protected function monta( |
|
176
|
|
|
$logo = '' |
|
177
|
|
|
) { |
|
178
|
|
|
$this->pdf = ''; |
|
|
|
|
|
|
179
|
|
|
if (!empty($logo)) { |
|
180
|
|
|
$this->logomarca = $this->adjustImage($logo); |
|
181
|
|
|
} |
|
182
|
|
|
//se a orientação estiver em branco utilizar o padrão estabelecido na NF |
|
183
|
|
|
if ($this->orientacao == '') { |
|
184
|
|
|
if ($this->tpImp == '1') { |
|
185
|
|
|
$this->orientacao = 'P'; |
|
186
|
|
|
} else { |
|
187
|
|
|
$this->orientacao = 'P'; |
|
188
|
|
|
} |
|
189
|
|
|
} |
|
190
|
|
|
//instancia a classe pdf |
|
191
|
|
|
$margSup = $this->margsup; |
|
192
|
|
|
$margEsq = $this->margesq; |
|
193
|
|
|
$margDir = $this->margesq; |
|
194
|
|
|
|
|
195
|
|
|
$this->pdf = new Pdf($this->orientacao, 'mm', $this->papel); |
|
|
|
|
|
|
196
|
|
|
$this->formatPadrao = array( |
|
197
|
|
|
'font' => $this->fontePadrao, |
|
198
|
|
|
'size' => 6, |
|
199
|
|
|
'style' => ''); |
|
200
|
|
|
$this->formatNegrito = array( |
|
201
|
|
|
'font' => $this->fontePadrao, |
|
202
|
|
|
'size' => 7, |
|
203
|
|
|
'style' => 'B'); |
|
204
|
|
|
if ($this->orientacao == 'P') { |
|
205
|
|
|
// posição inicial do relatorio |
|
206
|
|
|
$xInic = 1; |
|
207
|
|
|
$yInic = 1; |
|
208
|
|
|
if ($this->papel == 'A4') { |
|
209
|
|
|
//A4 210x297mm |
|
210
|
|
|
$maxW = 210; |
|
211
|
|
|
$maxH = 297; |
|
212
|
|
|
} |
|
213
|
|
|
} else { |
|
214
|
|
|
// posição inicial do relatorio |
|
215
|
|
|
$xInic = 5; |
|
216
|
|
|
$yInic = 5; |
|
217
|
|
|
if ($this->papel == 'A4') { |
|
218
|
|
|
//A4 210x297mm |
|
219
|
|
|
$maxH = 210; |
|
220
|
|
|
$maxW = 297; |
|
221
|
|
|
$this->wCanhoto = 25; |
|
|
|
|
|
|
222
|
|
|
} |
|
223
|
|
|
} |
|
224
|
|
|
//total inicial de paginas |
|
225
|
|
|
$totPag = 1; |
|
|
|
|
|
|
226
|
|
|
//largura imprimivel em mm |
|
227
|
|
|
$this->wPrint = $maxW - ($margEsq + $xInic); |
|
|
|
|
|
|
228
|
|
|
//comprimento imprimivel em mm |
|
229
|
|
|
$this->hPrint = $maxH - ($margSup + $yInic); |
|
|
|
|
|
|
230
|
|
|
// estabelece contagem de paginas |
|
231
|
|
|
$this->pdf->aliasNbPages(); |
|
232
|
|
|
// fixa as margens |
|
233
|
|
|
$this->pdf->setMargins($margEsq, $margSup, $margDir); |
|
234
|
|
|
$this->pdf->setDrawColor(0, 0, 0); |
|
235
|
|
|
$this->pdf->setFillColor(255, 255, 255); |
|
236
|
|
|
// inicia o documento |
|
237
|
|
|
$this->pdf->open(); |
|
238
|
|
|
// adiciona a primeira página |
|
239
|
|
|
$this->pdf->addPage($this->orientacao, $this->papel); |
|
|
|
|
|
|
240
|
|
|
$this->pdf->setLineWidth(0.1); |
|
241
|
|
|
$this->pdf->setTextColor(0, 0, 0); |
|
242
|
|
|
//calculo do numero de páginas ??? |
|
243
|
|
|
$totPag = 1; |
|
244
|
|
|
//montagem da primeira página |
|
245
|
|
|
$pag = 1; |
|
246
|
|
|
$x = $xInic; |
|
247
|
|
|
$y = $yInic; |
|
248
|
|
|
//coloca o cabeçalho |
|
249
|
|
|
//$r = $this->cabecalho($x, $y, $pag, $totPag); |
|
250
|
|
|
$y += 70; |
|
251
|
|
|
$r = $this->tomador($x, $y); |
|
|
|
|
|
|
252
|
|
|
if ($this->tpCTe == '0') { |
|
253
|
|
|
//Normal |
|
254
|
|
|
$y += 10; |
|
255
|
|
|
$x = $xInic; |
|
256
|
|
|
//$r = $this->zDocOrig($x, $y); |
|
257
|
|
|
$r = $this->infPrestacaoServico($x, $y); |
|
|
|
|
|
|
258
|
|
|
$y += 53; |
|
259
|
|
|
$x = $xInic; |
|
260
|
|
|
$r = $this->compValorServ($x, $y); |
|
|
|
|
|
|
261
|
|
|
$y += 25; |
|
262
|
|
|
$x = $xInic; |
|
263
|
|
|
$r = $this->impostos($x, $y); |
|
|
|
|
|
|
264
|
|
|
$y += 13; |
|
265
|
|
|
$x = $xInic; |
|
266
|
|
|
$r = $this->observacoes($x, $y); |
|
|
|
|
|
|
267
|
|
|
$y += 19; |
|
268
|
|
|
$x = $xInic; |
|
269
|
|
|
$r = $this->seguro($x, $y); |
|
|
|
|
|
|
270
|
|
|
$y = $y-12; |
|
271
|
|
|
switch ($this->modal) { |
|
272
|
|
|
case '1': |
|
273
|
|
|
$y += 24.9; |
|
274
|
|
|
$x = $xInic; |
|
275
|
|
|
$r = $this->modalRod($x, $y); |
|
|
|
|
|
|
276
|
|
|
break; |
|
277
|
|
|
case '2': |
|
278
|
|
|
$y += 17.9; |
|
279
|
|
|
$x = $xInic; |
|
280
|
|
|
// TODO fmertins 31/10/14: este método não existe... |
|
281
|
|
|
$r = $this->modalAereo($x, $y); |
|
|
|
|
|
|
282
|
|
|
break; |
|
283
|
|
|
case '3': |
|
284
|
|
|
$y += 17.9; |
|
285
|
|
|
$x = $xInic; |
|
286
|
|
|
$r = $this->modalAquaviario($x, $y); |
|
|
|
|
|
|
287
|
|
|
break; |
|
288
|
|
|
case '4': |
|
289
|
|
|
$y += 17.9; |
|
290
|
|
|
$x = $xInic; |
|
291
|
|
|
$r = $this->modalFerr($x, $y); |
|
|
|
|
|
|
292
|
|
|
break; |
|
293
|
|
|
case '5': |
|
294
|
|
|
$y += 17.9; |
|
295
|
|
|
$x = $xInic; |
|
296
|
|
|
// TODO fmertins 31/10/14: este método não existe... |
|
297
|
|
|
$r = $this->modalDutoviario($x, $y); |
|
|
|
|
|
|
298
|
|
|
break; |
|
299
|
|
|
} |
|
300
|
|
|
if ($this->modal == '1') { |
|
301
|
|
|
if ($this->lota == 1) { |
|
302
|
|
|
$y += 37; |
|
303
|
|
|
} else { |
|
304
|
|
|
$y += 8.9; |
|
305
|
|
|
} |
|
306
|
|
|
} elseif ($this->modal == '3') { |
|
307
|
|
|
$y += 24.15; |
|
308
|
|
|
} else { |
|
309
|
|
|
$y += 37; |
|
310
|
|
|
} |
|
311
|
|
|
} else { |
|
312
|
|
|
$r = $this->cabecalho(1, 1, $pag, $totPag); |
|
|
|
|
|
|
313
|
|
|
//Complementado |
|
314
|
|
|
$y += 10; |
|
315
|
|
|
$x = $xInic; |
|
316
|
|
|
$r = $this->docCompl($x, $y); |
|
|
|
|
|
|
317
|
|
|
$y += 80; |
|
318
|
|
|
$x = $xInic; |
|
319
|
|
|
$r = $this->compValorServ($x, $y); |
|
|
|
|
|
|
320
|
|
|
$y += 25; |
|
321
|
|
|
$x = $xInic; |
|
322
|
|
|
$r = $this->impostos($x, $y); |
|
|
|
|
|
|
323
|
|
|
$y += 13; |
|
324
|
|
|
$x = $xInic; |
|
325
|
|
|
$r = $this->observacoes($x, $y); |
|
|
|
|
|
|
326
|
|
|
$y += 15; |
|
327
|
|
|
} |
|
328
|
|
|
$x = $xInic; |
|
329
|
|
|
$y += 1; |
|
330
|
|
|
$r = $this->dadosAdic($x, $y, $pag, $totPag); |
|
|
|
|
|
|
331
|
|
|
|
|
332
|
|
|
$y += 21; |
|
333
|
|
|
//$y += 11; |
|
334
|
|
|
$y = $this->canhoto($x, $y); |
|
|
|
|
|
|
335
|
|
|
|
|
336
|
|
|
//coloca o rodapé da página |
|
337
|
|
|
if ($this->orientacao == 'P') { |
|
338
|
|
|
$this->rodape(2, $this->hPrint - 2); |
|
339
|
|
|
} else { |
|
340
|
|
|
$this->rodape($xInic, $this->hPrint + 2.3); |
|
341
|
|
|
} |
|
342
|
|
|
if ($this->flagDocOrigContinuacao == 1) { |
|
343
|
|
|
$this->docOrigContinuacao(1, 71); |
|
|
|
|
|
|
344
|
|
|
} |
|
345
|
|
|
} |
|
346
|
|
|
|
|
347
|
|
|
/** |
|
348
|
|
|
* cabecalho |
|
349
|
|
|
* Monta o cabelhalho da DACTE ( retrato e paisagem ) |
|
350
|
|
|
* |
|
351
|
|
|
* @param number $x Posição horizontal inicial, canto esquerdo |
|
352
|
|
|
* @param number $y Posição vertical inicial, canto superior |
|
353
|
|
|
* @param number $pag Número da Página |
|
354
|
|
|
* @param number $totPag Total de páginas |
|
355
|
|
|
* @return number Posição vertical final |
|
356
|
|
|
*/ |
|
357
|
|
|
protected function cabecalho($x = 0, $y = 0, $pag = '1', $totPag = '1') |
|
|
|
|
|
|
358
|
|
|
{ |
|
359
|
|
|
$oldX = $x; |
|
360
|
|
|
$oldY = $y; |
|
361
|
|
|
if ($this->orientacao == 'P') { |
|
362
|
|
|
$maxW = $this->wPrint; |
|
363
|
|
|
} else { |
|
364
|
|
|
if ($pag == 1) { |
|
365
|
|
|
// primeira página |
|
366
|
|
|
$maxW = $this->wPrint - $this->wCanhoto; |
|
367
|
|
|
} else { |
|
368
|
|
|
// páginas seguintes |
|
369
|
|
|
$maxW = $this->wPrint; |
|
370
|
|
|
} |
|
371
|
|
|
} |
|
372
|
|
|
//################################################################## |
|
373
|
|
|
//coluna esquerda identificação do emitente |
|
374
|
|
|
$w = round($maxW * 0.42); |
|
375
|
|
|
if ($this->orientacao == 'P') { |
|
376
|
|
|
$aFont = array( |
|
|
|
|
|
|
377
|
|
|
'font' => $this->fontePadrao, |
|
378
|
|
|
'size' => 6, |
|
379
|
|
|
'style' => ''); |
|
380
|
|
|
} else { |
|
381
|
|
|
$aFont = $this->formatNegrito; |
|
|
|
|
|
|
382
|
|
|
} |
|
383
|
|
|
$w1 = $w; |
|
|
|
|
|
|
384
|
|
|
$h = 35; |
|
385
|
|
|
$oldY += $h; |
|
386
|
|
|
//desenha a caixa |
|
387
|
|
|
$this->pdf->textBox($x, $y, $w + 2, $h + 1); |
|
388
|
|
|
// coloca o logo |
|
389
|
|
|
if (!empty($this->logomarca)) { |
|
390
|
|
|
$logoInfo = getimagesize($this->logomarca); |
|
391
|
|
|
//largura da imagem em mm |
|
392
|
|
|
$logoWmm = ($logoInfo[0] / 72) * 25.4; |
|
393
|
|
|
//altura da imagem em mm |
|
394
|
|
|
$logoHmm = ($logoInfo[1] / 72) * 25.4; |
|
395
|
|
|
if ($this->logoAlign == 'L') { |
|
396
|
|
|
$nImgW = round($w / 3, 0); |
|
397
|
|
|
$nImgH = round($logoHmm * ($nImgW / $logoWmm), 0); |
|
398
|
|
|
$xImg = $x + 1; |
|
399
|
|
|
$yImg = round(($h - $nImgH) / 2, 0) + $y; |
|
400
|
|
|
//estabelecer posições do texto |
|
401
|
|
|
$x1 = round($xImg + $nImgW + 1, 0); |
|
402
|
|
|
$y1 = round($h / 3 + $y, 0); |
|
403
|
|
|
$tw = round(2 * $w / 3, 0); |
|
404
|
|
|
} elseif ($this->logoAlign == 'C') { |
|
405
|
|
|
$nImgH = round($h / 3, 0); |
|
406
|
|
|
$nImgW = round($logoWmm * ($nImgH / $logoHmm), 0); |
|
407
|
|
|
$xImg = round(($w - $nImgW) / 2 + $x, 0); |
|
408
|
|
|
$yImg = $y + 3; |
|
409
|
|
|
$x1 = $x; |
|
410
|
|
|
$y1 = round($yImg + $nImgH + 1, 0); |
|
411
|
|
|
$tw = $w; |
|
412
|
|
|
} elseif ($this->logoAlign == 'R') { |
|
413
|
|
|
$nImgW = round($w / 3, 0); |
|
414
|
|
|
$nImgH = round($logoHmm * ($nImgW / $logoWmm), 0); |
|
415
|
|
|
$xImg = round($x + ($w - (1 + $nImgW)), 0); |
|
416
|
|
|
$yImg = round(($h - $nImgH) / 2, 0) + $y; |
|
417
|
|
|
$x1 = $x; |
|
418
|
|
|
$y1 = round($h / 3 + $y, 0); |
|
419
|
|
|
$tw = round(2 * $w / 3, 0); |
|
420
|
|
|
} |
|
421
|
|
|
$this->pdf->image($this->logomarca, $xImg, $yImg, $nImgW, $nImgH, 'jpeg'); |
|
|
|
|
|
|
422
|
|
|
} else { |
|
423
|
|
|
$x1 = $x; |
|
424
|
|
|
$y1 = round($h / 3 + $y, 0); |
|
425
|
|
|
$tw = $w; |
|
426
|
|
|
} |
|
427
|
|
|
//Nome emitente |
|
428
|
|
|
$aFont = array( |
|
429
|
|
|
'font' => $this->fontePadrao, |
|
430
|
|
|
'size' => 9, |
|
431
|
|
|
'style' => 'B'); |
|
432
|
|
|
$texto = $this->getTagValue($this->emit, "xNome"); |
|
433
|
|
|
$this->pdf->textBox($x1, $y1, $tw, 8, $texto, $aFont, 'T', 'C', 0, ''); |
|
|
|
|
|
|
434
|
|
|
//endereço |
|
435
|
|
|
$y1 = $y1 + 3; |
|
436
|
|
|
$aFont = array( |
|
437
|
|
|
'font' => $this->fontePadrao, |
|
438
|
|
|
'size' => 7, |
|
439
|
|
|
'style' => ''); |
|
440
|
|
|
$fone = $this->getTagValue($this->enderEmit, "fone")!=""? $this->formatFone($this->enderEmit):''; |
|
|
|
|
|
|
441
|
|
|
$lgr = $this->getTagValue($this->enderEmit, "xLgr"); |
|
442
|
|
|
$nro = $this->getTagValue($this->enderEmit, "nro"); |
|
443
|
|
|
$cpl = $this->getTagValue($this->enderEmit, "xCpl"); |
|
|
|
|
|
|
444
|
|
|
$bairro = $this->getTagValue($this->enderEmit, "xBairro"); |
|
445
|
|
|
$CEP = $this->getTagValue($this->enderEmit, "CEP"); |
|
446
|
|
|
$CEP = $this->formatField($CEP, "#####-###"); |
|
447
|
|
|
$mun = $this->getTagValue($this->enderEmit, "xMun"); |
|
448
|
|
|
$UF = $this->getTagValue($this->enderEmit, "UF"); |
|
449
|
|
|
$xPais = $this->getTagValue($this->enderEmit, "xPais"); |
|
450
|
|
|
$texto = $lgr . "," . $nro . "\n" . $bairro . " - " |
|
451
|
|
|
. $CEP . " - " . $mun . " - " . $UF . " " . $xPais |
|
452
|
|
|
. "\n Fone/Fax: " . $fone; |
|
453
|
|
|
$this->pdf->textBox($x1 - 5, $y1 + 2, $tw + 5, 8, $texto, $aFont, 'T', 'C', 0, ''); |
|
|
|
|
|
|
454
|
|
|
//CNPJ/CPF IE |
|
455
|
|
|
$cpfCnpj = $this->formatCNPJCPF($this->emit); |
|
|
|
|
|
|
456
|
|
|
$ie = $this->getTagValue($this->emit, "IE"); |
|
457
|
|
|
$texto = 'CNPJ/CPF: ' . $cpfCnpj . ' Insc.Estadual: ' . $ie; |
|
458
|
|
|
$this->pdf->textBox($x1 - 1, $y1 + 12, $tw + 5, 8, $texto, $aFont, 'T', 'C', 0, ''); |
|
|
|
|
|
|
459
|
|
|
//outra caixa |
|
460
|
|
|
$h1 = 17.5; |
|
461
|
|
|
$y1 = $y + $h + 1; |
|
462
|
|
|
$this->pdf->textBox($x, $y1, $w + 2, $h1); |
|
463
|
|
|
//TIPO DO CT-E |
|
464
|
|
|
$texto = 'TIPO DO CTE'; |
|
465
|
|
|
$wa = 37; |
|
466
|
|
|
$aFont = array( |
|
467
|
|
|
'font' => $this->fontePadrao, |
|
468
|
|
|
'size' => 8, |
|
469
|
|
|
'style' => ''); |
|
470
|
|
|
$this->pdf->textBox($x, $y1, $w * 0.5, $h1, $texto, $aFont, 'T', 'C', 0, ''); |
|
|
|
|
|
|
471
|
|
|
$tpCTe = $this->getTagValue($this->ide, "tpCTe"); |
|
472
|
|
|
//0 - CT-e Normal,1 - CT-e de Complemento de Valores, |
|
473
|
|
|
//2 - CT-e de Anulação de Valores,3 - CT-e Substituto |
|
474
|
|
|
switch ($tpCTe) { |
|
475
|
|
|
case '0': |
|
476
|
|
|
$texto = 'Normal'; |
|
477
|
|
|
break; |
|
478
|
|
|
case '1': |
|
479
|
|
|
$texto = 'Complemento de Valores'; |
|
480
|
|
|
break; |
|
481
|
|
|
case '2': |
|
482
|
|
|
$texto = 'Anulação de Valores'; |
|
483
|
|
|
break; |
|
484
|
|
|
case '3': |
|
485
|
|
|
$texto = 'Substituto'; |
|
486
|
|
|
break; |
|
487
|
|
|
default: |
|
488
|
|
|
$texto = 'ERRO' . $tpCTe . $tpServ; |
|
|
|
|
|
|
489
|
|
|
} |
|
490
|
|
|
$aFont = $this->formatNegrito; |
|
491
|
|
|
$this->pdf->textBox($x, $y1 + 3, $w * 0.5, $h1, $texto, $aFont, 'T', 'C', 0, '', false); |
|
|
|
|
|
|
492
|
|
|
//TIPO DO SERVIÇO |
|
493
|
|
|
$texto = 'TIPO DO SERVIÇO'; |
|
494
|
|
|
$wb = 36; |
|
|
|
|
|
|
495
|
|
|
$aFont = array( |
|
496
|
|
|
'font' => $this->fontePadrao, |
|
497
|
|
|
'size' => 8, |
|
498
|
|
|
'style' => ''); |
|
499
|
|
|
$this->pdf->textBox($x + $wa + 4.5, $y1, $w * 0.5, $h1, $texto, $aFont, 'T', 'C', 0, ''); |
|
|
|
|
|
|
500
|
|
|
$tpServ = $this->getTagValue($this->ide, "tpServ"); |
|
501
|
|
|
//'6' => 'Transporte de Pessoas', '7' => 'Transporte de Valores', '8' => 'Transporte de Bagagem' |
|
502
|
|
|
switch ($tpServ) { |
|
503
|
|
|
case '6': |
|
504
|
|
|
$texto = 'Transporte de Pessoas'; |
|
505
|
|
|
break; |
|
506
|
|
|
case '7': |
|
507
|
|
|
$texto = 'Transporte de Valores'; |
|
508
|
|
|
break; |
|
509
|
|
|
case '8': |
|
510
|
|
|
$texto = 'Transporte de Bagagem'; |
|
511
|
|
|
break; |
|
512
|
|
|
default: |
|
513
|
|
|
$texto = 'ERRO' . $tpServ; |
|
514
|
|
|
} |
|
515
|
|
|
$aFont = $this->formatNegrito; |
|
516
|
|
|
$this->pdf->textBox($x + $wa + 4.5, $y1 + 3, $w * 0.5, $h1, $texto, $aFont, 'T', 'C', 0, '', false); |
|
|
|
|
|
|
517
|
|
|
$this->pdf->line($w * 0.5, $y1, $w * 0.5, $y1 + $h1); |
|
518
|
|
|
//TOMADOR DO SERVIÇO |
|
519
|
|
|
$aFont = $this->formatNegrito; |
|
|
|
|
|
|
520
|
|
|
|
|
521
|
|
|
//################################################################## |
|
522
|
|
|
//coluna direita |
|
523
|
|
|
$x += $w + 2; |
|
524
|
|
|
$w = round($maxW * 0.335); |
|
525
|
|
|
$w1 = $w; |
|
526
|
|
|
$h = 11; |
|
527
|
|
|
$this->pdf->textBox($x, $y, $w + 10, $h + 1); |
|
528
|
|
|
$texto = "DACTE OS"; |
|
529
|
|
|
$aFont = array( |
|
530
|
|
|
'font' => $this->fontePadrao, |
|
531
|
|
|
'size' => 10, |
|
532
|
|
|
'style' => 'B'); |
|
533
|
|
|
$this->pdf->textBox($x, $y + 1, $w, $h, $texto, $aFont, 'T', 'C', 0, ''); |
|
|
|
|
|
|
534
|
|
|
$aFont = array( |
|
535
|
|
|
'font' => $this->fontePadrao, |
|
536
|
|
|
'size' => 9, |
|
537
|
|
|
'style' => ''); |
|
538
|
|
|
$texto = "Documento Auxiliar do Conhecimento\nde Transporte Eletrônico para Outros Serviços"; |
|
539
|
|
|
$h = 10; |
|
540
|
|
|
$this->pdf->textBox($x, $y + 4, $w, $h, $texto, $aFont, 'T', 'C', 0, '', false); |
|
|
|
|
|
|
541
|
|
|
$x1 = $x + $w + 2; |
|
542
|
|
|
$w = round($maxW * 0.22, 0); |
|
543
|
|
|
$w2 = $w; |
|
|
|
|
|
|
544
|
|
|
$h = 11; |
|
545
|
|
|
$this->pdf->textBox($x1 + 8, $y, $w - 7.5, $h + 1); |
|
546
|
|
|
$texto = "MODAL"; |
|
547
|
|
|
$aFont = array( |
|
548
|
|
|
'font' => $this->fontePadrao, |
|
549
|
|
|
'size' => 10, |
|
550
|
|
|
'style' => ''); |
|
551
|
|
|
$this->pdf->textBox($x1, $y + 1, $w, $h, $texto, $aFont, 'T', 'C', 0, ''); |
|
|
|
|
|
|
552
|
|
|
switch ($this->modal) { |
|
553
|
|
|
case '1': |
|
554
|
|
|
$texto = 'Rodoviário'; |
|
555
|
|
|
break; |
|
556
|
|
|
case '2': |
|
557
|
|
|
$texto = 'Aéreo'; |
|
558
|
|
|
break; |
|
559
|
|
|
case '3': |
|
560
|
|
|
$texto = 'Aquaviário'; |
|
561
|
|
|
break; |
|
562
|
|
|
case '4': |
|
563
|
|
|
$texto = 'Ferroviário'; |
|
564
|
|
|
break; |
|
565
|
|
|
case '5': |
|
566
|
|
|
$texto = 'Dutoviário'; |
|
567
|
|
|
break; |
|
568
|
|
|
} |
|
569
|
|
|
$aFont = array( |
|
570
|
|
|
'font' => $this->fontePadrao, |
|
571
|
|
|
'size' => 10, |
|
572
|
|
|
'style' => 'B'); |
|
573
|
|
|
$this->pdf->textBox($x1, $y + 5, $w, $h, $texto, $aFont, 'T', 'C', 0, ''); |
|
|
|
|
|
|
574
|
|
|
//outra caixa |
|
575
|
|
|
$y += 12; |
|
576
|
|
|
$h = 9; |
|
577
|
|
|
$w = $w1 + 10; |
|
578
|
|
|
$this->pdf->textBox($x, $y, $w, $h + 1); |
|
579
|
|
|
//modelo |
|
580
|
|
|
$wa = 12; |
|
581
|
|
|
$xa = $x; |
|
582
|
|
|
$texto = 'MODELO'; |
|
583
|
|
|
$aFont = array( |
|
584
|
|
|
'font' => $this->fontePadrao, |
|
585
|
|
|
'size' => 8, |
|
586
|
|
|
'style' => ''); |
|
587
|
|
|
$this->pdf->textBox($xa, $y + 1, $wa, $h, $texto, $aFont, 'T', 'C', 0, ''); |
|
|
|
|
|
|
588
|
|
|
$texto = $this->getTagValue($this->ide, "mod"); |
|
589
|
|
|
$aFont = $this->formatNegrito; |
|
590
|
|
|
$this->pdf->textBox($xa, $y + 5, $wa, $h, $texto, $aFont, 'T', 'C', 0, ''); |
|
|
|
|
|
|
591
|
|
|
$this->pdf->line($x + $wa, $y, $x + $wa, $y + $h + 1); |
|
592
|
|
|
//serie |
|
593
|
|
|
$xa += $wa; |
|
594
|
|
|
$texto = 'SÉRIE'; |
|
595
|
|
|
$aFont = array( |
|
596
|
|
|
'font' => $this->fontePadrao, |
|
597
|
|
|
'size' => 8, |
|
598
|
|
|
'style' => ''); |
|
599
|
|
|
$this->pdf->textBox($xa, $y + 1, $wa, $h, $texto, $aFont, 'T', 'C', 0, ''); |
|
|
|
|
|
|
600
|
|
|
$texto = $this->getTagValue($this->ide, "serie"); |
|
601
|
|
|
$aFont = $this->formatNegrito; |
|
602
|
|
|
$this->pdf->textBox($xa, $y + 5, $wa, $h, $texto, $aFont, 'T', 'C', 0, ''); |
|
|
|
|
|
|
603
|
|
|
$this->pdf->line($xa + $wa, $y, $xa + $wa, $y + $h + 1); |
|
604
|
|
|
//numero |
|
605
|
|
|
$xa += $wa; |
|
606
|
|
|
$wa = 20; |
|
607
|
|
|
$texto = 'NÚMERO'; |
|
608
|
|
|
$aFont = array( |
|
609
|
|
|
'font' => $this->fontePadrao, |
|
610
|
|
|
'size' => 8, |
|
611
|
|
|
'style' => ''); |
|
612
|
|
|
$this->pdf->textBox($xa, $y + 1, $wa, $h, $texto, $aFont, 'T', 'C', 0, ''); |
|
|
|
|
|
|
613
|
|
|
$texto = $this->getTagValue($this->ide, "nCT"); |
|
614
|
|
|
$aFont = $this->formatNegrito; |
|
615
|
|
|
$this->pdf->textBox($xa, $y + 5, $wa, $h, $texto, $aFont, 'T', 'C', 0, ''); |
|
|
|
|
|
|
616
|
|
|
$this->pdf->line($xa + $wa, $y, $xa + $wa, $y + $h + 1); |
|
617
|
|
|
//data hora de emissão |
|
618
|
|
|
$xa += $wa; |
|
619
|
|
|
$wa = 35; |
|
620
|
|
|
$texto = 'DATA E HORA DE EMISSÃO'; |
|
621
|
|
|
$aFont = array( |
|
622
|
|
|
'font' => $this->fontePadrao, |
|
623
|
|
|
'size' => 8, |
|
624
|
|
|
'style' => ''); |
|
625
|
|
|
$this->pdf->textBox($xa, $y + 1, $wa, $h, $texto, $aFont, 'T', 'C', 0, ''); |
|
|
|
|
|
|
626
|
|
|
$this->pdf->line($xa + $wa, $y, $xa + $wa, $y + $h + 1); |
|
627
|
|
|
$texto = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ? |
|
628
|
|
|
date('d/m/Y H:i:s', $this->toTimestamp($this->getTagValue($this->ide, "dhEmi"))) : ''; |
|
629
|
|
|
$aFont = $this->formatNegrito; |
|
630
|
|
|
$this->pdf->textBox($xa, $y + 5, $wa, $h, $texto, $aFont, 'T', 'C', 0, ''); |
|
|
|
|
|
|
631
|
|
|
$this->pdf->line($xa + $wa, $y, $xa + $wa, $y + $h + 1); |
|
632
|
|
|
//outra caixa |
|
633
|
|
|
$y += $h + 1; |
|
634
|
|
|
$h = 23; |
|
635
|
|
|
$h1 = 14; |
|
636
|
|
|
//$this->pdf->textBox($x, $y, $w + 0.5, $h1); |
|
637
|
|
|
//CODIGO DE BARRAS |
|
638
|
|
|
$chave_acesso = str_replace('CTe', '', $this->infCte->getAttribute("Id")); |
|
639
|
|
|
$bW = 75; |
|
640
|
|
|
$bH = 10; |
|
641
|
|
|
//codigo de barras |
|
642
|
|
|
$this->pdf->setFillColor(0, 0, 0); |
|
643
|
|
|
$this->pdf->code128($x + 2, $y + 2, $chave_acesso, $bW, $bH); |
|
644
|
|
|
$this->pdf->line($xa + $wa, $y, $xa + $wa, $y + $h - 1); |
|
645
|
|
|
$this->pdf->textBox($x, $y + $h1, $w + 0.5, $h1 - 6); |
|
646
|
|
|
$texto = 'CHAVE DE ACESSO'; |
|
647
|
|
|
$aFont = $this->formatPadrao; |
|
648
|
|
|
$this->pdf->textBox($x + 1, $y + $h1, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
649
|
|
|
$aFont = $this->formatNegrito; |
|
650
|
|
|
$texto = $this->formatField($chave_acesso, $this->formatoChave); |
|
651
|
|
|
$this->pdf->textBox($x + 1, $y + $h1 + 3, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
652
|
|
|
$this->pdf->textBox($x, $y + $h1 + 8, $w + 0.5, $h1 - 4.5); |
|
653
|
|
|
$texto = "Consulta de autenticidade no portal nacional do CT-e, "; |
|
654
|
|
|
$texto .= "no site da Sefaz Autorizadora, \r\n ou em http://www.cte.fazenda.gov.br"; |
|
655
|
|
|
if ($this->tpEmis == 5 || $this->tpEmis == 7 || $this->tpEmis == 8) { |
|
656
|
|
|
$texto = ""; |
|
657
|
|
|
$this->pdf->setFillColor(0, 0, 0); |
|
658
|
|
|
if ($this->tpEmis == 5) { |
|
659
|
|
|
$chaveContingencia = $this->geraChaveAdicCont(); |
|
660
|
|
|
$this->pdf->code128($x + 20, $y1 + 10, $chaveContingencia, $bW * .9, $bH / 2); |
|
661
|
|
|
} else { |
|
662
|
|
|
$chaveContingencia = $this->getTagValue($this->protCTe, "nProt"); |
|
663
|
|
|
$this->pdf->code128($x + 40, $y1 + 10, $chaveContingencia, $bW * .4, $bH / 2); |
|
664
|
|
|
} |
|
665
|
|
|
//codigo de barras |
|
666
|
|
|
} |
|
667
|
|
|
$aFont = array( |
|
668
|
|
|
'font' => $this->fontePadrao, |
|
669
|
|
|
'size' => 8, |
|
670
|
|
|
'style' => ''); |
|
671
|
|
|
$this->pdf->textBox($x, $y + $h1 + 9, $w, $h, $texto, $aFont, 'T', 'C', 0, ''); |
|
|
|
|
|
|
672
|
|
|
//outra caixa |
|
673
|
|
|
$y += $h + 1; |
|
674
|
|
|
$h = 8.5; |
|
675
|
|
|
$wa = $w; |
|
676
|
|
|
$this->pdf->textBox($x, $y + 7.5, $w + 0.5, $h); |
|
677
|
|
|
if (!empty($this->numdepec)) { |
|
678
|
|
|
$texto = 'NÚMERO DE REGISTRO DPEC'; |
|
679
|
|
|
} elseif ($this->tpEmis == 5 || $this->tpEmis == 7 || $this->tpEmis == 8) { |
|
680
|
|
|
$texto = "DADOS DO CT-E"; |
|
681
|
|
|
} else { |
|
682
|
|
|
$texto = 'PROTOCOLO DE AUTORIZAÇÃO DE USO'; |
|
683
|
|
|
} |
|
684
|
|
|
$aFont = $this->formatPadrao; |
|
685
|
|
|
$this->pdf->textBox($x, $y + 7.5, $wa, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
686
|
|
|
if (!empty($this->numdepec)) { |
|
687
|
|
|
$texto = $this->numdepec; |
|
688
|
|
|
} elseif ($this->tpEmis == 5) { |
|
689
|
|
|
$chaveContingencia = $this->geraChaveAdicCont(); |
|
690
|
|
|
$aFont = array( |
|
|
|
|
|
|
691
|
|
|
'font' => $this->fontePadrao, |
|
692
|
|
|
'size' => 8, |
|
693
|
|
|
'style' => 'B'); |
|
694
|
|
|
$texto = $this->formatField($chaveContingencia, "#### #### #### #### #### #### #### #### ####"); |
|
695
|
|
|
$cStat = ''; |
|
|
|
|
|
|
696
|
|
|
} else { |
|
697
|
|
|
$texto = $this->getTagValue($this->protCTe, "nProt") . " - "; |
|
698
|
|
|
// empty($volume->getElementsByTagName("qVol")->item(0)->nodeValue) |
|
699
|
|
|
if (!empty($this->protCTe) |
|
700
|
|
|
&& !empty($this->protCTe->getElementsByTagName("dhRecbto")->item(0)->nodeValue) |
|
701
|
|
|
) { |
|
702
|
|
|
$texto .= date( |
|
703
|
|
|
'd/m/Y H:i:s', |
|
704
|
|
|
$this->toTimestamp($this->getTagValue($this->protCTe, "dhRecbto")) |
|
705
|
|
|
); |
|
706
|
|
|
} |
|
707
|
|
|
$texto = $this->getTagValue($this->protCTe, "nProt") == '' ? '' : $texto; |
|
708
|
|
|
} |
|
709
|
|
|
$aFont = $this->formatNegrito; |
|
710
|
|
|
$this->pdf->textBox($x, $y + 12, $wa, $h, $texto, $aFont, 'T', 'C', 0, ''); |
|
|
|
|
|
|
711
|
|
|
|
|
712
|
|
|
if ($this->qrCodMDFe !== null) { |
|
713
|
|
|
$this->qrCodeDacteOs($y-25); |
|
714
|
|
|
$w = 38; |
|
715
|
|
|
$x += 79; |
|
716
|
|
|
$this->pdf->textBox($x, $y - 34, $w + 0.5, $h + 41.5); |
|
717
|
|
|
} |
|
718
|
|
|
//CFOP |
|
719
|
|
|
$x = $oldX; |
|
720
|
|
|
$h = 8.5; |
|
721
|
|
|
$w = round($maxW * 0.42); |
|
722
|
|
|
$y1 = $y + 7.5; |
|
723
|
|
|
$this->pdf->textBox($x, $y1, $w + 2, $h); |
|
724
|
|
|
$texto = 'CFOP - NATUREZA DA PRESTAÇÃO'; |
|
725
|
|
|
$aFont = array( |
|
726
|
|
|
'font' => $this->fontePadrao, |
|
727
|
|
|
'size' => 8, |
|
728
|
|
|
'style' => ''); |
|
729
|
|
|
$this->pdf->textBox($x, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
730
|
|
|
$texto = $this->getTagValue($this->ide, "CFOP") . ' - ' . $this->getTagValue($this->ide, "natOp"); |
|
731
|
|
|
$aFont = $this->formatNegrito; |
|
732
|
|
|
$this->pdf->textBox($x, $y1 + 3.5, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
733
|
|
|
//ORIGEM DA PRESTAÇÃO |
|
734
|
|
|
$y += $h + 7.5; |
|
735
|
|
|
$x = $oldX; |
|
736
|
|
|
$h = 8; |
|
737
|
|
|
$w = ($maxW * 0.33); |
|
738
|
|
|
$this->pdf->textBox($x, $y, $w + 0.5, $h); |
|
739
|
|
|
$texto = 'INÍCIO DA PRESTAÇÃO'; |
|
740
|
|
|
$aFont = array( |
|
741
|
|
|
'font' => $this->fontePadrao, |
|
742
|
|
|
'size' => 8, |
|
743
|
|
|
'style' => ''); |
|
744
|
|
|
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
745
|
|
|
$texto = $this->getTagValue($this->ide, "xMunIni") . ' - ' . $this->getTagValue($this->ide, "UFIni"); |
|
746
|
|
|
$aFont = $this->formatNegrito; |
|
747
|
|
|
$this->pdf->textBox($x, $y + 3.5, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
748
|
|
|
//PERCURSO DO VEÍCULO |
|
749
|
|
|
$x = $oldX + 69; |
|
750
|
|
|
$oldX = $x; |
|
751
|
|
|
$h = 8; |
|
752
|
|
|
$w = ($maxW * 0.334); |
|
753
|
|
|
$this->pdf->textBox($x, $y, $w + 0.5, $h); |
|
754
|
|
|
$texto = 'PERCURSO DO VEÍCULO'; |
|
755
|
|
|
$aFont = array( |
|
756
|
|
|
'font' => $this->fontePadrao, |
|
757
|
|
|
'size' => 8, |
|
758
|
|
|
'style' => ''); |
|
759
|
|
|
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
760
|
|
|
$texto = ''; |
|
761
|
|
|
$first = true; |
|
762
|
|
|
if (!empty($this->infPercurso)) { |
|
763
|
|
|
foreach ($this->infPercurso as $k => $d) { |
|
764
|
|
|
if (!$first) { |
|
765
|
|
|
$texto .= ' - '; |
|
766
|
|
|
} else { |
|
767
|
|
|
$first = false; |
|
768
|
|
|
} |
|
769
|
|
|
$texto .= $this->infPercurso->item($k)->getElementsByTagName('UFPer')->item(0)->nodeValue; |
|
770
|
|
|
} |
|
771
|
|
|
} |
|
772
|
|
|
$aFont = $this->formatNegrito; |
|
773
|
|
|
$this->pdf->textBox($x, $y + 3.5, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
774
|
|
|
//DESTINO DA PRESTAÇÃO |
|
775
|
|
|
$x = $oldX + $w + 1; |
|
776
|
|
|
$h = 8; |
|
777
|
|
|
$w = $w - 1.3; |
|
778
|
|
|
$this->pdf->textBox($x - 0.5, $y, $w + 0.5, $h); |
|
779
|
|
|
$texto = 'TÉRMINO DA PRESTAÇÃO'; |
|
780
|
|
|
$aFont = array( |
|
781
|
|
|
'font' => $this->fontePadrao, |
|
782
|
|
|
'size' => 8, |
|
783
|
|
|
'style' => ''); |
|
784
|
|
|
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
785
|
|
|
$texto = $this->getTagValue($this->ide, "xMunFim") . ' - ' . $this->getTagValue($this->ide, "UFFim"); |
|
786
|
|
|
$aFont = $this->formatNegrito; |
|
787
|
|
|
$this->pdf->textBox($x, $y + 3.5, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
788
|
|
|
//######################################################################### |
|
789
|
|
|
//Indicação de CTe Homologação, cancelamento e falta de protocolo |
|
790
|
|
|
$resp = $this->statusCTe(); |
|
791
|
|
|
if (!$resp['status']) { |
|
792
|
|
|
$n = count($resp['message']); |
|
793
|
|
|
$alttot = $n * 15; |
|
794
|
|
|
$x = 10; |
|
795
|
|
|
$y = $this->hPrint/2 - $alttot/2; |
|
796
|
|
|
$h = 15; |
|
797
|
|
|
$w = $maxW - (2 * $x); |
|
798
|
|
|
$this->pdf->settextcolor(90, 90, 90); |
|
799
|
|
|
foreach ($resp['message'] as $msg) { |
|
|
|
|
|
|
800
|
|
|
$aFont = ['font' => $this->fontePadrao, 'size' => 48, 'style' => 'B']; |
|
801
|
|
|
$this->pdf->textBox($x, $y, $w, $h, $msg, $aFont, 'C', 'C', 0, ''); |
|
|
|
|
|
|
802
|
|
|
$y += $h; |
|
803
|
|
|
} |
|
804
|
|
|
$texto = $resp['submessage']; |
|
805
|
|
|
if (!empty($texto)) { |
|
806
|
|
|
$y += 3; |
|
807
|
|
|
$h = 5; |
|
808
|
|
|
$aFont = ['font' => $this->fontePadrao, 'size' => 20, 'style' => 'B']; |
|
809
|
|
|
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
|
|
|
|
|
|
810
|
|
|
$y += $h; |
|
811
|
|
|
} |
|
812
|
|
|
$y += 5; |
|
813
|
|
|
$w = $maxW - (2 * $x); |
|
814
|
|
|
$texto = "SEM VALOR FISCAL"; |
|
815
|
|
|
$aFont = ['font' => $this->fontePadrao, 'size' => 48, 'style' => 'B']; |
|
816
|
|
|
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
|
|
|
|
|
|
817
|
|
|
$this->pdf->settextcolor(0, 0, 0); |
|
818
|
|
|
} |
|
819
|
|
|
return $oldY; |
|
820
|
|
|
} |
|
821
|
|
|
|
|
822
|
|
|
/** |
|
823
|
|
|
* Verifica o status da CTe |
|
824
|
|
|
* |
|
825
|
|
|
* @return array |
|
826
|
|
|
*/ |
|
827
|
|
|
protected function statusCTe() |
|
828
|
|
|
{ |
|
829
|
|
|
$resp = [ |
|
830
|
|
|
'status' => true, |
|
831
|
|
|
'message' => [], |
|
832
|
|
|
'submessage' => '' |
|
833
|
|
|
]; |
|
834
|
|
|
if (!isset($this->cteProc)) { |
|
835
|
|
|
$resp['status'] = false; |
|
836
|
|
|
$resp['message'][] = 'CTe NÃO PROTOCOLADO'; |
|
837
|
|
|
} elseif ($this->getTagValue($this->ide, "tpAmb") == '2') { |
|
838
|
|
|
$resp['status'] = false; |
|
839
|
|
|
$resp['message'][] = "CTe EMITIDO EM HOMOLOGAÇÃO"; |
|
840
|
|
|
} |
|
841
|
|
|
$retEvento = $this->cteProc->getElementsByTagName('retEventoCTe')->item(0); |
|
842
|
|
|
$cStat = $this->getTagValue($this->cteProc, "cStat"); |
|
843
|
|
|
if ($cStat == '110' || |
|
844
|
|
|
$cStat == '301' || |
|
845
|
|
|
$cStat == '302' |
|
846
|
|
|
) { |
|
847
|
|
|
$resp['status'] = false; |
|
848
|
|
|
$resp['message'][] = "CTe DENEGADO"; |
|
849
|
|
|
} elseif ($cStat == '101' |
|
850
|
|
|
|| $cStat == '151' |
|
851
|
|
|
|| $cStat == '135' |
|
852
|
|
|
|| $cStat == '155' |
|
853
|
|
|
|| $this->cancelFlag === true |
|
854
|
|
|
) { |
|
855
|
|
|
$resp['status'] = false; |
|
856
|
|
|
$resp['message'][] = "CTe CANCELADO"; |
|
857
|
|
|
} elseif (!empty($retEvento)) { |
|
858
|
|
|
$infEvento = $retEvento->getElementsByTagName('infEvento')->item(0); |
|
859
|
|
|
$cStat = $this->getTagValue($infEvento, "cStat"); |
|
860
|
|
|
$tpEvento= $this->getTagValue($infEvento, "tpEvento"); |
|
861
|
|
|
$dhEvento = date("d/m/Y H:i:s", $this->toTimestamp($this->getTagValue($infEvento, "dhRegEvento"))); |
|
862
|
|
|
$nProt = $this->getTagValue($infEvento, "nProt"); |
|
863
|
|
|
if ($tpEvento == '110111' && ($cStat == '101' || $cStat == '151' || $cStat == '135' || $cStat == '155')) { |
|
864
|
|
|
$resp['status'] = false; |
|
865
|
|
|
$resp['message'][] = "CTe CANCELADO"; |
|
866
|
|
|
$resp['submessage'] = "{$dhEvento} - {$nProt}"; |
|
867
|
|
|
} |
|
868
|
|
|
} elseif (($this->tpEmis == 5 || $this->tpEmis == 7 || $this->tpEmis == 8) && !empty($this->numdepec)) { |
|
869
|
|
|
$resp['status'] = true; |
|
870
|
|
|
$resp['message'][] = "CTe Emitido em Contingência"; |
|
871
|
|
|
$resp['message'][] = "devido à problemas técnicos"; |
|
872
|
|
|
} elseif ($this->tpEmis == 4) { |
|
873
|
|
|
$resp['status'] = true; |
|
874
|
|
|
$resp['message'][] = "CTe impresso em contingência -"; |
|
875
|
|
|
$resp['message'][] = "DPEC regularmente recebido pela Receita"; |
|
876
|
|
|
$resp['message'][] = "Federal do Brasil"; |
|
877
|
|
|
} |
|
878
|
|
|
return $resp; |
|
879
|
|
|
} |
|
880
|
|
|
|
|
881
|
|
|
/** |
|
882
|
|
|
* rodapeDACTE |
|
883
|
|
|
* Monta o rodape no final da DACTE ( retrato e paisagem ) |
|
884
|
|
|
* |
|
885
|
|
|
* @param number $xInic Posição horizontal canto esquerdo |
|
|
|
|
|
|
886
|
|
|
* @param number $yFinal Posição vertical final para impressão |
|
|
|
|
|
|
887
|
|
|
*/ |
|
888
|
|
|
protected function rodape($x, $y) |
|
889
|
|
|
{ |
|
890
|
|
|
$texto = "Impresso em " . date('d/m/Y H:i:s') . ' ' . $this->creditos; |
|
891
|
|
|
$w = $this->wPrint - 4; |
|
892
|
|
|
$aFont = array( |
|
893
|
|
|
'font' => $this->fontePadrao, |
|
894
|
|
|
'size' => 6, |
|
895
|
|
|
'style' => ''); |
|
896
|
|
|
$this->pdf->textBox($x-1, $y+2, $w, 4, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
897
|
|
|
$texto = $this->powered ? "Powered by NFePHP®" : ''; |
|
898
|
|
|
$this->pdf->textBox($x, $y, $w, 0, $texto, $aFont, 'T', 'R', false, ''); |
|
899
|
|
|
} |
|
900
|
|
|
|
|
901
|
|
|
/** |
|
902
|
|
|
* tomador |
|
903
|
|
|
* Monta o campo com os dados do remetente na DACTE. ( retrato e paisagem ) |
|
904
|
|
|
* |
|
905
|
|
|
* @param number $x Posição horizontal canto esquerdo |
|
906
|
|
|
* @param number $y Posição vertical canto superior |
|
907
|
|
|
* @return number Posição vertical final |
|
908
|
|
|
*/ |
|
909
|
|
|
protected function tomador($x = 0, $y = 0) |
|
910
|
|
|
{ |
|
911
|
|
|
$oldX = $x; |
|
912
|
|
|
$oldY = $y; |
|
|
|
|
|
|
913
|
|
|
if ($this->orientacao == 'P') { |
|
914
|
|
|
$maxW = $this->wPrint; |
|
915
|
|
|
} else { |
|
916
|
|
|
$maxW = $this->wPrint - $this->wCanhoto; |
|
917
|
|
|
} |
|
918
|
|
|
$w = $maxW; |
|
919
|
|
|
$h = 10; |
|
920
|
|
|
$texto = 'TOMADOR DO SERVIÇO'; |
|
921
|
|
|
$aFont = $this->formatPadrao; |
|
922
|
|
|
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, ''); |
|
|
|
|
|
|
923
|
|
|
$aFont = $this->formatNegrito; |
|
924
|
|
|
$texto = $this->getTagValue($this->toma, "xNome"); |
|
925
|
|
|
$this->pdf->textBox($x + 29, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
926
|
|
|
$x = $maxW * 0.60; |
|
927
|
|
|
$texto = 'MUNICÍPIO'; |
|
928
|
|
|
$aFont = $this->formatPadrao; |
|
929
|
|
|
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
930
|
|
|
$texto = $this->getTagValue($this->toma, "xMun"); |
|
931
|
|
|
$aFont = $this->formatNegrito; |
|
932
|
|
|
$this->pdf->textBox($x + 15, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
933
|
|
|
$x = $maxW * 0.85; |
|
934
|
|
|
$texto = 'UF'; |
|
935
|
|
|
$aFont = $this->formatPadrao; |
|
936
|
|
|
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
937
|
|
|
$texto = $this->getTagValue($this->toma, "UF"); |
|
938
|
|
|
$aFont = $this->formatNegrito; |
|
939
|
|
|
$this->pdf->textBox($x + 4, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
940
|
|
|
$x = $w - 18; |
|
941
|
|
|
$texto = 'CEP'; |
|
942
|
|
|
$aFont = $this->formatPadrao; |
|
943
|
|
|
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
944
|
|
|
$texto = $this->formatField($this->getTagValue($this->toma, "CEP"), "#####-###"); |
|
945
|
|
|
$aFont = $this->formatNegrito; |
|
946
|
|
|
$this->pdf->textBox($x + 6, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
947
|
|
|
$y += 3; |
|
948
|
|
|
$x = $oldX; |
|
949
|
|
|
$texto = 'ENDEREÇO'; |
|
950
|
|
|
$aFont = $this->formatPadrao; |
|
951
|
|
|
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
952
|
|
|
$aFont = $this->formatNegrito; |
|
953
|
|
|
$texto = $this->getTagValue($this->toma, "xLgr") . ','; |
|
954
|
|
|
$texto .= $this->getTagValue($this->toma, "nro"); |
|
955
|
|
|
$texto .= ($this->getTagValue($this->toma, "xCpl") != "") ? |
|
956
|
|
|
' - ' . $this->getTagValue($this->toma, "xCpl") : ''; |
|
957
|
|
|
$texto .= ' - ' . $this->getTagValue($this->toma, "xBairro"); |
|
958
|
|
|
$this->pdf->textBox($x + 16, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
959
|
|
|
$y += 3; |
|
960
|
|
|
$texto = 'CNPJ/CPF'; |
|
961
|
|
|
$aFont = $this->formatPadrao; |
|
962
|
|
|
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
963
|
|
|
$texto = $this->formatCNPJCPF($this->toma); |
|
964
|
|
|
$aFont = $this->formatNegrito; |
|
965
|
|
|
$this->pdf->textBox($x + 13, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
966
|
|
|
$x = $x + 65; |
|
967
|
|
|
$texto = 'INSCRIÇÃO ESTADUAL'; |
|
968
|
|
|
$aFont = $this->formatPadrao; |
|
969
|
|
|
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
970
|
|
|
$texto = $this->getTagValue($this->toma, "IE"); |
|
971
|
|
|
$aFont = $this->formatNegrito; |
|
972
|
|
|
$this->pdf->textBox($x + 28, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
973
|
|
|
$x = $w * 0.75; |
|
974
|
|
|
$texto = 'PAÍS'; |
|
975
|
|
|
$aFont = $this->formatPadrao; |
|
976
|
|
|
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
977
|
|
|
$texto = $this->getTagValue($this->toma, "xPais") != "" ? |
|
978
|
|
|
$this->getTagValue($this->toma, "xPais") : 'BRASIL'; |
|
979
|
|
|
$aFont = $this->formatNegrito; |
|
980
|
|
|
$this->pdf->textBox($x + 6, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
981
|
|
|
$x = $w - 27; |
|
982
|
|
|
$texto = 'FONE'; |
|
983
|
|
|
$aFont = $this->formatPadrao; |
|
984
|
|
|
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
985
|
|
|
$texto = $this->getTagValue($this->toma, "fone")!=""? $this->formatFone($this->toma):''; |
|
986
|
|
|
$aFont = $this->formatNegrito; |
|
987
|
|
|
$this->pdf->textBox($x + 8, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
988
|
|
|
} |
|
989
|
|
|
|
|
990
|
|
|
/** |
|
991
|
|
|
* compValorServ |
|
992
|
|
|
* Monta o campo com os componentes da prestação de serviços. |
|
993
|
|
|
* |
|
994
|
|
|
* @param number $x Posição horizontal canto esquerdo |
|
995
|
|
|
* @param number $y Posição vertical canto superior |
|
996
|
|
|
* @return number Posição vertical final |
|
997
|
|
|
*/ |
|
998
|
|
|
protected function compValorServ($x = 0, $y = 0) |
|
999
|
|
|
{ |
|
1000
|
|
|
$oldX = $x; |
|
1001
|
|
|
$oldY = $y; |
|
|
|
|
|
|
1002
|
|
|
if ($this->orientacao == 'P') { |
|
1003
|
|
|
$maxW = $this->wPrint; |
|
1004
|
|
|
} else { |
|
1005
|
|
|
$maxW = $this->wPrint - $this->wCanhoto; |
|
1006
|
|
|
} |
|
1007
|
|
|
$w = $maxW; |
|
1008
|
|
|
$h = 25; |
|
1009
|
|
|
$texto = 'COMPONENTES DO VALOR DA PRESTAÇÃO DO SERVIÇO'; |
|
1010
|
|
|
$aFont = $this->formatPadrao; |
|
1011
|
|
|
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'C', 1, ''); |
|
|
|
|
|
|
1012
|
|
|
$y += 3.4; |
|
1013
|
|
|
$this->pdf->line($x, $y, $w + 1, $y); |
|
1014
|
|
|
$texto = 'NOME'; |
|
1015
|
|
|
$aFont = $this->formatPadrao; |
|
1016
|
|
|
$this->pdf->textBox($x, $y, $w * 0.14, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1017
|
|
|
$yIniDados = $y; |
|
1018
|
|
|
$x = $w * 0.14; |
|
1019
|
|
|
$texto = 'VALOR'; |
|
1020
|
|
|
$aFont = $this->formatPadrao; |
|
1021
|
|
|
$this->pdf->textBox($x, $y, $w * 0.14, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1022
|
|
|
$x = $w * 0.28; |
|
1023
|
|
|
$this->pdf->line($x, $y, $x, $y + 21.5); |
|
1024
|
|
|
$texto = 'NOME'; |
|
1025
|
|
|
$aFont = $this->formatPadrao; |
|
1026
|
|
|
$this->pdf->textBox($x, $y, $w * 0.14, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1027
|
|
|
$x = $w * 0.42; |
|
1028
|
|
|
$texto = 'VALOR'; |
|
1029
|
|
|
$aFont = $this->formatPadrao; |
|
1030
|
|
|
$this->pdf->textBox($x, $y, $w * 0.14, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1031
|
|
|
$x = $w * 0.56; |
|
1032
|
|
|
$this->pdf->line($x, $y, $x, $y + 21.5); |
|
1033
|
|
|
$texto = 'NOME'; |
|
1034
|
|
|
$aFont = $this->formatPadrao; |
|
1035
|
|
|
$this->pdf->textBox($x, $y, $w * 0.14, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1036
|
|
|
$x = $w * 0.70; |
|
1037
|
|
|
$texto = 'VALOR'; |
|
1038
|
|
|
$aFont = $this->formatPadrao; |
|
1039
|
|
|
$this->pdf->textBox($x, $y, $w * 0.14, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1040
|
|
|
$x = $w * 0.86; |
|
1041
|
|
|
$this->pdf->line($x, $y, $x, $y + 21.5); |
|
1042
|
|
|
$y += 1; |
|
1043
|
|
|
$texto = 'VALOR TOTAL DO SERVIÇO'; |
|
1044
|
|
|
$aFont = $this->formatPadrao; |
|
1045
|
|
|
$this->pdf->textBox($x, $y, $w * 0.14, $h, $texto, $aFont, 'T', 'C', 0, ''); |
|
|
|
|
|
|
1046
|
|
|
$texto = number_format($this->getTagValue($this->vPrest, "vTPrest"), 2, ",", "."); |
|
1047
|
|
|
$aFont = array( |
|
1048
|
|
|
'font' => $this->fontePadrao, |
|
1049
|
|
|
'size' => 9, |
|
1050
|
|
|
'style' => 'B'); |
|
1051
|
|
|
$this->pdf->textBox($x, $y + 4, $w * 0.14, $h, $texto, $aFont, 'T', 'C', 0, ''); |
|
|
|
|
|
|
1052
|
|
|
$y += 10; |
|
1053
|
|
|
$this->pdf->line($x, $y, $w + 1, $y); |
|
1054
|
|
|
$y += 1; |
|
1055
|
|
|
$texto = 'VALOR A RECEBER'; |
|
1056
|
|
|
$aFont = $this->formatPadrao; |
|
1057
|
|
|
$this->pdf->textBox($x, $y, $w * 0.14, $h, $texto, $aFont, 'T', 'C', 0, ''); |
|
|
|
|
|
|
1058
|
|
|
$texto = number_format($this->getTagValue($this->vPrest, "vRec"), 2, ",", "."); |
|
1059
|
|
|
$aFont = array( |
|
1060
|
|
|
'font' => $this->fontePadrao, |
|
1061
|
|
|
'size' => 9, |
|
1062
|
|
|
'style' => 'B'); |
|
1063
|
|
|
$this->pdf->textBox($x, $y + 4, $w * 0.14, $h, $texto, $aFont, 'T', 'C', 0, ''); |
|
|
|
|
|
|
1064
|
|
|
$auxX = $oldX; |
|
1065
|
|
|
$yIniDados += 4; |
|
1066
|
|
|
|
|
1067
|
|
|
foreach ($this->Comp as $k => $d) { |
|
1068
|
|
|
$nome = $this->Comp->item($k)->getElementsByTagName('xNome')->item(0)->nodeValue; |
|
1069
|
|
|
$valor = number_format( |
|
1070
|
|
|
$this->Comp->item($k)->getElementsByTagName('vComp')->item(0)->nodeValue, |
|
1071
|
|
|
2, |
|
1072
|
|
|
",", |
|
1073
|
|
|
"." |
|
1074
|
|
|
); |
|
1075
|
|
|
if ($auxX > $w * 0.60) { |
|
1076
|
|
|
$yIniDados = $yIniDados + 4; |
|
1077
|
|
|
$auxX = $oldX; |
|
1078
|
|
|
} |
|
1079
|
|
|
$texto = $nome; |
|
1080
|
|
|
$aFont = $this->formatPadrao; |
|
1081
|
|
|
$this->pdf->textBox($auxX, $yIniDados, $w * 0.14, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1082
|
|
|
$auxX += $w * 0.14; |
|
1083
|
|
|
$texto = $valor; |
|
1084
|
|
|
$aFont = $this->formatPadrao; |
|
1085
|
|
|
$this->pdf->textBox($auxX, $yIniDados, $w * 0.14, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1086
|
|
|
$auxX += $w * 0.14; |
|
1087
|
|
|
} |
|
1088
|
|
|
} //fim da função compValorDACTE |
|
1089
|
|
|
|
|
1090
|
|
|
/** |
|
1091
|
|
|
* impostos |
|
1092
|
|
|
* Monta o campo com os dados do remetente na DACTE. ( retrato e paisagem ) |
|
1093
|
|
|
* |
|
1094
|
|
|
* @param number $x Posição horizontal canto esquerdo |
|
1095
|
|
|
* @param number $y Posição vertical canto superior |
|
1096
|
|
|
* @return number Posição vertical final |
|
1097
|
|
|
*/ |
|
1098
|
|
|
protected function impostos($x = 0, $y = 0) |
|
1099
|
|
|
{ |
|
1100
|
|
|
$oldX = $x; |
|
1101
|
|
|
$oldY = $y; |
|
|
|
|
|
|
1102
|
|
|
if ($this->orientacao == 'P') { |
|
1103
|
|
|
$maxW = $this->wPrint; |
|
1104
|
|
|
} else { |
|
1105
|
|
|
$maxW = $this->wPrint - $this->wCanhoto; |
|
1106
|
|
|
} |
|
1107
|
|
|
$w = $maxW; |
|
1108
|
|
|
$h = 13; |
|
1109
|
|
|
$texto = 'INFORMAÇÕES RELATIVAS AO IMPOSTO'; |
|
1110
|
|
|
$aFont = $this->formatPadrao; |
|
1111
|
|
|
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'C', 1, ''); |
|
|
|
|
|
|
1112
|
|
|
|
|
1113
|
|
|
$y += 3.4; |
|
1114
|
|
|
$this->pdf->line($x, $y, $w + 1, $y); |
|
1115
|
|
|
$texto = 'SITUAÇÃO TRIBUTÁRIA'; |
|
1116
|
|
|
$aFont = $this->formatPadrao; |
|
1117
|
|
|
$this->pdf->textBox($x, $y, $w * 0.26, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1118
|
|
|
|
|
1119
|
|
|
$x += $w * 0.26; |
|
1120
|
|
|
$this->pdf->line($x, $y, $x, $y + 9.5); |
|
1121
|
|
|
$texto = 'BASE DE CALCULO'; |
|
1122
|
|
|
$aFont = $this->formatPadrao; |
|
1123
|
|
|
$this->pdf->textBox($x, $y, $w * 0.14, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1124
|
|
|
|
|
1125
|
|
|
$wCol02=0.18; |
|
1126
|
|
|
$x += $w * $wCol02; |
|
1127
|
|
|
$this->pdf->line($x, $y, $x, $y + 9.5); |
|
1128
|
|
|
$texto = 'ALÍQ ICMS'; |
|
1129
|
|
|
$aFont = $this->formatPadrao; |
|
1130
|
|
|
$this->pdf->textBox($x, $y, $w * $wCol02, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1131
|
|
|
|
|
1132
|
|
|
$x += $w * $wCol02; |
|
1133
|
|
|
$this->pdf->line($x, $y, $x, $y + 9.5); |
|
1134
|
|
|
$texto = 'VALOR ICMS'; |
|
1135
|
|
|
$aFont = $this->formatPadrao; |
|
1136
|
|
|
$this->pdf->textBox($x, $y, $w * $wCol02, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1137
|
|
|
|
|
1138
|
|
|
$x += $w * $wCol02; |
|
1139
|
|
|
$this->pdf->line($x, $y, $x, $y + 9.5); |
|
1140
|
|
|
$texto = '% RED. BC ICMS'; |
|
1141
|
|
|
$aFont = $this->formatPadrao; |
|
1142
|
|
|
$this->pdf->textBox($x, $y, $w * $wCol02, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1143
|
|
|
|
|
1144
|
|
|
/*$x += $w * 0.14; |
|
1145
|
|
|
$this->pdf->line($x, $y, $x, $y + 9.5); |
|
1146
|
|
|
$texto = 'ICMS ST'; |
|
1147
|
|
|
$aFont = $this->formatPadrao; |
|
1148
|
|
|
$this->pdf->textBox($x, $y, $w * 0.14, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
1149
|
|
|
* */ |
|
1150
|
|
|
|
|
1151
|
|
|
$x = $oldX; |
|
1152
|
|
|
$y = $y + 4; |
|
1153
|
|
|
$texto = $this->getTagValue($this->ICMS, "CST"); |
|
1154
|
|
|
switch ($texto) { |
|
1155
|
|
|
case '00': |
|
1156
|
|
|
$texto = "00 - Tributação normal ICMS"; |
|
1157
|
|
|
break; |
|
1158
|
|
|
case '20': |
|
1159
|
|
|
$texto = "20 - Tributação com BC reduzida do ICMS"; |
|
1160
|
|
|
break; |
|
1161
|
|
|
case '40': |
|
1162
|
|
|
$texto = "40 - ICMS isenção"; |
|
1163
|
|
|
break; |
|
1164
|
|
|
case '41': |
|
1165
|
|
|
$texto = "41 - ICMS não tributada"; |
|
1166
|
|
|
break; |
|
1167
|
|
|
case '51': |
|
1168
|
|
|
$texto = "51 - ICMS diferido"; |
|
1169
|
|
|
break; |
|
1170
|
|
|
case '60': |
|
1171
|
|
|
$texto = "60 - ICMS cobrado anteriormente por substituição tributária"; |
|
1172
|
|
|
break; |
|
1173
|
|
|
case '90': |
|
1174
|
|
|
$texto = "90 - ICMS outros"; |
|
1175
|
|
|
break; |
|
1176
|
|
|
} |
|
1177
|
|
|
$texto = $this->getTagValue($this->ICMSSN, "indSN") == 1 ? 'Simples Nacional' : $texto; |
|
1178
|
|
|
$aFont = $this->formatNegrito; |
|
1179
|
|
|
$this->pdf->textBox($x, $y, $w * 0.26, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1180
|
|
|
$x += $w * 0.26; |
|
1181
|
|
|
|
|
1182
|
|
|
$texto = !empty($this->ICMS->getElementsByTagName("vBC")->item(0)->nodeValue) ? |
|
1183
|
|
|
number_format($this->getTagValue($this->ICMS, "vBC"), 2, ",", ".") : ''; |
|
1184
|
|
|
$aFont = $this->formatNegrito; |
|
1185
|
|
|
$this->pdf->textBox($x, $y, $w * $wCol02, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1186
|
|
|
$x += $w * $wCol02; |
|
1187
|
|
|
|
|
1188
|
|
|
$texto = !empty($this->ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue) ? |
|
1189
|
|
|
number_format($this->getTagValue($this->ICMS, "pICMS"), 2, ",", ".") : ''; |
|
1190
|
|
|
$aFont = $this->formatNegrito; |
|
1191
|
|
|
$this->pdf->textBox($x, $y, $w * $wCol02, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1192
|
|
|
$x += $w * $wCol02; |
|
1193
|
|
|
|
|
1194
|
|
|
$texto = !empty($this->ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue) ? |
|
1195
|
|
|
number_format($this->getTagValue($this->ICMS, "vICMS"), 2, ",", ".") : ''; |
|
1196
|
|
|
$aFont = $this->formatNegrito; |
|
1197
|
|
|
$this->pdf->textBox($x, $y, $w * $wCol02, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1198
|
|
|
$x += $w * $wCol02; |
|
1199
|
|
|
|
|
1200
|
|
|
$texto = !empty($this->ICMS->getElementsByTagName("pRedBC")->item(0)->nodeValue) ? |
|
1201
|
|
|
number_format($this->getTagValue($this->ICMS, "pRedBC"), 2, ",", ".").'%' :''; |
|
1202
|
|
|
$aFont = $this->formatNegrito; |
|
1203
|
|
|
$this->pdf->textBox($x, $y, $w * $wCol02, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1204
|
|
|
|
|
1205
|
|
|
/*$x += $w * 0.14; |
|
1206
|
|
|
$texto = ''; |
|
1207
|
|
|
$aFont = $this->formatNegrito; |
|
1208
|
|
|
$this->pdf->textBox($x, $y, $w * 0.14, $h, $texto, $aFont, 'T', 'L', 0, '');*/ |
|
1209
|
|
|
} //fim da função compValorDACTE |
|
1210
|
|
|
|
|
1211
|
|
|
/** |
|
1212
|
|
|
* geraChaveAdicCont |
|
1213
|
|
|
* |
|
1214
|
|
|
* @return string chave |
|
1215
|
|
|
*/ |
|
1216
|
|
|
protected function geraChaveAdicCont() |
|
1217
|
|
|
{ |
|
1218
|
|
|
//cUF tpEmis CNPJ vNF ICMSp ICMSs DD DV |
|
1219
|
|
|
// Quantidade de caracteres 02 01 14 14 01 01 02 01 |
|
1220
|
|
|
$forma = "%02d%d%s%014d%01d%01d%02d"; |
|
1221
|
|
|
$cUF = $this->ide->getElementsByTagName('cUF')->item(0)->nodeValue; |
|
1222
|
|
|
$CNPJ = "00000000000000" . $this->emit->getElementsByTagName('CNPJ')->item(0)->nodeValue; |
|
1223
|
|
|
$CNPJ = substr($CNPJ, -14); |
|
1224
|
|
|
$vCT = number_format($this->getTagValue($this->vPrest, "vRec"), 2, "", "") * 100; |
|
1225
|
|
|
$ICMS_CST = $this->getTagValue($this->ICMS, "CST"); |
|
1226
|
|
|
switch ($ICMS_CST) { |
|
1227
|
|
|
case '00': |
|
1228
|
|
|
case '20': |
|
1229
|
|
|
$ICMSp = '1'; |
|
1230
|
|
|
$ICMSs = '2'; |
|
1231
|
|
|
break; |
|
1232
|
|
|
case '40': |
|
1233
|
|
|
case '41': |
|
1234
|
|
|
case '51': |
|
1235
|
|
|
case '90': |
|
1236
|
|
|
$ICMSp = '2'; |
|
1237
|
|
|
$ICMSs = '2'; |
|
1238
|
|
|
break; |
|
1239
|
|
|
case '60': |
|
1240
|
|
|
$ICMSp = '2'; |
|
1241
|
|
|
$ICMSs = '1'; |
|
1242
|
|
|
break; |
|
1243
|
|
|
} |
|
1244
|
|
|
$dd = $this->ide->getElementsByTagName('dEmi')->item(0)->nodeValue; |
|
1245
|
|
|
$rpos = strrpos($dd, '-'); |
|
1246
|
|
|
$dd = substr($dd, $rpos + 1); |
|
1247
|
|
|
$chave = sprintf($forma, $cUF, $this->tpEmis, $CNPJ, $vCT, $ICMSp, $ICMSs, $dd); |
|
|
|
|
|
|
1248
|
|
|
$chave = $chave . $this->pModulo11($chave); |
|
|
|
|
|
|
1249
|
|
|
return $chave; |
|
1250
|
|
|
} //fim geraChaveAdicCont |
|
1251
|
|
|
|
|
1252
|
|
|
/** |
|
1253
|
|
|
* infPrestacaoServico |
|
1254
|
|
|
* Monta o campo com das informações da prestação do serviço |
|
1255
|
|
|
* |
|
1256
|
|
|
* @param number $x Posição horizontal canto esquerdo |
|
1257
|
|
|
* @param number $y Posição vertical canto superior |
|
1258
|
|
|
* @return number Posição vertical final |
|
1259
|
|
|
*/ |
|
1260
|
|
|
protected function infPrestacaoServico($x = 0, $y = 0) |
|
1261
|
|
|
{ |
|
1262
|
|
|
$oldX = $x; |
|
1263
|
|
|
$oldY = $y; |
|
|
|
|
|
|
1264
|
|
|
if ($this->orientacao == 'P') { |
|
1265
|
|
|
$maxW = $this->wPrint; |
|
1266
|
|
|
} else { |
|
1267
|
|
|
$maxW = $this->wPrint - $this->wCanhoto; |
|
1268
|
|
|
} |
|
1269
|
|
|
$w = $maxW; |
|
1270
|
|
|
|
|
1271
|
|
|
// SE FOR RODOVIARIO ( BTR-SEMPRE SERÁ ) |
|
1272
|
|
|
if ($this->modal == '1') { |
|
1273
|
|
|
// 0 - Não; 1 - Sim Será lotação quando houver um único conhecimento de transporte por veículo, |
|
1274
|
|
|
// ou combinação veicular, e por viagem |
|
1275
|
|
|
$h = $this->lota == 1 ? 35 : 53; |
|
1276
|
|
|
} elseif ($this->modal == '3') { |
|
1277
|
|
|
$h = 37.6; |
|
1278
|
|
|
} else { |
|
1279
|
|
|
$h = 35; |
|
1280
|
|
|
} |
|
1281
|
|
|
$texto = 'INFORMAÇÕES DA PRESTAÇÃO DO SERVIÇO'; |
|
1282
|
|
|
$aFont = $this->formatPadrao; |
|
1283
|
|
|
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'C', 1, ''); |
|
|
|
|
|
|
1284
|
|
|
$descr1 = 'QUANTIDADE'; |
|
1285
|
|
|
$descr2 = 'DESCRIÇÃO DO SERVIÇO PRESTADO'; |
|
1286
|
|
|
|
|
1287
|
|
|
$y += 3.4; |
|
1288
|
|
|
$this->pdf->line($x, $y, $w + 1, $y); // LINHA ABAIXO DO TEXTO: "DOCUMENTOS ORIGINÁRIOS |
|
1289
|
|
|
$texto = $descr1; |
|
1290
|
|
|
$aFont = $this->formatPadrao; |
|
1291
|
|
|
$this->pdf->textBox($x, $y, $w * 0.10, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1292
|
|
|
$yIniDados = $y; |
|
|
|
|
|
|
1293
|
|
|
|
|
1294
|
|
|
$x += $w * 0.14; |
|
1295
|
|
|
if ($this->modal == '1') { |
|
1296
|
|
|
if ($this->lota == 1) { |
|
1297
|
|
|
$this->pdf->line($x, $y, $x, $y + 31.5); // TESTE |
|
1298
|
|
|
} else { |
|
1299
|
|
|
$this->pdf->line($x, $y, $x, $y + 49.5); // TESTE |
|
1300
|
|
|
} |
|
1301
|
|
|
} elseif ($this->modal == '3') { |
|
1302
|
|
|
$this->pdf->line($x, $y, $x, $y + 34.1); |
|
1303
|
|
|
} else { |
|
1304
|
|
|
$this->pdf->line($x, $y, $x, $y + 21.5); |
|
1305
|
|
|
} |
|
1306
|
|
|
|
|
1307
|
|
|
$x += $w * 0.08; |
|
1308
|
|
|
$texto = $descr2; |
|
1309
|
|
|
$aFont = $this->formatPadrao; |
|
1310
|
|
|
$this->pdf->textBox($x, $y, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1311
|
|
|
|
|
1312
|
|
|
//$auxX = $oldX; |
|
1313
|
|
|
//$yIniDados += 3; |
|
1314
|
|
|
|
|
1315
|
|
|
$x = $oldX; |
|
1316
|
|
|
$y = $y + 4; |
|
1317
|
|
|
$texto = number_format($this->getTagValue($this->infQ->item(0), "qCarga"), 3, ",", "."); |
|
1318
|
|
|
$aFont = $this->formatNegrito; |
|
1319
|
|
|
$this->pdf->textBox($x, $y, $w * 0.26, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1320
|
|
|
$x += $w * 0.26; |
|
1321
|
|
|
|
|
1322
|
|
|
$x = $oldX + 35; |
|
1323
|
|
|
$texto = $this->getTagValue($this->infServico->item(0), "xDescServ"); |
|
1324
|
|
|
$aFont = $this->formatNegrito; |
|
1325
|
|
|
$this->pdf->textBox($x, $y, $w * 0.26, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1326
|
|
|
$x += $w * 0.26; |
|
1327
|
|
|
|
|
1328
|
|
|
|
|
1329
|
|
|
$r = $this->cabecalho(1, 1, '1', $this->totPag); |
|
|
|
|
|
|
1330
|
|
|
$contador = 0; |
|
|
|
|
|
|
1331
|
|
|
} |
|
1332
|
|
|
|
|
1333
|
|
|
/** |
|
1334
|
|
|
* docCompl |
|
1335
|
|
|
* Monta o campo com os dados do remetente na DACTE. |
|
1336
|
|
|
* |
|
1337
|
|
|
* @param number $x Posição horizontal canto esquerdo |
|
1338
|
|
|
* @param number $y Posição vertical canto superior |
|
1339
|
|
|
* @return number Posição vertical final |
|
1340
|
|
|
*/ |
|
1341
|
|
|
protected function docCompl($x = 0, $y = 0) |
|
1342
|
|
|
{ |
|
1343
|
|
|
$oldX = $x; |
|
1344
|
|
|
$oldY = $y; |
|
|
|
|
|
|
1345
|
|
|
if ($this->orientacao == 'P') { |
|
1346
|
|
|
$maxW = $this->wPrint; |
|
1347
|
|
|
} else { |
|
1348
|
|
|
$maxW = $this->wPrint - $this->wCanhoto; |
|
1349
|
|
|
} |
|
1350
|
|
|
$w = $maxW; |
|
1351
|
|
|
$h = 80; |
|
1352
|
|
|
$texto = 'DETALHAMENTO DO CT-E COMPLEMENTADO'; |
|
1353
|
|
|
$aFont = $this->formatPadrao; |
|
1354
|
|
|
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'C', 1, ''); |
|
|
|
|
|
|
1355
|
|
|
$descr1 = 'CHAVE DO CT-E COMPLEMENTADO'; |
|
1356
|
|
|
$descr2 = 'VALOR COMPLEMENTADO'; |
|
1357
|
|
|
$y += 3.4; |
|
1358
|
|
|
$this->pdf->line($x, $y, $w + 1, $y); |
|
1359
|
|
|
$texto = $descr1; |
|
1360
|
|
|
$aFont = $this->formatPadrao; |
|
1361
|
|
|
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1362
|
|
|
$yIniDados = $y; |
|
1363
|
|
|
$x += $w * 0.37; |
|
1364
|
|
|
$texto = $descr2; |
|
1365
|
|
|
$aFont = $this->formatPadrao; |
|
1366
|
|
|
$this->pdf->textBox($x - 8, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1367
|
|
|
$x += $w * 0.13; |
|
1368
|
|
|
$this->pdf->line($x, $y, $x, $y + 76.5); |
|
1369
|
|
|
$texto = $descr1; |
|
1370
|
|
|
$aFont = $this->formatPadrao; |
|
1371
|
|
|
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1372
|
|
|
$x += $w * 0.3; |
|
1373
|
|
|
$texto = $descr2; |
|
1374
|
|
|
$aFont = $this->formatPadrao; |
|
1375
|
|
|
$this->pdf->textBox($x + 8, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1376
|
|
|
$auxX = $oldX; |
|
1377
|
|
|
$yIniDados += 4; |
|
1378
|
|
|
if ($auxX > $w * 0.90) { |
|
1379
|
|
|
$yIniDados = $yIniDados + 4; |
|
1380
|
|
|
$auxX = $oldX; |
|
1381
|
|
|
} |
|
1382
|
|
|
$texto = $this->chaveCTeRef; |
|
1383
|
|
|
$aFont = array( |
|
1384
|
|
|
'font' => $this->fontePadrao, |
|
1385
|
|
|
'size' => 8, |
|
1386
|
|
|
'style' => ''); |
|
1387
|
|
|
$this->pdf->textBox($auxX, $yIniDados, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1388
|
|
|
$texto = number_format($this->getTagValue($this->vPrest, "vTPrest"), 2, ",", "."); |
|
1389
|
|
|
$aFont = array( |
|
1390
|
|
|
'font' => $this->fontePadrao, |
|
1391
|
|
|
'size' => 8, |
|
1392
|
|
|
'style' => ''); |
|
1393
|
|
|
$this->pdf->textBox($w * 0.40, $yIniDados, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1394
|
|
|
} |
|
1395
|
|
|
|
|
1396
|
|
|
/** |
|
1397
|
|
|
* observacoes |
|
1398
|
|
|
* Monta o campo com os dados do remetente na DACTE. |
|
1399
|
|
|
* |
|
1400
|
|
|
* @param number $x Posição horizontal canto esquerdo |
|
1401
|
|
|
* @param number $y Posição vertical canto superior |
|
1402
|
|
|
* @return number Posição vertical final |
|
1403
|
|
|
*/ |
|
1404
|
|
|
protected function observacoes($x = 0, $y = 0) |
|
1405
|
|
|
{ |
|
1406
|
|
|
$oldX = $x; |
|
1407
|
|
|
$oldY = $y; |
|
|
|
|
|
|
1408
|
|
|
if ($this->orientacao == 'P') { |
|
1409
|
|
|
$maxW = $this->wPrint; |
|
1410
|
|
|
} else { |
|
1411
|
|
|
$maxW = $this->wPrint - $this->wCanhoto; |
|
1412
|
|
|
} |
|
1413
|
|
|
$w = $maxW; |
|
1414
|
|
|
//$h = 18; |
|
1415
|
|
|
$h = 18.8; |
|
1416
|
|
|
$texto = 'OBSERVAÇÕES GERAIS'; |
|
1417
|
|
|
$aFont = $this->formatPadrao; |
|
1418
|
|
|
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'C', 1, ''); |
|
|
|
|
|
|
1419
|
|
|
$y += 3.4; |
|
1420
|
|
|
$this->pdf->line($x, $y, $w + 1, $y); |
|
1421
|
|
|
$auxX = $oldX; |
|
|
|
|
|
|
1422
|
|
|
$yIniDados = $y; |
|
|
|
|
|
|
1423
|
|
|
$texto = ''; |
|
1424
|
|
|
foreach ($this->compl as $k => $d) { |
|
1425
|
|
|
$xObs = $this->getTagValue($this->compl->item($k), "xObs"); |
|
1426
|
|
|
$texto .= $xObs; |
|
1427
|
|
|
} |
|
1428
|
|
|
$textoObs = explode("Motorista:", $texto); |
|
1429
|
|
|
$textoObs[1] = isset($textoObs[1]) ? "Motorista: ".$textoObs[1]: ''; |
|
1430
|
|
|
$texto .= $this->getTagValue($this->imp, "infAdFisco", "\r\n"); |
|
1431
|
|
|
$aFont = array( |
|
1432
|
|
|
'font' => $this->fontePadrao, |
|
1433
|
|
|
'size' => 7.5, |
|
1434
|
|
|
'style' => ''); |
|
1435
|
|
|
$this->pdf->textBox($x, $y, $w, $h, $textoObs[0], $aFont, 'T', 'L', 0, '', false); |
|
|
|
|
|
|
1436
|
|
|
$this->pdf->textBox($x, $y+11.5, $w, $h, $textoObs[1], $aFont, 'T', 'L', 0, '', false); |
|
|
|
|
|
|
1437
|
|
|
} |
|
1438
|
|
|
|
|
1439
|
|
|
/** |
|
1440
|
|
|
* seguro |
|
1441
|
|
|
* Monta o campo com os dados de seguro do CT-e OS. |
|
1442
|
|
|
* |
|
1443
|
|
|
* @param number $x Posição horizontal canto esquerdo |
|
1444
|
|
|
* @param number $y Posição vertical canto superior |
|
1445
|
|
|
* @return number Posição vertical final |
|
1446
|
|
|
*/ |
|
1447
|
|
|
protected function seguro($x = 0, $y = 0) |
|
1448
|
|
|
{ |
|
1449
|
|
|
$oldX = $x; |
|
1450
|
|
|
$oldY = $y; |
|
|
|
|
|
|
1451
|
|
|
if ($this->orientacao == 'P') { |
|
1452
|
|
|
$maxW = $this->wPrint; |
|
1453
|
|
|
} else { |
|
1454
|
|
|
$maxW = $this->wPrint - $this->wCanhoto; |
|
1455
|
|
|
} |
|
1456
|
|
|
$w = $maxW; |
|
1457
|
|
|
$h = 13; |
|
1458
|
|
|
$texto = 'SEGURO DA VIAGEM'; |
|
1459
|
|
|
$aFont = $this->formatPadrao; |
|
1460
|
|
|
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'C', 1, ''); |
|
|
|
|
|
|
1461
|
|
|
|
|
1462
|
|
|
$y += 3.4; |
|
1463
|
|
|
$this->pdf->line($x, $y, $w + 1, $y); |
|
1464
|
|
|
$texto = 'RESPONSÁVEL'; |
|
1465
|
|
|
$aFont = $this->formatPadrao; |
|
1466
|
|
|
$this->pdf->textBox($x, $y, $w * 0.33, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1467
|
|
|
|
|
1468
|
|
|
$x += $w * 0.33; |
|
1469
|
|
|
$this->pdf->line($x, $y, $x, $y + 9.5); |
|
1470
|
|
|
$texto = 'NOME DA SEGURADORA'; |
|
1471
|
|
|
$aFont = $this->formatPadrao; |
|
1472
|
|
|
$this->pdf->textBox($x, $y, $w * 0.33, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1473
|
|
|
|
|
1474
|
|
|
$wCol02=0.33; |
|
1475
|
|
|
$x += $w * $wCol02; |
|
1476
|
|
|
$this->pdf->line($x, $y, $x, $y + 9.5); |
|
1477
|
|
|
$texto = 'NÚMERO DA APÓLICE'; |
|
1478
|
|
|
$aFont = $this->formatPadrao; |
|
1479
|
|
|
$this->pdf->textBox($x, $y, $w * $wCol02, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1480
|
|
|
|
|
1481
|
|
|
$x = $oldX; |
|
1482
|
|
|
$y = $y + 4; |
|
1483
|
|
|
$texto = $this->respSeg; |
|
1484
|
|
|
$aFont = $this->formatNegrito; |
|
1485
|
|
|
$this->pdf->textBox($x, $y, $w * 0.26, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1486
|
|
|
$x += $w * 0.33; |
|
1487
|
|
|
$texto = $this->xSeg; |
|
1488
|
|
|
|
|
1489
|
|
|
$aFont = $this->formatNegrito; |
|
1490
|
|
|
$this->pdf->textBox($x, $y, $w * $wCol02, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1491
|
|
|
$x += $w * 0.33; |
|
1492
|
|
|
$texto = $this->nApol; |
|
1493
|
|
|
|
|
1494
|
|
|
$aFont = $this->formatNegrito; |
|
1495
|
|
|
$this->pdf->textBox($x, $y, $w * $wCol02, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1496
|
|
|
} |
|
1497
|
|
|
|
|
1498
|
|
|
/** |
|
1499
|
|
|
* modalRod |
|
1500
|
|
|
* Monta o campo com os dados do remetente na DACTE. ( retrato e paisagem ) |
|
1501
|
|
|
* |
|
1502
|
|
|
* @param number $x Posição horizontal canto esquerdo |
|
1503
|
|
|
* @param number $y Posição vertical canto superior |
|
1504
|
|
|
* @return number Posição vertical final |
|
1505
|
|
|
*/ |
|
1506
|
|
|
protected function modalRod($x = 0, $y = 0) |
|
1507
|
|
|
{ |
|
1508
|
|
|
$oldX = $x; |
|
1509
|
|
|
$oldY = $y; |
|
|
|
|
|
|
1510
|
|
|
if ($this->orientacao == 'P') { |
|
1511
|
|
|
$maxW = $this->wPrint; |
|
1512
|
|
|
} else { |
|
1513
|
|
|
$maxW = $this->wPrint - $this->wCanhoto; |
|
1514
|
|
|
} |
|
1515
|
|
|
$w = $maxW; |
|
1516
|
|
|
$h = 13; |
|
1517
|
|
|
$texto = 'DADOS ESPECÍFICOS DO MODAL RODOVIÁRIO'; |
|
1518
|
|
|
$aFont = $this->formatPadrao; |
|
1519
|
|
|
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'C', 1, ''); |
|
|
|
|
|
|
1520
|
|
|
|
|
1521
|
|
|
$y += 3.4; |
|
1522
|
|
|
$this->pdf->line($x, $y, $w + 1, $y); |
|
1523
|
|
|
$texto = 'TERMO DE AUTORIZAÇÃO DE FRETAMENTO'; |
|
1524
|
|
|
$aFont = $this->formatPadrao; |
|
1525
|
|
|
$this->pdf->textBox($x, $y, $w * 0.26, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1526
|
|
|
|
|
1527
|
|
|
$x += $w * 0.26; |
|
1528
|
|
|
$this->pdf->line($x, $y, $x, $y + 9.5); |
|
1529
|
|
|
$texto = 'Nº DE REGISTRO ESTADUAL'; |
|
1530
|
|
|
$aFont = $this->formatPadrao; |
|
1531
|
|
|
$this->pdf->textBox($x, $y, $w * 0.14, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1532
|
|
|
|
|
1533
|
|
|
$wCol02=0.18; |
|
1534
|
|
|
$x += $w * $wCol02; |
|
1535
|
|
|
$this->pdf->line($x, $y, $x, $y + 9.5); |
|
1536
|
|
|
$texto = 'PLACA DO VEÍCULO'; |
|
1537
|
|
|
$aFont = $this->formatPadrao; |
|
1538
|
|
|
$this->pdf->textBox($x, $y, $w * $wCol02, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1539
|
|
|
|
|
1540
|
|
|
$x += $w * $wCol02; |
|
1541
|
|
|
$this->pdf->line($x, $y, $x, $y + 9.5); |
|
1542
|
|
|
$texto = 'RENAVAM DO VEÍCULO'; |
|
1543
|
|
|
$aFont = $this->formatPadrao; |
|
1544
|
|
|
$this->pdf->textBox($x, $y, $w * $wCol02, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1545
|
|
|
|
|
1546
|
|
|
$x += $w * $wCol02; |
|
1547
|
|
|
$this->pdf->line($x, $y, $x, $y + 9.5); |
|
1548
|
|
|
$texto = 'CNPJ/CPF'; |
|
1549
|
|
|
$aFont = $this->formatPadrao; |
|
1550
|
|
|
$this->pdf->textBox($x, $y, $w * $wCol02, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1551
|
|
|
|
|
1552
|
|
|
$x = $oldX; |
|
1553
|
|
|
$y = $y + 4; |
|
1554
|
|
|
$texto = $this->getTagValue($this->rodo, "TAF"); |
|
1555
|
|
|
$aFont = $this->formatNegrito; |
|
1556
|
|
|
$this->pdf->textBox($x, $y, $w * 0.26, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1557
|
|
|
$x += $w * 0.26; |
|
1558
|
|
|
|
|
1559
|
|
|
$texto = $this->getTagValue($this->rodo, "NroRegEstadual"); |
|
1560
|
|
|
$aFont = $this->formatNegrito; |
|
1561
|
|
|
$this->pdf->textBox($x, $y, $w * $wCol02, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1562
|
|
|
$x += $w * $wCol02; |
|
1563
|
|
|
|
|
1564
|
|
|
$texto = $this->getTagValue($this->veic->item(0), "placa"); |
|
1565
|
|
|
$aFont = $this->formatNegrito; |
|
1566
|
|
|
$this->pdf->textBox($x, $y, $w * $wCol02, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1567
|
|
|
$x += $w * $wCol02; |
|
1568
|
|
|
|
|
1569
|
|
|
$texto = $this->getTagValue($this->veic->item(0), "RENAVAM"); |
|
1570
|
|
|
$aFont = $this->formatNegrito; |
|
1571
|
|
|
$this->pdf->textBox($x, $y, $w * $wCol02, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1572
|
|
|
$x += $w * $wCol02; |
|
1573
|
|
|
|
|
1574
|
|
|
$texto = !empty($this->getTagValue($this->veic->item(0), "CPF")) ? |
|
1575
|
|
|
$this->getTagValue($this->veic->item(0), "CPF") : |
|
1576
|
|
|
(!empty($this->getTagValue($this->veic->item(0), "CNPJ")) ? |
|
1577
|
|
|
$this->getTagValue($this->veic->item(0), "CNPJ") : ''); |
|
1578
|
|
|
$aFont = $this->formatNegrito; |
|
1579
|
|
|
$this->pdf->textBox($x, $y, $w * $wCol02, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1580
|
|
|
|
|
1581
|
|
|
/*$x += $w * 0.14; |
|
1582
|
|
|
$texto = ''; |
|
1583
|
|
|
$aFont = $this->formatNegrito; |
|
1584
|
|
|
$this->pdf->textBox($x, $y, $w * 0.14, $h, $texto, $aFont, 'T', 'L', 0, '');*/ |
|
1585
|
|
|
} |
|
1586
|
|
|
|
|
1587
|
|
|
/** |
|
1588
|
|
|
* modalAquaviario |
|
1589
|
|
|
* Monta o campo com os dados do remetente na DACTE. ( retrato e paisagem ) |
|
1590
|
|
|
* |
|
1591
|
|
|
* @param number $x Posição horizontal canto esquerdo |
|
1592
|
|
|
* @param number $y Posição vertical canto superior |
|
1593
|
|
|
* @return number Posição vertical final |
|
1594
|
|
|
*/ |
|
1595
|
|
|
protected function modalAquaviario($x = 0, $y = 0) |
|
1596
|
|
|
{ |
|
1597
|
|
|
$oldX = $x; |
|
|
|
|
|
|
1598
|
|
|
$oldY = $y; |
|
|
|
|
|
|
1599
|
|
|
if ($this->orientacao == 'P') { |
|
1600
|
|
|
$maxW = $this->wPrint; |
|
1601
|
|
|
} else { |
|
1602
|
|
|
$maxW = $this->wPrint - $this->wCanhoto; |
|
1603
|
|
|
} |
|
1604
|
|
|
$w = $maxW; |
|
1605
|
|
|
$h = 8.5; |
|
1606
|
|
|
$texto = 'DADOS ESPECÍFICOS DO MODAL AQUAVIÁRIO'; |
|
1607
|
|
|
$aFont = $this->formatPadrao; |
|
1608
|
|
|
$this->pdf->textBox($x, $y, $w, $h * 3.2, $texto, $aFont, 'T', 'C', 1, ''); |
|
|
|
|
|
|
1609
|
|
|
$y += 3.4; |
|
1610
|
|
|
$this->pdf->line($x, $y, $w + 1, $y); |
|
1611
|
|
|
$texto = 'PORTO DE EMBARQUE'; |
|
1612
|
|
|
$aFont = $this->formatPadrao; |
|
1613
|
|
|
$this->pdf->textBox($x, $y, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1614
|
|
|
$texto = $this->getTagValue($this->aquav, "prtEmb"); |
|
1615
|
|
|
$aFont = $this->formatNegrito; |
|
1616
|
|
|
$this->pdf->textBox($x, $y + 3, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1617
|
|
|
$x += $w * 0.50; |
|
1618
|
|
|
$this->pdf->line($x, $y, $x, $y + 7.7); |
|
1619
|
|
|
$texto = 'PORTO DE DESTINO'; |
|
1620
|
|
|
$aFont = $this->formatPadrao; |
|
1621
|
|
|
$this->pdf->textBox($x, $y, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1622
|
|
|
$texto = $this->getTagValue($this->aquav, "prtDest"); |
|
1623
|
|
|
$aFont = $this->formatNegrito; |
|
1624
|
|
|
$this->pdf->textBox($x, $y + 3, $w * 0.50, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1625
|
|
|
$y += 8; |
|
1626
|
|
|
$this->pdf->line(208, $y, 1, $y); |
|
1627
|
|
|
$x = 1; |
|
1628
|
|
|
$texto = 'IDENTIFICAÇÃO DO NAVIO / REBOCADOR'; |
|
1629
|
|
|
$aFont = $this->formatPadrao; |
|
1630
|
|
|
$this->pdf->textBox($x, $y, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1631
|
|
|
$texto = $this->getTagValue($this->aquav, "xNavio"); |
|
1632
|
|
|
$aFont = $this->formatNegrito; |
|
1633
|
|
|
$this->pdf->textBox($x, $y + 3, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1634
|
|
|
$x += $w * 0.50; |
|
1635
|
|
|
$this->pdf->line($x, $y, $x, $y + 7.7); |
|
1636
|
|
|
$texto = 'VR DA B. DE CALC. AFRMM'; |
|
1637
|
|
|
$aFont = $this->formatPadrao; |
|
1638
|
|
|
$this->pdf->textBox($x, $y, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1639
|
|
|
$texto = $this->getTagValue($this->aquav, "vPrest"); |
|
1640
|
|
|
$aFont = $this->formatNegrito; |
|
1641
|
|
|
$this->pdf->textBox($x, $y + 3, $w * 0.50, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1642
|
|
|
$x += $w * 0.17; |
|
1643
|
|
|
$this->pdf->line($x, $y, $x, $y + 7.7); |
|
1644
|
|
|
$texto = 'VALOR DO AFRMM'; |
|
1645
|
|
|
$aFont = $this->formatPadrao; |
|
1646
|
|
|
$this->pdf->textBox($x, $y, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1647
|
|
|
$texto = $this->getTagValue($this->aquav, "vAFRMM"); |
|
1648
|
|
|
$aFont = $this->formatNegrito; |
|
1649
|
|
|
$this->pdf->textBox($x, $y + 3, $w * 0.50, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1650
|
|
|
$x += $w * 0.12; |
|
1651
|
|
|
$this->pdf->line($x, $y, $x, $y + 7.7); |
|
1652
|
|
|
$texto = 'TIPO DE NAVEGAÇÃO'; |
|
1653
|
|
|
$aFont = $this->formatPadrao; |
|
1654
|
|
|
$this->pdf->textBox($x, $y, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1655
|
|
|
$texto = $this->getTagValue($this->aquav, "tpNav"); |
|
1656
|
|
|
switch ($texto) { |
|
1657
|
|
|
case '0': |
|
1658
|
|
|
$texto = 'INTERIOR'; |
|
1659
|
|
|
break; |
|
1660
|
|
|
case '1': |
|
1661
|
|
|
$texto = 'CABOTAGEM'; |
|
1662
|
|
|
break; |
|
1663
|
|
|
} |
|
1664
|
|
|
$aFont = $this->formatNegrito; |
|
1665
|
|
|
$this->pdf->textBox($x, $y + 3, $w * 0.50, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1666
|
|
|
$x += $w * 0.14; |
|
1667
|
|
|
$this->pdf->line($x, $y, $x, $y + 7.7); |
|
1668
|
|
|
$texto = 'DIREÇÃO'; |
|
1669
|
|
|
$aFont = $this->formatPadrao; |
|
1670
|
|
|
$this->pdf->textBox($x, $y, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1671
|
|
|
$texto = $this->getTagValue($this->aquav, "direc"); |
|
1672
|
|
|
switch ($texto) { |
|
1673
|
|
|
case 'N': |
|
1674
|
|
|
$texto = 'NORTE'; |
|
1675
|
|
|
break; |
|
1676
|
|
|
case 'L': |
|
1677
|
|
|
$texto = 'LESTE'; |
|
1678
|
|
|
break; |
|
1679
|
|
|
case 'S': |
|
1680
|
|
|
$texto = 'SUL'; |
|
1681
|
|
|
break; |
|
1682
|
|
|
case 'O': |
|
1683
|
|
|
$texto = 'OESTE'; |
|
1684
|
|
|
break; |
|
1685
|
|
|
} |
|
1686
|
|
|
$aFont = $this->formatNegrito; |
|
1687
|
|
|
$this->pdf->textBox($x, $y + 3, $w * 0.50, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1688
|
|
|
$y += 8; |
|
1689
|
|
|
$this->pdf->line(208, $y, 1, $y); |
|
1690
|
|
|
$x = 1; |
|
1691
|
|
|
$texto = 'IDENTIFICAÇÃO DOS CONTEINERS'; |
|
1692
|
|
|
$aFont = $this->formatPadrao; |
|
1693
|
|
|
$this->pdf->textBox($x, $y, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1694
|
|
|
if ($this->infNF->item(0) !== null && $this->infNF->item(0)->getElementsByTagName('infUnidCarga') !== null) { |
|
1695
|
|
|
$texto = $this->infNF |
|
1696
|
|
|
->item(0) |
|
1697
|
|
|
->getElementsByTagName('infUnidCarga') |
|
1698
|
|
|
->item(0) |
|
1699
|
|
|
->getElementsByTagName('idUnidCarga') |
|
1700
|
|
|
->item(0)->nodeValue; |
|
1701
|
|
|
} elseif ($this->infNFe->item(0) !== null |
|
1702
|
|
|
&& $this->infNFe->item(0)->getElementsByTagName('infUnidCarga') !== null |
|
1703
|
|
|
) { |
|
1704
|
|
|
$texto = $this->infNFe |
|
1705
|
|
|
->item(0) |
|
1706
|
|
|
->getElementsByTagName('infUnidCarga') |
|
1707
|
|
|
->item(0) |
|
1708
|
|
|
->getElementsByTagName('idUnidCarga') |
|
1709
|
|
|
->item(0) |
|
1710
|
|
|
->nodeValue; |
|
1711
|
|
|
} elseif ($this->infOutros->item(0) !== null |
|
1712
|
|
|
&& $this->infOutros->item(0)->getElementsByTagName('infUnidCarga') !== null |
|
1713
|
|
|
) { |
|
1714
|
|
|
$texto = $this->infOutros |
|
1715
|
|
|
->item(0) |
|
1716
|
|
|
->getElementsByTagName('infUnidCarga') |
|
1717
|
|
|
->item(0) |
|
1718
|
|
|
->getElementsByTagName('idUnidCarga') |
|
1719
|
|
|
->item(0) |
|
1720
|
|
|
->nodeValue; |
|
1721
|
|
|
} else { |
|
1722
|
|
|
$texto = ''; |
|
1723
|
|
|
} |
|
1724
|
|
|
$aFont = $this->formatNegrito; |
|
1725
|
|
|
$this->pdf->textBox($x, $y + 3, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1726
|
|
|
$x += $w * 0.50; |
|
1727
|
|
|
$this->pdf->line($x, $y, $x, $y + 7.7); |
|
1728
|
|
|
$texto = 'IDENTIFICAÇÃO DAS BALSAS'; |
|
1729
|
|
|
$aFont = $this->formatPadrao; |
|
1730
|
|
|
$this->pdf->textBox($x, $y, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1731
|
|
|
$texto = ''; |
|
1732
|
|
|
if ($this->getTagValue($this->aquav, "balsa") !== '') { |
|
1733
|
|
|
foreach ($this->aquav->getElementsByTagName('balsa') as $k => $d) { |
|
1734
|
|
|
if ($k == 0) { |
|
1735
|
|
|
$texto = $this->aquav |
|
1736
|
|
|
->getElementsByTagName('balsa') |
|
1737
|
|
|
->item($k) |
|
1738
|
|
|
->getElementsByTagName('xBalsa') |
|
1739
|
|
|
->item(0) |
|
1740
|
|
|
->nodeValue; |
|
1741
|
|
|
} else { |
|
1742
|
|
|
$texto = $texto |
|
1743
|
|
|
. ' / ' |
|
1744
|
|
|
. $this->aquav |
|
1745
|
|
|
->getElementsByTagName('balsa') |
|
1746
|
|
|
->item($k) |
|
1747
|
|
|
->getElementsByTagName('xBalsa') |
|
1748
|
|
|
->item(0) |
|
1749
|
|
|
->nodeValue; |
|
1750
|
|
|
} |
|
1751
|
|
|
} |
|
1752
|
|
|
} |
|
1753
|
|
|
$aFont = $this->formatNegrito; |
|
1754
|
|
|
$this->pdf->textBox($x, $y + 3, $w * 0.50, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1755
|
|
|
} |
|
1756
|
|
|
|
|
1757
|
|
|
/** |
|
1758
|
|
|
* modalFerr |
|
1759
|
|
|
* Monta o campo com os dados do remetente na DACTE. ( retrato e paisagem ) |
|
1760
|
|
|
* |
|
1761
|
|
|
* @param number $x Posição horizontal canto esquerdo |
|
1762
|
|
|
* @param number $y Posição vertical canto superior |
|
1763
|
|
|
* @return number Posição vertical final |
|
1764
|
|
|
*/ |
|
1765
|
|
|
protected function modalFerr($x = 0, $y = 0) |
|
1766
|
|
|
{ |
|
1767
|
|
|
$oldX = $x; |
|
|
|
|
|
|
1768
|
|
|
$oldY = $y; |
|
|
|
|
|
|
1769
|
|
|
if ($this->orientacao == 'P') { |
|
1770
|
|
|
$maxW = $this->wPrint; |
|
1771
|
|
|
} else { |
|
1772
|
|
|
$maxW = $this->wPrint - $this->wCanhoto; |
|
1773
|
|
|
} |
|
1774
|
|
|
$w = $maxW; |
|
1775
|
|
|
$h = 19.6; |
|
1776
|
|
|
$texto = 'DADOS ESPECÍFICOS DO MODAL FERROVIÁRIO'; |
|
1777
|
|
|
$aFont = $this->formatPadrao; |
|
1778
|
|
|
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'C', 1, ''); |
|
|
|
|
|
|
1779
|
|
|
$y += 3.4; |
|
1780
|
|
|
$this->pdf->line($x, $y, $w + 1, $y); |
|
1781
|
|
|
$texto = 'DCL'; |
|
1782
|
|
|
$aFont = array( |
|
1783
|
|
|
'font' => $this->fontePadrao, |
|
1784
|
|
|
'size' => 7, |
|
1785
|
|
|
'style' => 'B'); |
|
1786
|
|
|
$this->pdf->textBox($x, $y, $w * 0.25, $h, $texto, $aFont, 'T', 'C', 0, ''); |
|
|
|
|
|
|
1787
|
|
|
$this->pdf->line($x + 49.6, $y, $x + 49.6, $y + 3.5); |
|
1788
|
|
|
$texto = 'VAGÕES'; |
|
1789
|
|
|
$aFont = array( |
|
1790
|
|
|
'font' => $this->fontePadrao, |
|
1791
|
|
|
'size' => 7, |
|
1792
|
|
|
'style' => 'B'); |
|
1793
|
|
|
$this->pdf->textBox($x + 50, $y, $w * 0.5, $h, $texto, $aFont, 'T', 'C', 0, ''); |
|
|
|
|
|
|
1794
|
|
|
$y += 3.4; |
|
1795
|
|
|
$this->pdf->line($x, $y, $w + 1, $y); |
|
1796
|
|
|
// DCL |
|
1797
|
|
|
$texto = 'ID TREM'; |
|
1798
|
|
|
$aFont = array( |
|
1799
|
|
|
'font' => $this->fontePadrao, |
|
1800
|
|
|
'size' => 6, |
|
1801
|
|
|
'style' => ''); |
|
1802
|
|
|
$this->pdf->textBox($x, $y, $w * 0.10, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1803
|
|
|
$texto = $this->getTagValue($this->ferrov, "idTrem"); |
|
1804
|
|
|
$aFont = array( |
|
1805
|
|
|
'font' => $this->fontePadrao, |
|
1806
|
|
|
'size' => 6, |
|
1807
|
|
|
'style' => 'B'); |
|
1808
|
|
|
$this->pdf->textBox($x, $y + 3, $w * 0.10, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1809
|
|
|
$x += $w * 0.06; |
|
1810
|
|
|
$y1 = $y + 12.5; |
|
1811
|
|
|
$this->pdf->line($x, $y, $x, $y1); |
|
1812
|
|
|
$texto = 'NUM'; |
|
1813
|
|
|
$aFont = array( |
|
1814
|
|
|
'font' => $this->fontePadrao, |
|
1815
|
|
|
'size' => 6, |
|
1816
|
|
|
'style' => ''); |
|
1817
|
|
|
$this->pdf->textBox($x, $y, $w * 0.10, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1818
|
|
|
$texto = $this->getTagValue($this->rem, "nDoc"); |
|
|
|
|
|
|
1819
|
|
|
$aFont = array( |
|
1820
|
|
|
'font' => $this->fontePadrao, |
|
1821
|
|
|
'size' => 6, |
|
1822
|
|
|
'style' => 'B'); |
|
1823
|
|
|
$this->pdf->textBox($x, $y + 3, $w * 0.10, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1824
|
|
|
$x += $w * 0.06; |
|
1825
|
|
|
$this->pdf->line($x, $y, $x, $y1); |
|
1826
|
|
|
$texto = 'SÉRIE'; |
|
1827
|
|
|
$aFont = array( |
|
1828
|
|
|
'font' => $this->fontePadrao, |
|
1829
|
|
|
'size' => 6, |
|
1830
|
|
|
'style' => ''); |
|
1831
|
|
|
$this->pdf->textBox($x, $y, $w * 0.10, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1832
|
|
|
$texto = $this->getTagValue($this->rem, "serie"); |
|
1833
|
|
|
$aFont = array( |
|
1834
|
|
|
'font' => $this->fontePadrao, |
|
1835
|
|
|
'size' => 6, |
|
1836
|
|
|
'style' => 'B'); |
|
1837
|
|
|
$this->pdf->textBox($x, $y + 3, $w * 0.10, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1838
|
|
|
$x += $w * 0.06; |
|
1839
|
|
|
$this->pdf->line($x, $y, $x, $y1); |
|
1840
|
|
|
$texto = 'EMISSÃO'; |
|
1841
|
|
|
$aFont = array( |
|
1842
|
|
|
'font' => $this->fontePadrao, |
|
1843
|
|
|
'size' => 6, |
|
1844
|
|
|
'style' => ''); |
|
1845
|
|
|
$this->pdf->textBox($x, $y, $w * 0.10, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1846
|
|
|
$texto = $this->pYmd2dmy($this->getTagValue($this->rem, "dEmi")); |
|
|
|
|
|
|
1847
|
|
|
$aFont = array( |
|
1848
|
|
|
'font' => $this->fontePadrao, |
|
1849
|
|
|
'size' => 6, |
|
1850
|
|
|
'style' => 'B'); |
|
1851
|
|
|
$this->pdf->textBox($x, $y + 3, $w * 0.10, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1852
|
|
|
// VAGOES |
|
1853
|
|
|
$x += $w * 0.06; |
|
1854
|
|
|
$this->pdf->line($x, $y, $x, $y1); |
|
1855
|
|
|
$texto = 'NUM'; |
|
1856
|
|
|
$aFont = array( |
|
1857
|
|
|
'font' => $this->fontePadrao, |
|
1858
|
|
|
'size' => 6, |
|
1859
|
|
|
'style' => ''); |
|
1860
|
|
|
$this->pdf->textBox($x, $y, $w * 0.10, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1861
|
|
|
$texto = $this->getTagValue($this->ferrov, "nVag"); |
|
1862
|
|
|
$aFont = array( |
|
1863
|
|
|
'font' => $this->fontePadrao, |
|
1864
|
|
|
'size' => 6, |
|
1865
|
|
|
'style' => 'B'); |
|
1866
|
|
|
$this->pdf->textBox($x, $y + 3, $w * 0.10, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1867
|
|
|
$x += $w * 0.06; |
|
1868
|
|
|
$this->pdf->line($x, $y, $x, $y1); |
|
1869
|
|
|
$texto = 'TIPO'; |
|
1870
|
|
|
$aFont = array( |
|
1871
|
|
|
'font' => $this->fontePadrao, |
|
1872
|
|
|
'size' => 6, |
|
1873
|
|
|
'style' => ''); |
|
1874
|
|
|
$this->pdf->textBox($x, $y, $w * 0.10, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1875
|
|
|
$texto = $this->getTagValue($this->ferrov, "tpVag"); |
|
1876
|
|
|
$aFont = array( |
|
1877
|
|
|
'font' => $this->fontePadrao, |
|
1878
|
|
|
'size' => 6, |
|
1879
|
|
|
'style' => 'B'); |
|
1880
|
|
|
$this->pdf->textBox($x, $y + 3, $w * 0.10, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1881
|
|
|
$x += $w * 0.06; |
|
1882
|
|
|
$this->pdf->line($x, $y, $x, $y1); |
|
1883
|
|
|
$texto = 'CAPACIDADE'; |
|
1884
|
|
|
$aFont = array( |
|
1885
|
|
|
'font' => $this->fontePadrao, |
|
1886
|
|
|
'size' => 6, |
|
1887
|
|
|
'style' => ''); |
|
1888
|
|
|
$this->pdf->textBox($x, $y, $w * 0.10, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1889
|
|
|
$texto = $this->getTagValue($this->ferrov, "cap"); |
|
1890
|
|
|
$aFont = array( |
|
1891
|
|
|
'font' => $this->fontePadrao, |
|
1892
|
|
|
'size' => 6, |
|
1893
|
|
|
'style' => 'B'); |
|
1894
|
|
|
$this->pdf->textBox($x, $y + 3, $w * 0.10, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1895
|
|
|
$x += $w * 0.08; |
|
1896
|
|
|
$this->pdf->line($x, $y, $x, $y1); |
|
1897
|
|
|
$texto = 'PESO REAL/TON'; |
|
1898
|
|
|
$aFont = array( |
|
1899
|
|
|
'font' => $this->fontePadrao, |
|
1900
|
|
|
'size' => 6, |
|
1901
|
|
|
'style' => ''); |
|
1902
|
|
|
$this->pdf->textBox($x, $y, $w * 0.10, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1903
|
|
|
$texto = $this->getTagValue($this->ferrov, "pesoR"); |
|
1904
|
|
|
$aFont = array( |
|
1905
|
|
|
'font' => $this->fontePadrao, |
|
1906
|
|
|
'size' => 6, |
|
1907
|
|
|
'style' => 'B'); |
|
1908
|
|
|
$this->pdf->textBox($x, $y + 3, $w * 0.10, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1909
|
|
|
$x += $w * 0.09; |
|
1910
|
|
|
$this->pdf->line($x, $y, $x, $y1); |
|
1911
|
|
|
$texto = 'PESO BRUTO/TON'; |
|
1912
|
|
|
$aFont = array( |
|
1913
|
|
|
'font' => $this->fontePadrao, |
|
1914
|
|
|
'size' => 6, |
|
1915
|
|
|
'style' => ''); |
|
1916
|
|
|
$this->pdf->textBox($x, $y, $w * 0.10, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1917
|
|
|
$texto = $this->getTagValue($this->ferrov, "pesoBC"); |
|
1918
|
|
|
$aFont = array( |
|
1919
|
|
|
'font' => $this->fontePadrao, |
|
1920
|
|
|
'size' => 6, |
|
1921
|
|
|
'style' => 'B'); |
|
1922
|
|
|
$this->pdf->textBox($x, $y + 3, $w * 0.10, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1923
|
|
|
$x += $w * 0.1; |
|
1924
|
|
|
$this->pdf->line($x, $y, $x, $y1); |
|
1925
|
|
|
$texto = 'IDENTIFICAÇÃO DOS CONTÊINERES'; |
|
1926
|
|
|
$aFont = array( |
|
1927
|
|
|
'font' => $this->fontePadrao, |
|
1928
|
|
|
'size' => 6, |
|
1929
|
|
|
'style' => ''); |
|
1930
|
|
|
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1931
|
|
|
$texto = $this->getTagValue($this->ferrov, "nCont"); |
|
1932
|
|
|
$aFont = array( |
|
1933
|
|
|
'font' => $this->fontePadrao, |
|
1934
|
|
|
'size' => 6, |
|
1935
|
|
|
'style' => 'B'); |
|
1936
|
|
|
$this->pdf->textBox($x, $y + 3, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1937
|
|
|
// FLUXO |
|
1938
|
|
|
$x = 1; |
|
1939
|
|
|
$y += 12.9; |
|
1940
|
|
|
$h1 = $h * 0.5 + 0.27; |
|
1941
|
|
|
$wa = round($w * 0.103) + 0.5; |
|
1942
|
|
|
$texto = 'FLUXO FERROVIARIO'; |
|
1943
|
|
|
$aFont = $this->formatPadrao; |
|
1944
|
|
|
$this->pdf->textBox($x, $y, $wa, $h1, $texto, $aFont, 'T', 'C', 1, ''); |
|
|
|
|
|
|
1945
|
|
|
$texto = $this->getTagValue($this->ferrov, "fluxo"); |
|
1946
|
|
|
$aFont = array( |
|
1947
|
|
|
'font' => $this->fontePadrao, |
|
1948
|
|
|
'size' => 7, |
|
1949
|
|
|
'style' => 'B'); |
|
1950
|
|
|
$this->pdf->textBox($x, $y + 3, $wa, $h1, $texto, $aFont, 'T', 'C', 0, ''); |
|
|
|
|
|
|
1951
|
|
|
$y += 10; |
|
1952
|
|
|
$texto = 'TIPO DE TRÁFEGO'; |
|
1953
|
|
|
$aFont = $this->formatPadrao; |
|
1954
|
|
|
$this->pdf->textBox($x, $y, $wa, $h1, $texto, $aFont, 'T', 'C', 1, ''); |
|
|
|
|
|
|
1955
|
|
|
$texto = $this->convertUnidTrafego($this->getTagValue($this->ferrov, "tpTraf")); |
|
1956
|
|
|
$aFont = array( |
|
1957
|
|
|
'font' => $this->fontePadrao, |
|
1958
|
|
|
'size' => 7, |
|
1959
|
|
|
'style' => 'B'); |
|
1960
|
|
|
$this->pdf->textBox($x, $y + 3, $wa, $h1, $texto, $aFont, 'T', 'C', 0, ''); |
|
|
|
|
|
|
1961
|
|
|
// Novo Box Relativo a Modal Ferroviário |
|
1962
|
|
|
$x = 22.5; |
|
1963
|
|
|
$y += -10.2; |
|
1964
|
|
|
$texto = 'INFORMAÇÕES DAS FERROVIAS ENVOLVIDAS'; |
|
1965
|
|
|
$aFont = $this->formatPadrao; |
|
1966
|
|
|
$this->pdf->textBox($x, $y, $w - 21.5, $h1 * 2.019, $texto, $aFont, 'T', 'C', 1, ''); |
|
|
|
|
|
|
1967
|
|
|
$y += 3.4; |
|
1968
|
|
|
$this->pdf->line($x, $y, $w + 1, $y); |
|
1969
|
|
|
$w = $w * 0.2; |
|
1970
|
|
|
$h = $h * 1.04; |
|
1971
|
|
|
$texto = 'CÓDIGO INTERNO'; |
|
1972
|
|
|
$aFont = array( |
|
1973
|
|
|
'font' => $this->fontePadrao, |
|
1974
|
|
|
'size' => 6, |
|
1975
|
|
|
'style' => ''); |
|
1976
|
|
|
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1977
|
|
|
$texto = $this->getTagValue($this->ferrov, "cInt"); |
|
1978
|
|
|
$aFont = array( |
|
1979
|
|
|
'font' => $this->fontePadrao, |
|
1980
|
|
|
'size' => 6, |
|
1981
|
|
|
'style' => 'B'); |
|
1982
|
|
|
$this->pdf->textBox($x, $y + 3, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1983
|
|
|
$texto = 'CNPJ'; |
|
1984
|
|
|
$aFont = array( |
|
1985
|
|
|
'font' => $this->fontePadrao, |
|
1986
|
|
|
'size' => 6, |
|
1987
|
|
|
'style' => ''); |
|
1988
|
|
|
$this->pdf->textBox($x, $y + 6, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1989
|
|
|
$texto = $this->getTagValue($this->ferrov, "CNPJ"); |
|
1990
|
|
|
$aFont = array( |
|
1991
|
|
|
'font' => $this->fontePadrao, |
|
1992
|
|
|
'size' => 6, |
|
1993
|
|
|
'style' => 'B'); |
|
1994
|
|
|
$this->pdf->textBox($x, $y + 9, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
1995
|
|
|
$x += 50; |
|
1996
|
|
|
$texto = 'NOME'; |
|
1997
|
|
|
$aFont = array( |
|
1998
|
|
|
'font' => $this->fontePadrao, |
|
1999
|
|
|
'size' => 6, |
|
2000
|
|
|
'style' => ''); |
|
2001
|
|
|
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
2002
|
|
|
$texto = $this->getTagValue($this->ferrov, "xNome"); |
|
2003
|
|
|
$aFont = array( |
|
2004
|
|
|
'font' => $this->fontePadrao, |
|
2005
|
|
|
'size' => 6, |
|
2006
|
|
|
'style' => 'B'); |
|
2007
|
|
|
$this->pdf->textBox($x, $y + 3, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
2008
|
|
|
$texto = 'INSCRICAO ESTADUAL'; |
|
2009
|
|
|
$aFont = array( |
|
2010
|
|
|
'font' => $this->fontePadrao, |
|
2011
|
|
|
'size' => 6, |
|
2012
|
|
|
'style' => ''); |
|
2013
|
|
|
$this->pdf->textBox($x, $y + 6, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
2014
|
|
|
$texto = $this->getTagValue($this->ferrov, "IE"); |
|
2015
|
|
|
$aFont = array( |
|
2016
|
|
|
'font' => $this->fontePadrao, |
|
2017
|
|
|
'size' => 6, |
|
2018
|
|
|
'style' => 'B'); |
|
2019
|
|
|
$this->pdf->textBox($x, $y + 9, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
2020
|
|
|
$x += 50; |
|
2021
|
|
|
$texto = 'PARTICIPAÇÃO OUTRA FERROVIA'; |
|
2022
|
|
|
$aFont = array( |
|
2023
|
|
|
'font' => $this->fontePadrao, |
|
2024
|
|
|
'size' => 6, |
|
2025
|
|
|
'style' => ''); |
|
2026
|
|
|
$this->pdf->textBox($x, $y + 6, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
2027
|
|
|
$texto = ''; |
|
2028
|
|
|
$aFont = array( |
|
2029
|
|
|
'font' => $this->fontePadrao, |
|
2030
|
|
|
'size' => 6, |
|
2031
|
|
|
'style' => 'B'); |
|
2032
|
|
|
$this->pdf->textBox($x, $y + 9, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
2033
|
|
|
} |
|
2034
|
|
|
|
|
2035
|
|
|
/** |
|
2036
|
|
|
* canhoto |
|
2037
|
|
|
* Monta o campo com os dados do remetente na DACTE. |
|
2038
|
|
|
* |
|
2039
|
|
|
* @param number $x Posição horizontal canto esquerdo |
|
2040
|
|
|
* @param number $y Posição vertical canto superior |
|
2041
|
|
|
* @return number Posição vertical final |
|
2042
|
|
|
*/ |
|
2043
|
|
|
protected function canhoto($x = 0, $y = 0) |
|
2044
|
|
|
{ |
|
2045
|
|
|
$this->pdf->dashedHLine($x, $y+2, $this->wPrint, 0.1, 80); |
|
2046
|
|
|
$y = $y + 2; |
|
2047
|
|
|
$oldX = $x; |
|
2048
|
|
|
$oldY = $y; |
|
|
|
|
|
|
2049
|
|
|
if ($this->orientacao == 'P') { |
|
2050
|
|
|
$maxW = $this->wPrint; |
|
2051
|
|
|
} else { |
|
2052
|
|
|
$maxW = $this->wPrint - $this->wCanhoto; |
|
2053
|
|
|
} |
|
2054
|
|
|
$w = $maxW - 1; |
|
2055
|
|
|
$h = 20; |
|
2056
|
|
|
$y = $y + 1; |
|
2057
|
|
|
$texto = 'DECLARO QUE RECEBI OS VOLUMES DESTE CONHECIMENTO EM PERFEITO ESTADO '; |
|
2058
|
|
|
$texto .= 'PELO QUE DOU POR CUMPRIDO O PRESENTE CONTRATO DE TRANSPORTE'; |
|
2059
|
|
|
$aFont = $this->formatPadrao; |
|
2060
|
|
|
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'C', 1, ''); |
|
|
|
|
|
|
2061
|
|
|
$y += 3.4; |
|
2062
|
|
|
$this->pdf->line($x, $y, $w + 1, $y); // LINHA ABAICO DO TEXTO DECLARO QUE RECEBI... |
|
2063
|
|
|
|
|
2064
|
|
|
$texto = 'NOME'; |
|
2065
|
|
|
$aFont = array( |
|
2066
|
|
|
'font' => $this->fontePadrao, |
|
2067
|
|
|
'size' => 6, |
|
2068
|
|
|
'style' => ''); |
|
2069
|
|
|
$this->pdf->textBox($x, $y, $w * 0.25, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
2070
|
|
|
$x += $w * 0.25; |
|
2071
|
|
|
|
|
2072
|
|
|
$this->pdf->line($x, $y, $x, $y + 16.5); |
|
2073
|
|
|
|
|
2074
|
|
|
$texto = 'ASSINATURA / CARIMBO'; |
|
2075
|
|
|
$aFont = array( |
|
2076
|
|
|
'font' => $this->fontePadrao, |
|
2077
|
|
|
'size' => 6, |
|
2078
|
|
|
'style' => ''); |
|
2079
|
|
|
$this->pdf->textBox($x, $y, $w * 0.25, $h - 3.4, $texto, $aFont, 'B', 'C', 0, ''); |
|
|
|
|
|
|
2080
|
|
|
$x += $w * 0.25; |
|
2081
|
|
|
|
|
2082
|
|
|
$this->pdf->line($x, $y, $x, $y + 16.5); |
|
2083
|
|
|
|
|
2084
|
|
|
$texto = 'TÉRMINO DA PRESTAÇÃO - DATA/HORA' . "\r\n" . "\r\n" . "\r\n". "\r\n"; |
|
2085
|
|
|
$texto .= ' INÍCIO DA PRESTAÇÃO - DATA/HORA'; |
|
2086
|
|
|
$aFont = array( |
|
2087
|
|
|
'font' => $this->fontePadrao, |
|
2088
|
|
|
'size' => 6, |
|
2089
|
|
|
'style' => ''); |
|
2090
|
|
|
$this->pdf->textBox($x + 10, $y, $w * 0.25, $h - 3.4, $texto, $aFont, 'T', 'C', 0, ''); |
|
|
|
|
|
|
2091
|
|
|
$x = $oldX; |
|
2092
|
|
|
$y = $y + 5; |
|
2093
|
|
|
|
|
2094
|
|
|
$this->pdf->line($x, $y+3, $w * 0.255, $y+3); // LINHA HORIZONTAL ACIMA DO RG ABAIXO DO NOME |
|
2095
|
|
|
|
|
2096
|
|
|
$texto = 'RG'; |
|
2097
|
|
|
$aFont = array( |
|
2098
|
|
|
'font' => $this->fontePadrao, |
|
2099
|
|
|
'size' => 6, |
|
2100
|
|
|
'style' => ''); |
|
2101
|
|
|
$this->pdf->textBox($x, $y+3, $w * 0.33, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
|
|
|
|
|
2102
|
|
|
$x += $w * 0.85; |
|
2103
|
|
|
|
|
2104
|
|
|
$this->pdf->line($x, $y + 11.5, $x, $y - 5); // LINHA VERTICAL PROXIMO AO CT-E |
|
2105
|
|
|
|
|
2106
|
|
|
$texto = "CT-E OS"; |
|
2107
|
|
|
$aFont = $this->formatNegrito; |
|
2108
|
|
|
$this->pdf->textBox($x, $y - 5, $w * 0.15, $h, $texto, $aFont, 'T', 'C', 0, ''); |
|
|
|
|
|
|
2109
|
|
|
$texto = "\r\n Nº. DOCUMENTO " . $this->getTagValue($this->ide, "nCT") . " \n"; |
|
2110
|
|
|
$texto .= "\r\n SÉRIE " . $this->getTagValue($this->ide, "serie"); |
|
2111
|
|
|
$aFont = array( |
|
2112
|
|
|
'font' => $this->fontePadrao, |
|
2113
|
|
|
'size' => 6, |
|
2114
|
|
|
'style' => ''); |
|
2115
|
|
|
$this->pdf->textBox($x, $y - 8, $w * 0.15, $h, $texto, $aFont, 'C', 'C', 0, ''); |
|
|
|
|
|
|
2116
|
|
|
$x = $oldX; |
|
|
|
|
|
|
2117
|
|
|
} |
|
2118
|
|
|
|
|
2119
|
|
|
/** |
|
2120
|
|
|
* dadosAdic |
|
2121
|
|
|
* Coloca o grupo de dados adicionais da DACTE. |
|
2122
|
|
|
* |
|
2123
|
|
|
* @param number $x Posição horizontal canto esquerdo |
|
2124
|
|
|
* @param number $y Posição vertical canto superior |
|
2125
|
|
|
* @param number $h altura do campo |
|
2126
|
|
|
* @return number Posição vertical final |
|
2127
|
|
|
*/ |
|
2128
|
|
|
protected function dadosAdic($x, $y, $pag, $h) |
|
|
|
|
|
|
2129
|
|
|
{ |
|
2130
|
|
|
$oldX = $x; |
|
|
|
|
|
|
2131
|
|
|
//########################################################################### |
|
2132
|
|
|
//DADOS ADICIONAIS DACTE |
|
2133
|
|
|
if ($this->orientacao == 'P') { |
|
2134
|
|
|
$w = $this->wPrint; |
|
|
|
|
|
|
2135
|
|
|
} else { |
|
2136
|
|
|
$w = $this->wPrint - $this->wCanhoto; |
|
|
|
|
|
|
2137
|
|
|
} |
|
2138
|
|
|
//INFORMAÇÕES COMPLEMENTARES |
|
2139
|
|
|
$texto = "USO EXCLUSIVO DO EMISSOR DO CT-E"; |
|
2140
|
|
|
$y += 3; |
|
2141
|
|
|
$w = $this->wAdic; |
|
2142
|
|
|
$h = 20; //mudar |
|
2143
|
|
|
$aFont = array( |
|
2144
|
|
|
'font' => $this->fontePadrao, |
|
2145
|
|
|
'size' => 6, |
|
2146
|
|
|
'style' => ''); |
|
2147
|
|
|
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'C', 1, ''); |
|
|
|
|
|
|
2148
|
|
|
//$this->pdf->line($x, $y + 3, $w * 1.385, $y + 3); |
|
2149
|
|
|
$this->pdf->line($x, $y + 3, $w * 1.385, $y + 3); |
|
2150
|
|
|
//o texto com os dados adicionais foi obtido na função xxxxxx |
|
2151
|
|
|
//e carregado em uma propriedade privada da classe |
|
2152
|
|
|
//$this->wAdic com a largura do campo |
|
2153
|
|
|
//$this->textoAdic com o texto completo do campo |
|
2154
|
|
|
$y += 1; |
|
2155
|
|
|
$aFont = $this->formatPadrao; |
|
2156
|
|
|
$this->pdf->textBox($x, $y + 3, $w - 2, $h - 3, $this->textoAdic, $aFont, 'T', 'L', 0, '', false); |
|
|
|
|
|
|
2157
|
|
|
//RESERVADO AO FISCO |
|
2158
|
|
|
$texto = "RESERVADO AO FISCO"; |
|
2159
|
|
|
$x += $w; |
|
2160
|
|
|
$y -= 1; |
|
2161
|
|
|
if ($this->orientacao == 'P') { |
|
2162
|
|
|
$w = $this->wPrint - $w; |
|
2163
|
|
|
} else { |
|
2164
|
|
|
$w = $this->wPrint - $w - $this->wCanhoto; |
|
2165
|
|
|
} |
|
2166
|
|
|
$aFont = array( |
|
2167
|
|
|
'font' => $this->fontePadrao, |
|
2168
|
|
|
'size' => 6, |
|
2169
|
|
|
'style' => ''); |
|
2170
|
|
|
$this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'C', 1, ''); |
|
|
|
|
|
|
2171
|
|
|
//inserir texto informando caso de contingência |
|
2172
|
|
|
//1 – Normal – emissão normal; |
|
2173
|
|
|
//2 – Contingência FS – emissão em contingência com impressão do DACTE em Formulário de Segurança; |
|
2174
|
|
|
//3 – Contingência SCAN – emissão em contingência – SCAN; |
|
2175
|
|
|
//4 – Contingência DPEC - emissão em contingência com envio da Declaração Prévia de |
|
2176
|
|
|
//Emissão em Contingência – DPEC; |
|
2177
|
|
|
//5 – Contingência FS-DA - emissão em contingência com impressão do DACTE em Formulário de |
|
2178
|
|
|
//Segurança para Impressão de Documento Auxiliar de Documento Fiscal Eletrônico (FS-DA). |
|
2179
|
|
|
$xJust = $this->getTagValue($this->ide, 'xJust', 'Justificativa: '); |
|
2180
|
|
|
$dhCont = $this->getTagValue($this->ide, 'dhCont', ' Entrada em contingência : '); |
|
2181
|
|
|
$texto = ''; |
|
2182
|
|
|
switch ($this->tpEmis) { |
|
2183
|
|
|
case 2: |
|
2184
|
|
|
$texto = 'CONTINGÊNCIA FS' . $dhCont . $xJust; |
|
2185
|
|
|
break; |
|
2186
|
|
|
case 3: |
|
2187
|
|
|
$texto = 'CONTINGÊNCIA SCAN' . $dhCont . $xJust; |
|
2188
|
|
|
break; |
|
2189
|
|
|
case 4: |
|
2190
|
|
|
$texto = 'CONTINGÊNCIA DPEC' . $dhCont . $xJust; |
|
2191
|
|
|
break; |
|
2192
|
|
|
case 5: |
|
2193
|
|
|
$texto = 'CONTINGÊNCIA FSDA' . $dhCont . $xJust; |
|
2194
|
|
|
break; |
|
2195
|
|
|
} |
|
2196
|
|
|
$y += 2; |
|
2197
|
|
|
$aFont = $this->formatPadrao; |
|
2198
|
|
|
$this->pdf->textBox($x, $y + 2, $w - 2, $h - 3, $texto, $aFont, 'T', 'L', 0, '', false); |
|
|
|
|
|
|
2199
|
|
|
return $y + $h; |
|
2200
|
|
|
} |
|
2201
|
|
|
|
|
2202
|
|
|
/** |
|
2203
|
|
|
* formatCNPJCPF |
|
2204
|
|
|
* Formata campo CnpjCpf contida na CTe |
|
2205
|
|
|
* |
|
2206
|
|
|
* @param string $field campo cnpjCpf da CT-e |
|
2207
|
|
|
* @return string |
|
2208
|
|
|
*/ |
|
2209
|
|
|
protected function formatCNPJCPF($field) |
|
2210
|
|
|
{ |
|
2211
|
|
|
if (!isset($field)) { |
|
2212
|
|
|
return ''; |
|
2213
|
|
|
} |
|
2214
|
|
|
$cnpj = !empty($field->getElementsByTagName("CNPJ")->item(0)->nodeValue) ? |
|
|
|
|
|
|
2215
|
|
|
$field->getElementsByTagName("CNPJ")->item(0)->nodeValue : ""; |
|
|
|
|
|
|
2216
|
|
|
if ($cnpj != "" && $cnpj != "00000000000000") { |
|
2217
|
|
|
$cnpj = $this->formatField($cnpj, '###.###.###/####-##'); |
|
2218
|
|
|
} else { |
|
2219
|
|
|
$cnpj = !empty($field->getElementsByTagName("CPF")->item(0)->nodeValue) ? |
|
|
|
|
|
|
2220
|
|
|
$this->formatField($field->getElementsByTagName("CPF")->item(0)->nodeValue, '###.###.###.###-##') : ''; |
|
|
|
|
|
|
2221
|
|
|
} |
|
2222
|
|
|
return $cnpj; |
|
2223
|
|
|
} |
|
2224
|
|
|
|
|
2225
|
|
|
/** |
|
2226
|
|
|
* formatFone |
|
2227
|
|
|
* Formata campo fone contida na CTe |
|
2228
|
|
|
* |
|
2229
|
|
|
* @param string $field campo fone da CT-e |
|
2230
|
|
|
* @return string |
|
2231
|
|
|
*/ |
|
2232
|
|
|
protected function formatFone($field) |
|
2233
|
|
|
{ |
|
2234
|
|
|
try { |
|
2235
|
|
|
$fone = !empty($field->getElementsByTagName("fone")->item(0)->nodeValue) ? |
|
|
|
|
|
|
2236
|
|
|
$field->getElementsByTagName("fone")->item(0)->nodeValue : ''; |
|
|
|
|
|
|
2237
|
|
|
$foneLen = strlen($fone); |
|
2238
|
|
|
if ($foneLen > 0) { |
|
2239
|
|
|
$fone2 = substr($fone, 0, $foneLen - 4); |
|
2240
|
|
|
$fone1 = substr($fone, 0, $foneLen - 8); |
|
2241
|
|
|
$fone = '(' . $fone1 . ') ' . substr($fone2, -4) . '-' . substr($fone, -4); |
|
2242
|
|
|
} else { |
|
2243
|
|
|
$fone = ''; |
|
2244
|
|
|
} |
|
2245
|
|
|
return $fone; |
|
2246
|
|
|
} catch (Exception $exc) { |
|
2247
|
|
|
return ''; |
|
2248
|
|
|
} |
|
2249
|
|
|
} |
|
2250
|
|
|
|
|
2251
|
|
|
/** |
|
2252
|
|
|
* unidade |
|
2253
|
|
|
* Converte a imformação de peso contida na CTe |
|
2254
|
|
|
* |
|
2255
|
|
|
* @param string $c unidade de trafego extraida da CTe |
|
2256
|
|
|
* @return string |
|
2257
|
|
|
*/ |
|
2258
|
|
|
protected function unidade($c = '') |
|
2259
|
|
|
{ |
|
2260
|
|
|
switch ($c) { |
|
2261
|
|
|
case '00': |
|
2262
|
|
|
$r = 'M3'; |
|
2263
|
|
|
break; |
|
2264
|
|
|
case '01': |
|
2265
|
|
|
$r = 'KG'; |
|
2266
|
|
|
break; |
|
2267
|
|
|
case '02': |
|
2268
|
|
|
$r = 'TON'; |
|
2269
|
|
|
break; |
|
2270
|
|
|
case '03': |
|
2271
|
|
|
$r = 'UN'; |
|
2272
|
|
|
break; |
|
2273
|
|
|
case '04': |
|
2274
|
|
|
$r = 'LT'; |
|
2275
|
|
|
break; |
|
2276
|
|
|
case '05': |
|
2277
|
|
|
$r = 'MMBTU'; |
|
2278
|
|
|
break; |
|
2279
|
|
|
default: |
|
2280
|
|
|
$r = ''; |
|
2281
|
|
|
} |
|
2282
|
|
|
return $r; |
|
2283
|
|
|
} |
|
2284
|
|
|
|
|
2285
|
|
|
/** |
|
2286
|
|
|
* convertUnidTrafego |
|
2287
|
|
|
* Converte a imformação de peso contida na CTe |
|
2288
|
|
|
* |
|
2289
|
|
|
* @param string $U Informação de trafego extraida da CTe |
|
2290
|
|
|
* @return string |
|
2291
|
|
|
*/ |
|
2292
|
|
|
protected function convertUnidTrafego($U = '') |
|
2293
|
|
|
{ |
|
2294
|
|
|
if ($U) { |
|
2295
|
|
|
switch ($U) { |
|
2296
|
|
|
case '0': |
|
2297
|
|
|
$stringU = 'Próprio'; |
|
2298
|
|
|
break; |
|
2299
|
|
|
case '1': |
|
2300
|
|
|
$stringU = 'Mútuo'; |
|
2301
|
|
|
break; |
|
2302
|
|
|
case '2': |
|
2303
|
|
|
$stringU = 'Rodoferroviário'; |
|
2304
|
|
|
break; |
|
2305
|
|
|
case '3': |
|
2306
|
|
|
$stringU = 'Rodoviário'; |
|
2307
|
|
|
break; |
|
2308
|
|
|
} |
|
2309
|
|
|
return $stringU; |
|
|
|
|
|
|
2310
|
|
|
} |
|
2311
|
|
|
} |
|
2312
|
|
|
|
|
2313
|
|
|
/** |
|
2314
|
|
|
* multiUniPeso |
|
2315
|
|
|
* Fornece a imformação multiplicação de peso contida na CTe |
|
2316
|
|
|
* |
|
2317
|
|
|
* @param interger $U Informação de peso extraida da CTe |
|
2318
|
|
|
* @return interger |
|
2319
|
|
|
*/ |
|
2320
|
|
|
protected function multiUniPeso($U = '') |
|
2321
|
|
|
{ |
|
2322
|
|
|
if ($U === "01") { |
|
2323
|
|
|
// tonelada |
|
2324
|
|
|
//return 1000; |
|
2325
|
|
|
return 1; |
|
2326
|
|
|
} |
|
2327
|
|
|
return 1; // M3, KG, Unidade, litros, mmbtu |
|
2328
|
|
|
} |
|
2329
|
|
|
|
|
2330
|
|
|
protected function qrCodeDacteOs($y = 0) |
|
2331
|
|
|
{ |
|
2332
|
|
|
$margemInterna = $this->margemInterna; |
|
2333
|
|
|
$barcode = new Barcode(); |
|
2334
|
|
|
$bobj = $barcode->getBarcodeObj( |
|
2335
|
|
|
'QRCODE,M', |
|
2336
|
|
|
$this->qrCodMDFe, |
|
2337
|
|
|
-4, |
|
2338
|
|
|
-4, |
|
2339
|
|
|
'black', |
|
2340
|
|
|
array(-1, -1, -1, -1) |
|
2341
|
|
|
)->setBackgroundColor('white'); |
|
2342
|
|
|
$qrcode = $bobj->getPngData(); |
|
2343
|
|
|
$wQr = 36; |
|
2344
|
|
|
$hQr = 36; |
|
2345
|
|
|
$yQr = ($y + $margemInterna); |
|
2346
|
|
|
if ($this->orientacao == 'P') { |
|
2347
|
|
|
$xQr = 170; |
|
2348
|
|
|
} else { |
|
2349
|
|
|
$xQr = 250; |
|
2350
|
|
|
} |
|
2351
|
|
|
// prepare a base64 encoded "data url" |
|
2352
|
|
|
$pic = 'data://text/plain;base64,' . base64_encode($qrcode); |
|
2353
|
|
|
$this->pdf->image($pic, $xQr, $yQr, $wQr, $hQr, 'PNG'); |
|
2354
|
|
|
} |
|
2355
|
|
|
} |
|
2356
|
|
|
|
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: