ruby_danfe 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/lib/ruby_danfe.rb +670 -0
  2. data/ruby_danfe.gemspec +11 -0
  3. metadata +93 -0
data/lib/ruby_danfe.rb ADDED
@@ -0,0 +1,670 @@
1
+ require 'rubygems'
2
+ require 'prawn'
3
+ require 'nokogiri'
4
+
5
+ module RubyDanfe
6
+
7
+ version = "0.0.1"
8
+
9
+ class XML
10
+ def initialize(xml_filename)
11
+ @xml = Nokogiri::XML(File.new(xml_filename))
12
+ end
13
+ def [](xpath)
14
+ node = @xml.css(xpath)
15
+ return node ? node.text : ''
16
+ end
17
+ end
18
+
19
+ def self.generate(pdf_filename, xml_filename)
20
+
21
+ xml = XML.new(xml_filename)
22
+
23
+ Prawn::Document.generate(pdf_filename) do |pdf|
24
+
25
+ pdf.set_margin [14, 14, 14, 14]
26
+
27
+ # rectangle
28
+ pdf.stroke_rectangle [328, 653], 222, 22
29
+
30
+ # rectangle
31
+ pdf.stroke_rectangle [328, 697], 222, 84
32
+
33
+ # rectangle
34
+ pdf.stroke_rectangle [347, 457], 96, 18
35
+
36
+ # rectangle
37
+ pdf.stroke_rectangle [443, 749], 107, 37
38
+
39
+ # rectangle
40
+ pdf.stroke_rectangle [112, 526], 63, 44
41
+
42
+ # rectangle
43
+ pdf.stroke_rectangle [49, 526], 63, 44
44
+
45
+ # rectangle
46
+ pdf.stroke_rectangle [-14, 526], 63, 44
47
+
48
+ # rectangle
49
+ pdf.stroke_rectangle [429, 431], 24, 18
50
+
51
+ # rectangle
52
+ pdf.stroke_rectangle [165, 431], 59, 18
53
+
54
+ # rectangle
55
+ pdf.stroke_rectangle [213, 424], 9, 9
56
+
57
+ # rectangle
58
+ pdf.stroke_rectangle [364, 613], 186, 18
59
+
60
+ # rectangle
61
+ pdf.stroke_rectangle [175, 613], 189, 18
62
+
63
+ # rectangle
64
+ pdf.stroke_rectangle [328, 673], 222, 18
65
+
66
+ # rectangle
67
+ pdf.stroke_rectangle [328, 697], 222, 24
68
+
69
+ # rectangle
70
+ pdf.stroke_rectangle [264, 697], 64, 66
71
+
72
+ # rectangle
73
+ pdf.stroke_rectangle [312, 668], 9, 10
74
+
75
+ # rectangle
76
+ pdf.stroke_rectangle [-14, 431], 179, 18
77
+
78
+ # rectangle
79
+ pdf.stroke_rectangle [-14, 475], 134, 18
80
+
81
+ # rectangle
82
+ pdf.stroke_rectangle [-14, 457], 91, 18
83
+
84
+ # rectangle
85
+ pdf.stroke_rectangle [-14, 587], 373, 20
86
+
87
+ # rectangle
88
+ pdf.stroke_rectangle [224, 431], 75, 18
89
+
90
+ # rectangle
91
+ pdf.stroke_rectangle [119, 475], 115, 18
92
+
93
+ # rectangle
94
+ pdf.stroke_rectangle [233, 475], 115, 18
95
+
96
+ # rectangle
97
+ pdf.stroke_rectangle [347, 475], 97, 18
98
+
99
+ # rectangle
100
+ pdf.stroke_rectangle [443, 475], 107, 18
101
+
102
+ # rectangle
103
+ pdf.stroke_rectangle [-14, 568], 305, 18
104
+
105
+ # rectangle
106
+ pdf.stroke_rectangle [471, 587], 79, 20
107
+
108
+ # rectangle
109
+ pdf.stroke_rectangle [358, 587], 113, 20
110
+
111
+ # rectangle
112
+ pdf.stroke_rectangle [290, 568], 125, 18
113
+
114
+ # rectangle
115
+ pdf.stroke_rectangle [414, 568], 57, 18
116
+
117
+ # rectangle
118
+ pdf.stroke_rectangle [213, 551], 111, 18
119
+
120
+ # rectangle
121
+ pdf.stroke_rectangle [323, 551], 32, 18
122
+
123
+ # rectangle
124
+ pdf.stroke_rectangle [471, 568], 79, 18
125
+
126
+ # rectangle
127
+ pdf.stroke_rectangle [471, 551], 79, 18
128
+
129
+ # rectangle
130
+ pdf.stroke_rectangle [354, 551], 117, 18
131
+
132
+ # rectangle
133
+ pdf.stroke_rectangle [-14, 551], 228, 18
134
+
135
+ # rectangle
136
+ pdf.stroke_rectangle [255, 457], 92, 18
137
+
138
+ # rectangle
139
+ pdf.stroke_rectangle [76, 457], 90, 18
140
+
141
+ # rectangle
142
+ pdf.stroke_rectangle [165, 457], 90, 18
143
+
144
+ # rectangle
145
+ pdf.stroke_rectangle [443, 457], 107, 18
146
+
147
+ # rectangle
148
+ pdf.stroke_rectangle [298, 431], 131, 18
149
+
150
+ # rectangle
151
+ pdf.stroke_rectangle [245, 413], 185, 18
152
+
153
+ # rectangle
154
+ pdf.stroke_rectangle [453, 431], 97, 18
155
+
156
+ # rectangle
157
+ pdf.stroke_rectangle [-14, 413], 260, 18
158
+
159
+ # rectangle
160
+ pdf.stroke_rectangle [-14, 395], 67, 18
161
+
162
+ # rectangle
163
+ pdf.stroke_rectangle [53, 395], 117, 18
164
+
165
+ # rectangle
166
+ pdf.stroke_rectangle [170, 395], 107, 18
167
+
168
+ # rectangle
169
+ pdf.stroke_rectangle [277, 395], 109, 18
170
+
171
+ # rectangle
172
+ pdf.stroke_rectangle [429, 413], 24, 18
173
+
174
+ # rectangle
175
+ pdf.stroke_rectangle [453, 413], 97, 18
176
+
177
+ # rectangle
178
+ pdf.stroke_rectangle [386, 395], 81, 18
179
+
180
+ # rectangle
181
+ pdf.stroke_rectangle [467, 395], 83, 18
182
+
183
+ # rectangle
184
+ pdf.stroke_rectangle [-14, 631], 342, 18
185
+
186
+ # rectangle
187
+ pdf.stroke_rectangle [-14, 613], 189, 18
188
+
189
+ # rectangle
190
+ pdf.stroke_rectangle [-14, 749], 457, 20
191
+
192
+ # rectangle
193
+ pdf.stroke_rectangle [-14, 729], 74, 17
194
+
195
+ # rectangle
196
+ pdf.stroke_rectangle [60, 729], 383, 17
197
+
198
+ # rectangle
199
+ pdf.stroke_rectangle [175, 526], 63, 44
200
+
201
+ # rectangle
202
+ pdf.stroke_rectangle [238, 526], 63, 44
203
+
204
+ # rectangle
205
+ pdf.stroke_rectangle [301, 526], 63, 44
206
+
207
+ # rectangle
208
+ pdf.stroke_rectangle [364, 526], 63, 44
209
+
210
+ # rectangle
211
+ pdf.stroke_rectangle [427, 526], 63, 44
212
+
213
+ # rectangle
214
+ pdf.stroke_rectangle [490, 526], 60, 44
215
+
216
+ # rectangle
217
+ pdf.stroke_rectangle [-14, 367], 564, 213
218
+
219
+ # rectangle
220
+ pdf.stroke_rectangle [-14, 117], 341, 173
221
+
222
+ # rectangle
223
+ pdf.stroke_rectangle [327, 117], 223, 173
224
+
225
+ # rectangle
226
+ pdf.stroke_rectangle [-14, 146], 112, 20
227
+
228
+ # rectangle
229
+ pdf.stroke_rectangle [97, 146], 145, 20
230
+
231
+ # rectangle
232
+ pdf.stroke_rectangle [241, 146], 145, 20
233
+
234
+ # rectangle
235
+ pdf.stroke_rectangle [385, 146], 165, 20
236
+
237
+ # staticText
238
+ pdf.draw_text "PROTOCOLO DE AUTORIZAÇÃO DE USO", :size => 5, :at => [332, 626], :width => 142, :height => 7
239
+
240
+ # textField xml['infProt/nProt'] + ' ' + xml['infProt/dhRecbto']
241
+ pdf.draw_text xml['infProt/nProt'] + ' ' + xml['infProt/dhRecbto'], :size => 6, :at => [333, 617], :width => 215, :height => 9
242
+
243
+ # staticText
244
+ pdf.draw_text "Consulta de autenticidade no portal nacional da NF-e www.nfe.fazenda.gov.br/portal ou no site da Sefaz Autorizadora", :size => 6, :at => [330, 638], :width => 218, :height => 17
245
+
246
+ # staticText
247
+ pdf.draw_text "N°.", :size => 7, :at => [446, 728], :width => 9, :height => 9
248
+
249
+ # staticText
250
+ pdf.draw_text "DESTINATÁRIO / REMETENTE", :size => 5, :at => [-14, 591], :width => 109, :height => 8
251
+
252
+ # staticText
253
+ pdf.draw_text "CNPJ/CPF", :size => 5, :at => [361, 582], :width => 46, :height => 7
254
+
255
+ # staticText
256
+ pdf.draw_text "DATA DA EMISSÃO", :size => 5, :at => [474, 582], :width => 49, :height => 7
257
+
258
+ # staticText
259
+ pdf.draw_text "NOME/RAZÃO SOCIAL", :size => 5, :at => [-11, 582], :width => 107, :height => 7
260
+
261
+ # staticText
262
+ pdf.draw_text "ENDEREÇO", :size => 5, :at => [-11, 563], :width => 107, :height => 7
263
+
264
+ # staticText
265
+ pdf.draw_text "BAIRRO / DISTRITO", :size => 5, :at => [293, 563], :width => 69, :height => 7
266
+
267
+ # staticText
268
+ pdf.draw_text "CEP", :size => 5, :at => [415, 563], :width => 30, :height => 7
269
+
270
+ # staticText
271
+ pdf.draw_text "FONE/FAX", :size => 5, :at => [217, 546], :width => 49, :height => 7
272
+
273
+ # staticText
274
+ pdf.draw_text "UF", :size => 5, :at => [326, 546], :width => 17, :height => 7
275
+
276
+ # staticText
277
+ pdf.draw_text "FATURA / DUPLICATAS", :size => 5, :at => [-14, 530], :width => 109, :height => 7
278
+
279
+ # staticText
280
+ pdf.draw_text "CÁLCULO DO IMPOSTO", :size => 5, :at => [-14, 479], :width => 109, :height => 7
281
+
282
+ # staticText
283
+ pdf.draw_text "BASE DE CÁLCULO DO ICMS", :size => 5, :at => [-11, 470], :width => 73, :height => 7
284
+
285
+ # staticText
286
+ pdf.draw_text "VALOR DO ICMS", :size => 5, :at => [122, 470], :width => 78, :height => 7
287
+
288
+ # staticText
289
+ pdf.draw_text "BASE DE CÁLCULO DO ICMS ST", :size => 5, :at => [236, 470], :width => 80, :height => 7
290
+
291
+ # staticText
292
+ pdf.draw_text "VALOR DO ICMS ST", :size => 5, :at => [350, 470], :width => 59, :height => 7
293
+
294
+ # staticText
295
+ pdf.draw_text "VALOR TOTAL DOS PRODUTOS", :size => 5, :at => [446, 470], :width => 79, :height => 7
296
+
297
+ # staticText
298
+ pdf.draw_text "TRANSPORTADOR / VOLUMES TRANSPORTADOS DADOS DO PRODUTO / SERVIÇODADOS DO PRODUTO / SERVIÇODADOS DO PRODUTO / SERVIÇO", :size => 5, :at => [-14, 435], :width => 134, :height => 8
299
+
300
+ # staticText
301
+ pdf.draw_text "RAZÃO SOCIAL", :size => 5, :at => [-11, 426], :width => 64, :height => 7
302
+
303
+ # staticText
304
+ pdf.draw_text "FRETE POR CONTA", :size => 5, :at => [167, 426], :width => 49, :height => 7
305
+
306
+ # staticText
307
+ pdf.draw_text "CÓDIGO ANTT", :size => 5, :at => [227, 426], :width => 49, :height => 7
308
+
309
+ # staticText
310
+ pdf.draw_text "0-EMITENTE 1-DESTINATÁRIO", :size => 4, :at => [167, 416], :width => 44, :height => 12
311
+
312
+ # textField dest/xNome
313
+ pdf.draw_text xml['dest/xNome'], :size => 7, :at => [-11, 572], :width => 366, :height => 9
314
+
315
+ # textField enderDest/xLgr enderDest/nro
316
+ pdf.draw_text xml['enderDest/xLgr'] + " " + xml['enderDest/nro'], :size => 7, :at => [-11, 555], :width => 298, :height => 9
317
+
318
+ # textField dest/CNPJ
319
+ pdf.draw_text xml['dest/CNPJ'], :size => 7, :at => [361, 572], :width => 107, :height => 9
320
+
321
+ # textField ide/dEmi
322
+ pdf.draw_text xml['ide/dEmi'], :size => 7, :at => [474, 572], :width => 74, :height => 9
323
+
324
+ # textField enderDest/xBairro
325
+ pdf.draw_text xml['enderDest/xBairro'], :size => 7, :at => [293, 555], :width => 119, :height => 9
326
+
327
+ # textField enderDest/CEP
328
+ pdf.draw_text xml['enderDest/CEP'], :size => 7, :at => [415, 555], :width => 55, :height => 9
329
+
330
+ # textField enderDest/UF
331
+ pdf.draw_text xml['enderDest/UF'], :size => 7, :at => [326, 537], :width => 26, :height => 9
332
+
333
+ # textField enderDest/fone
334
+ pdf.draw_text xml['enderDest/fone'], :size => 7, :at => [217, 537], :width => 104, :height => 9
335
+
336
+ # textField total/vBC
337
+ pdf.draw_text xml['total/vBC'], :size => 7, :at => [-11, 461], :width => 127, :height => 9
338
+
339
+ # textField total/vICMS
340
+ pdf.draw_text xml['total/vICMS'], :size => 7, :at => [122, 461], :width => 108, :height => 9
341
+
342
+ # textField total/vBCST
343
+ pdf.draw_text xml['total/vBCST'], :size => 7, :at => [236, 461], :width => 108, :height => 9
344
+
345
+ # textField total/vST
346
+ pdf.draw_text xml['total/vST'], :size => 7, :at => [350, 461], :width => 90, :height => 9
347
+
348
+ # textField total/vProd
349
+ pdf.draw_text xml['total/vProd'], :size => 7, :at => [446, 461], :width => 101, :height => 9
350
+
351
+ # textField transporta/xNome
352
+ pdf.draw_text xml['transporta/xNome'], :size => 7, :at => [-11, 417], :width => 174, :height => 9
353
+
354
+ # textField transp/modFrete
355
+ pdf.draw_text xml['transp/modFrete'], :size => 5, :at => [214, 420], :width => 7, :height => 7
356
+
357
+ # textField veicTransp/RNTC
358
+ pdf.draw_text xml['veicTransp/RNTC'], :size => 5, :at => [227, 417], :width => 69, :height => 9
359
+
360
+ # staticText DATA DA SAÍDA/ENTRADA
361
+ pdf.draw_text "DATA DA SAÍDA/ENTRADA", :size => 5, :at => [474, 563], :width => 69, :height => 7
362
+
363
+ # staticText HORA DE SAÍDA
364
+ pdf.draw_text "HORA DE SAÍDA", :size => 5, :at => [474, 546], :width => 53, :height => 7
365
+
366
+ # staticText INSCRIÇÃO ESTADUAL
367
+ pdf.draw_text "INSCRIÇÃO ESTADUAL", :size => 5, :at => [357, 546], :width => 79, :height => 7
368
+
369
+ # textField $F{NR_IE_DESTINO}
370
+ pdf.draw_text xml['dest/IE'], :size => 7, :at => [357, 537], :width => 111, :height => 9
371
+
372
+ # textField $F{DS_MUNICIPIO_DESTINO}
373
+ pdf.draw_text xml['enderDest/xMun'], :size => 7, :at => [-11, 537], :width => 222, :height => 9
374
+
375
+ # staticText MUNICÍPIO
376
+ pdf.draw_text "MUNICÍPIO", :size => 5, :at => [-11, 546], :width => 107, :height => 7
377
+
378
+ # staticText Número
379
+ pdf.draw_text "Número", :size => 5, :at => [-11, 522], :width => 57, :height => 7
380
+
381
+ # staticText Vencimento
382
+ pdf.draw_text "Vencimento", :size => 5, :at => [53, 522], :width => 56, :height => 7
383
+
384
+ # staticText Valor
385
+ pdf.draw_text "Valor", :size => 5, :at => [116, 522], :width => 55, :height => 7
386
+
387
+ # textField $F{VL_OUTROS}
388
+ pdf.draw_text xml['total/vOutros'], :size => 7, :at => [258, 443], :width => 86, :height => 9
389
+
390
+ # staticText OUTRAS DESPESAS ACESSÓRIAS
391
+ pdf.draw_text "OUTRAS DESPESAS ACESSÓRIAS", :size => 5, :at => [258, 452], :width => 84, :height => 7
392
+
393
+ # textField $F{VL_SEGURO}
394
+ pdf.draw_text xml['total/vSeg'], :size => 7, :at => [79, 443], :width => 83, :height => 9
395
+
396
+ # staticText VALOR DO SEGURO
397
+ pdf.draw_text "VALOR DO SEGURO", :size => 5, :at => [79, 452], :width => 59, :height => 7
398
+
399
+ # staticText DESCONTO
400
+ pdf.draw_text "DESCONTO", :size => 5, :at => [168, 452], :width => 35, :height => 7
401
+
402
+ # textField $F{VL_DESCONTO}
403
+ pdf.draw_text xml['total/vDesc'], :size => 7, :at => [168, 443], :width => 85, :height => 9
404
+
405
+ # staticText VALOR DO FRETE
406
+ pdf.draw_text "VALOR DO FRETE", :size => 5, :at => [-11, 452], :width => 50, :height => 7
407
+
408
+ # textField $F{VL_FRETE}
409
+ pdf.draw_text xml['total/vlFrete'], :size => 7, :at => [-11, 443], :width => 84, :height => 9
410
+
411
+ # textField $F{VL_NF}
412
+ pdf.draw_text xml['total/vNF'], :size => 7, :at => [447, 443], :width => 99, :height => 9
413
+
414
+ # staticText VALOR TOTAL DA NOTA
415
+ pdf.draw_text "VALOR TOTAL DA NOTA", :size => 5, :at => [447, 452], :width => 61, :height => 7
416
+
417
+ # staticText PLACA DO VEÍCULO
418
+ pdf.draw_text "PLACA DO VEÍCULO", :size => 5, :at => [301, 426], :width => 69, :height => 7
419
+
420
+ # staticText CNPJ / CPF
421
+ pdf.draw_text "CNPJ / CPF", :size => 5, :at => [455, 426], :width => 69, :height => 7
422
+
423
+ # textField transporta/CNPJ
424
+ pdf.draw_text xml['transporta/CNPJ'], :size => 7, :at => [455, 417], :width => 92, :height => 9
425
+
426
+ # textField transporta/xMun
427
+ pdf.draw_text xml['transporta/xMun'], :size => 7, :at => [249, 399], :width => 177, :height => 10
428
+
429
+ # staticText
430
+ pdf.draw_text "MUNICÍPIO", :size => 5, :at => [249, 408], :width => 64, :height => 7
431
+
432
+ # textField transporta/xEnder
433
+ pdf.draw_text xml['transporta/xEnder'], :size => 7, :at => [-11, 399], :width => 255, :height => 9
434
+
435
+ # staticText
436
+ pdf.draw_text "ENDEREÇO", :size => 5, :at => [-11, 408], :width => 64, :height => 7
437
+
438
+ # staticText
439
+ pdf.draw_text "QUANTIDADE", :size => 5, :at => [-11, 390], :width => 39, :height => 7
440
+
441
+ # textField vol/qVol
442
+ pdf.draw_text xml['vol/qVol'], :size => 7, :at => [-11, 381], :width => 60, :height => 9
443
+
444
+ # textField vol/esp
445
+ pdf.draw_text xml['vol/esp'], :size => 7, :at => [56, 381], :width => 111, :height => 9
446
+
447
+ # staticText
448
+ pdf.draw_text "ESPÉCIE", :size => 5, :at => [56, 390], :width => 29, :height => 7
449
+
450
+ # staticText
451
+ pdf.draw_text "MARCA", :size => 5, :at => [173, 390], :width => 62, :height => 7
452
+
453
+ # textField vol/marca
454
+ pdf.draw_text xml['vol/marca'], :size => 7, :at => [173, 381], :width => 97, :height => 9
455
+
456
+ # staticText
457
+ pdf.draw_text "NUMERAÇÃO", :size => 5, :at => [280, 390], :width => 62, :height => 7
458
+
459
+ # textField
460
+ pdf.draw_text "", :size => 7, :at => [280, 381], :width => 103, :height => 9
461
+
462
+ # staticText UF
463
+ pdf.draw_text "UF", :size => 5, :at => [432, 408], :width => 14, :height => 7
464
+
465
+ # textField tranporta/UF
466
+ pdf.draw_text xml['tranporta/UF'], :size => 7, :at => [432, 399], :width => 19, :height => 9
467
+
468
+ # textField transporta/IE
469
+ pdf.draw_text xml['transporta/IE'], :size => 7, :at => [456, 399], :width => 91, :height => 9
470
+
471
+ # staticText
472
+ pdf.draw_text "INSCRIÇÃO ESTADUAL", :size => 5, :at => [456, 408], :width => 69, :height => 7
473
+
474
+ # staticText
475
+ pdf.draw_text "PESO BRUTO", :size => 5, :at => [389, 390], :width => 76, :height => 7
476
+
477
+ # textField vol/pesoB
478
+ pdf.draw_text xml['vol/pesoB'], :size => 7, :at => [389, 381], :width => 76, :height => 9
479
+
480
+ # textField 'vol/pesoL'
481
+ pdf.draw_text xml['vol/pesoL'], :size => 7, :at => [470, 381], :width => 77, :height => 9
482
+
483
+ # staticText
484
+ pdf.draw_text "PESO LÍQUIDO", :size => 5, :at => [470, 390], :width => 76, :height => 7
485
+
486
+ # textField transp/pĺaca
487
+ pdf.draw_text xml['transp/pĺaca'], :size => 7, :at => [301, 417], :width => 125, :height => 9
488
+
489
+ # staticText UF
490
+ pdf.draw_text "UF", :size => 5, :at => [432, 426], :width => 8, :height => 7
491
+
492
+ # textField transp/UF
493
+ pdf.draw_text xml['transp/UF'], :size => 7, :at => [432, 417], :width => 18, :height => 9
494
+
495
+ # staticText
496
+ pdf.draw_text "VALOR DO IPI", :size => 5, :at => [350, 452], :width => 43, :height => 7
497
+
498
+ # textField total/vIPI
499
+ pdf.draw_text xml['total/vIPI'], :size => 7, :at => [350, 443], :width => 90, :height => 9
500
+
501
+ # staticText
502
+ pdf.draw_text "DANFE", :size => 10, :at => [267, 689], :width => 58, :height => 12
503
+
504
+ # staticText
505
+ pdf.draw_text "DOCUMENTO AUXILIAR DA NOTA FISCAL ELETRÔNICA", :size => 5, :at => [266, 675], :width => 60, :height => 17
506
+
507
+ # staticText
508
+ pdf.draw_text "0 - ENTRADA 1 - SAÍDA", :size => 5, :at => [272, 659], :width => 34, :height => 14
509
+
510
+ # staticText
511
+ pdf.draw_text "NATUREZA DA OPERAÇÃO", :size => 5, :at => [-11, 626], :width => 107, :height => 7
512
+
513
+ # staticText
514
+ pdf.draw_text "INSCRIÇÃO ESTADUAL", :size => 5, :at => [-11, 608], :width => 69, :height => 7
515
+
516
+ # staticText
517
+ pdf.draw_text "INSC.ESTADUAL DO SUBST. TRIBUTÁRIO", :size => 5, :at => [178, 608], :width => 107, :height => 7
518
+
519
+ # staticText
520
+ pdf.draw_text "CNPJ", :size => 5, :at => [367, 608], :width => 16, :height => 7
521
+
522
+ # textField ide/natOp
523
+ pdf.draw_text xml['ide/natOp'], :size => 7, :at => [-11, 617], :width => 336, :height => 9
524
+
525
+ # textField emit/IE
526
+ pdf.draw_text xml['emit/IE'], :size => 7, :at => [-11, 599], :width => 183, :height => 9
527
+
528
+ # textField emit/IE_ST
529
+ pdf.draw_text xml['emit/IE_ST'], :size => 7, :at => [178, 599], :width => 183, :height => 9
530
+
531
+ # textField emit/CNPJ
532
+ pdf.draw_text xml['emit/CNPJ'], :size => 7, :at => [367, 599], :width => 181, :height => 9
533
+
534
+ # textField ide/dSaiEnt
535
+ pdf.draw_text xml['ide/dSaiEnt'], :size => 5, :at => [314, 664], :width => 5, :height => 6
536
+
537
+ # textField ide/serie
538
+ pdf.draw_text xml['ide/serie'], :size => 6, :at => [287, 643], :width => 38, :height => 7
539
+
540
+ # staticText
541
+ pdf.draw_text "SÉRIE", :size => 6, :at => [268, 643], :width => 19, :height => 7
542
+
543
+ # textField ide/nNF
544
+ pdf.draw_text xml['ide/nNF'], :size => 7, :at => [277, 650], :width => 48, :height => 9
545
+
546
+ # staticText
547
+ pdf.draw_text "DATA DE RECEBIMENTO", :size => 5, :at => [-11, 724], :width => 65, :height => 7
548
+
549
+ # staticText
550
+ pdf.draw_text "IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR", :size => 5, :at => [63, 724], :width => 259, :height => 7
551
+
552
+ # staticText
553
+ pdf.draw_text "NF-e", :size => 9, :at => [446, 738], :width => 102, :height => 12
554
+
555
+ # textField ide/serie
556
+ pdf.draw_text xml['ide/serie'], :size => 7, :at => [472, 719], :width => 76, :height => 9
557
+
558
+ # textField ide/nNF
559
+ pdf.draw_text xml['ide/nNF'], :size => 7, :at => [455, 728], :width => 93, :height => 9
560
+
561
+ # textField
562
+ pdf.draw_text "RECEBEMOS DE " + xml['emit/xNome'] + " OS PRODUTOS CONSTANTES DA NOTA FISCAL INDICADA A BAIXO", :size => 5, :at => [-11, 744], :width => 450, :height => 8
563
+
564
+ # staticText
565
+ pdf.draw_text "SÉRIE", :size => 7, :at => [446, 719], :width => 26, :height => 9
566
+
567
+ # staticText
568
+ pdf.draw_text "CHAVE DE ACESSO", :size => 5, :at => [331, 668], :width => 67, :height => 7
569
+
570
+ # staticText
571
+ pdf.draw_text "FOLHA", :size => 6, :at => [268, 636], :width => 19, :height => 7
572
+
573
+ # textField
574
+ pdf.draw_text " 1 / 1", :size => 6, :at => [287, 636], :width => 9, :height => 7
575
+
576
+ # textField chNFe
577
+ pdf.draw_text xml['chNFe'], :size => 6, :at => [331, 659], :width => 217, :height => 9
578
+
579
+ # staticText
580
+ pdf.draw_text "DADOS DO PRODUTO / SERVIÇO", :size => 5, :at => [-14, 372], :width => 134, :height => 8
581
+
582
+ # staticText
583
+ pdf.draw_text "N°", :size => 7, :at => [268, 650], :width => 10, :height => 9
584
+
585
+ # textField emit/xNome
586
+ pdf.draw_text xml['emit/xNome'], :size => 7, :at => [62, 680], :width => 198, :height => 21
587
+
588
+ # textField enderEmit/xLgr enderEmit/nro
589
+ pdf.draw_text xml['enderEmit/xLgr'] + ", " + xml['enderEmit/nro'], :size => 7, :at => [62, 669], :width => 198, :height => 10
590
+
591
+ # textField enderEmit/xBairro
592
+ pdf.draw_text xml['enderEmit/xBairro'] + " - " + xml['enderEmit/CEP'], :size => 7, :at => [62, 659], :width => 198, :height => 10
593
+
594
+ # textField enderEmit/xMun enderEmit/UF
595
+ pdf.draw_text xml['enderEmit/xMun'] + "/" + xml['enderEmit/UF'], :size => 6, :at => [62, 649], :width => 198, :height => 10
596
+
597
+ # textField enderEmit/fone enderEmit/email
598
+ pdf.draw_text xml['enderEmit/fone'] + " " + xml['enderEmit/email'], :size => 6, :at => [62, 639], :width => 198, :height => 10
599
+
600
+ # textField ide/dSaiEnt
601
+ pdf.draw_text xml['ide/dSaiEnt'], :size => 7, :at => [474, 555], :width => 74, :height => 9
602
+
603
+ # textField ide/dSaiEnt
604
+ pdf.draw_text xml['ide/dSaiEnt'], :size => 7, :at => [474, 537], :width => 74, :height => 9
605
+
606
+ # staticText
607
+ pdf.draw_text "Número", :size => 5, :at => [178, 522], :width => 57, :height => 7
608
+
609
+ # staticText
610
+ pdf.draw_text "Vencimento", :size => 5, :at => [242, 522], :width => 56, :height => 7
611
+
612
+ # staticText
613
+ pdf.draw_text "Valor", :size => 5, :at => [305, 522], :width => 55, :height => 7
614
+
615
+ # staticText
616
+ pdf.draw_text "Número", :size => 5, :at => [367, 522], :width => 57, :height => 7
617
+
618
+ # staticText
619
+ pdf.draw_text "Vencimento", :size => 5, :at => [431, 522], :width => 56, :height => 7
620
+
621
+ # staticText
622
+ pdf.draw_text "Valor", :size => 5, :at => [494, 522], :width => 50, :height => 7
623
+
624
+ # textField infAdic/infCpl
625
+ pdf.draw_text xml['infAdic/infCpl'], :size => 6, :at => [-10, -50], :width => 334, :height => 161
626
+
627
+ # staticText
628
+ pdf.draw_text "DADOS ADICIONAIS", :size => 5, :at => [-14, 121], :width => 134, :height => 7
629
+
630
+ # staticText
631
+ pdf.draw_text "CÁLCULO DO ISSQN", :size => 5, :at => [-14, 150], :width => 134, :height => 8
632
+
633
+ # staticText
634
+ pdf.draw_text "INSCRIÇÃO MUNICIPAL", :size => 5, :at => [-11, 141], :width => 83, :height => 8
635
+
636
+ # staticText
637
+ pdf.draw_text "VALOR TOTAL DOS SERVIÇOS", :size => 5, :at => [100, 141], :width => 103, :height => 8
638
+
639
+ # textField total/vServ
640
+ pdf.draw_text xml['total/vServ'], :size => 7, :at => [100, 130], :width => 138, :height => 10
641
+
642
+ # textField emit/IM
643
+ pdf.draw_text xml['emit/IM'], :size => 7, :at => [-11, 130], :width => 105, :height => 10
644
+
645
+ # staticText
646
+ pdf.draw_text "BASE DE CÁLCULO DO ISSQN", :size => 5, :at => [244, 141], :width => 103, :height => 8
647
+
648
+ # textField total/vBCISS
649
+ pdf.draw_text xml['total/vBCISS'], :size => 7, :at => [244, 130], :width => 138, :height => 10
650
+
651
+ # staticText
652
+ pdf.draw_text "VALOR DO ISSQN", :size => 5, :at => [388, 141], :width => 103, :height => 8
653
+
654
+ # textField total/ISSTot
655
+ pdf.draw_text xml['total/ISSTot'], :size => 7, :at => [388, 130], :width => 159, :height => 10
656
+
657
+ # textField
658
+ pdf.draw_text "", :size => 6, :at => [331, -50], :width => 216, :height => 163
659
+
660
+ # staticText
661
+ pdf.draw_text "RESERVADO AO FISCO", :size => 5, :at => [331, 113], :width => 96, :height => 7
662
+
663
+ # staticText
664
+ pdf.draw_text "INFORMAÇÕES COMPLEMENTARES", :size => 5, :at => [-11, 112], :width => 93, :height => 7
665
+
666
+ end
667
+
668
+ end
669
+
670
+ end
@@ -0,0 +1,11 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = 'ruby_danfe'
3
+ s.version = '0.0.1'
4
+ s.summary = "DANFE generator for Brazilian NFE."
5
+ s.authors = ["Eduardo Rebouças"]
6
+ s.email = 'eduardo.reboucas@gmail.com'
7
+ s.files = ["ruby_danfe.gemspec", "lib/ruby_danfe.rb"]
8
+ s.add_dependency('nokogiri')
9
+ s.add_dependency('prawn')
10
+ s.homepage = 'https://github.com/taxweb/ruby_danfe'
11
+ end
metadata ADDED
@@ -0,0 +1,93 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ruby_danfe
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - "Eduardo Rebou\xC3\xA7as"
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-10-20 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: nokogiri
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 3
29
+ segments:
30
+ - 0
31
+ version: "0"
32
+ type: :runtime
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: prawn
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ none: false
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ hash: 3
43
+ segments:
44
+ - 0
45
+ version: "0"
46
+ type: :runtime
47
+ version_requirements: *id002
48
+ description:
49
+ email: eduardo.reboucas@gmail.com
50
+ executables: []
51
+
52
+ extensions: []
53
+
54
+ extra_rdoc_files: []
55
+
56
+ files:
57
+ - ruby_danfe.gemspec
58
+ - lib/ruby_danfe.rb
59
+ homepage: https://github.com/taxweb/ruby_danfe
60
+ licenses: []
61
+
62
+ post_install_message:
63
+ rdoc_options: []
64
+
65
+ require_paths:
66
+ - lib
67
+ required_ruby_version: !ruby/object:Gem::Requirement
68
+ none: false
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ hash: 3
73
+ segments:
74
+ - 0
75
+ version: "0"
76
+ required_rubygems_version: !ruby/object:Gem::Requirement
77
+ none: false
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ hash: 3
82
+ segments:
83
+ - 0
84
+ version: "0"
85
+ requirements: []
86
+
87
+ rubyforge_project:
88
+ rubygems_version: 1.8.3
89
+ signing_key:
90
+ specification_version: 3
91
+ summary: DANFE generator for Brazilian NFE.
92
+ test_files: []
93
+