Class: SEFAZ::Webservice::NFE::Dataset
- Inherits:
-
Object
- Object
- SEFAZ::Webservice::NFE::Dataset
- Defined in:
- lib/sefaz/webservice/nfe/dataset.rb
Overview
Principal classe de elaboração do XML para o módulo NF-e/NFC-e
Defined Under Namespace
Classes: ADI, ARMA, AUTXML, AVULSA, CANA, CARD, CIDE, COBR, COFINS, COFINSAliq, COFINSNT, COFINSOutr, COFINSQtde, COFINSST, COMB, COMPRA, DEDUC, DEST, DET, DETEXPORT, DETPAG, DI, DUP, EMIT, ENCERRANTE, ENDERDEST, ENDEREMIT, ENTREGA, EXPORTA, EXPORTIND, FAT, FORDIA, ICMS, ICMS00, ICMS10, ICMS20, ICMS30, ICMS40, ICMS51, ICMS60, ICMS70, ICMS90, ICMSPart, ICMSSN101, ICMSSN102, ICMSSN201, ICMSSN202, ICMSSN500, ICMSSN900, ICMSST, ICMSTot, ICMSUFDest, IDE, II, IMPOSTO, IMPOSTODEVOL, INFADIC, INFINTERMED, INFNFESUPL, INFRESPTEC, IPI, IPIDEVOL, IPINT, IPITrib, ISSQN, ISSQNtot, LACRES, MED, NFREF, OBSCONT, OBSFISCO, PAG, PIS, PISAliq, PISNT, PISOutr, PISQtde, PISST, PROCREF, PROD, RASTRO, REBOQUE, RETIRADA, RETTRANSP, RETTrib, TOTAL, TRANSP, TRANSPORTA, VEICPROD, VEICTRANSP, VOL
Instance Attribute Summary collapse
-
#adi ⇒ Object
Returns the value of attribute adi.
-
#arma ⇒ Object
Returns the value of attribute arma.
-
#autXML ⇒ Object
Returns the value of attribute autXML.
-
#avulsa ⇒ Object
Returns the value of attribute avulsa.
-
#cana ⇒ Object
Returns the value of attribute cana.
-
#cobr ⇒ Object
Returns the value of attribute cobr.
-
#compra ⇒ Object
Returns the value of attribute compra.
-
#deduc ⇒ Object
Returns the value of attribute deduc.
-
#dest ⇒ Object
Returns the value of attribute dest.
-
#det ⇒ Object
Returns the value of attribute det.
-
#detExport ⇒ Object
Returns the value of attribute detExport.
-
#detPag ⇒ Object
Returns the value of attribute detPag.
-
#DI ⇒ Object
Returns the value of attribute DI.
-
#dup ⇒ Object
Returns the value of attribute dup.
-
#emit ⇒ Object
Returns the value of attribute emit.
-
#entrega ⇒ Object
Returns the value of attribute entrega.
-
#exporta ⇒ Object
Returns the value of attribute exporta.
-
#forDia ⇒ Object
Returns the value of attribute forDia.
-
#ide ⇒ Object
Returns the value of attribute ide.
-
#infAdic ⇒ Object
Returns the value of attribute infAdic.
-
#infIntermed ⇒ Object
Returns the value of attribute infIntermed.
-
#infNFeSupl ⇒ Object
Returns the value of attribute infNFeSupl.
-
#infRespTec ⇒ Object
Returns the value of attribute infRespTec.
-
#lacres ⇒ Object
Returns the value of attribute lacres.
-
#NFref ⇒ Object
Returns the value of attribute NFref.
-
#obscont ⇒ Object
Returns the value of attribute obscont.
-
#obsfisco ⇒ Object
Returns the value of attribute obsfisco.
-
#procref ⇒ Object
Returns the value of attribute procref.
-
#rastro ⇒ Object
Returns the value of attribute rastro.
-
#reboque ⇒ Object
Returns the value of attribute reboque.
-
#retirada ⇒ Object
Returns the value of attribute retirada.
-
#total ⇒ Object
Returns the value of attribute total.
-
#transp ⇒ Object
Returns the value of attribute transp.
-
#vol ⇒ Object
Returns the value of attribute vol.
Instance Method Summary collapse
- #add(part_name) ⇒ Object
- #gerarNF ⇒ Object
-
#initialize(chaveNF) ⇒ Dataset
constructor
A new instance of Dataset.
- #save(part_name) ⇒ Object
Constructor Details
#initialize(chaveNF) ⇒ Dataset
Returns a new instance of Dataset.
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/sefaz/webservice/nfe/dataset.rb', line 103 def initialize(chaveNF) @versao = "4.00" @chaveNF = chaveNF @ide = IDE.new @ide.NFref = [] @emit = EMIT.new @emit.enderEmit = ENDEREMIT.new @avulsa = AVULSA.new @dest = DEST.new @dest.enderDest = ENDERDEST.new @retirada = RETIRADA.new @entrega = ENTREGA.new @total = TOTAL.new @total.ICMSTot = ICMSTot.new @total.ISSQNtot = ISSQNtot.new @total.retTrib = RETTrib.new @transp = TRANSP.new @transp.transporta = TRANSPORTA.new @transp.retTransp = RETTRANSP.new @transp.veicTransp = VEICTRANSP.new @transp.reboque = [] @transp.vol = [] @cobr = COBR.new @cobr.fat = FAT.new @cobr.dup = [] @pag = PAG.new @pag.detPag = [] @infIntermed = INFINTERMED.new @infAdic = INFADIC.new @infAdic.obsCont = [] @infAdic.obsFisco = [] @infAdic.procRef = [] @exporta = EXPORTA.new @compra = COMPRA.new @cana = CANA.new @cana.forDia = [] @cana.deduc = [] @infRespTec = INFRESPTEC.new @infNFeSupl = INFNFESUPL.new @listas = {} @listas[:autXML] = [] @listas[:det] = [] end |
Instance Attribute Details
#adi ⇒ Object
Returns the value of attribute adi.
9 10 11 |
# File 'lib/sefaz/webservice/nfe/dataset.rb', line 9 def adi @adi end |
#arma ⇒ Object
Returns the value of attribute arma.
9 10 11 |
# File 'lib/sefaz/webservice/nfe/dataset.rb', line 9 def arma @arma end |
#autXML ⇒ Object
Returns the value of attribute autXML.
9 10 11 |
# File 'lib/sefaz/webservice/nfe/dataset.rb', line 9 def autXML @autXML end |
#avulsa ⇒ Object
Returns the value of attribute avulsa.
9 10 11 |
# File 'lib/sefaz/webservice/nfe/dataset.rb', line 9 def avulsa @avulsa end |
#cana ⇒ Object
Returns the value of attribute cana.
9 10 11 |
# File 'lib/sefaz/webservice/nfe/dataset.rb', line 9 def cana @cana end |
#cobr ⇒ Object
Returns the value of attribute cobr.
9 10 11 |
# File 'lib/sefaz/webservice/nfe/dataset.rb', line 9 def cobr @cobr end |
#compra ⇒ Object
Returns the value of attribute compra.
9 10 11 |
# File 'lib/sefaz/webservice/nfe/dataset.rb', line 9 def compra @compra end |
#deduc ⇒ Object
Returns the value of attribute deduc.
9 10 11 |
# File 'lib/sefaz/webservice/nfe/dataset.rb', line 9 def deduc @deduc end |
#dest ⇒ Object
Returns the value of attribute dest.
9 10 11 |
# File 'lib/sefaz/webservice/nfe/dataset.rb', line 9 def dest @dest end |
#det ⇒ Object
Returns the value of attribute det.
9 10 11 |
# File 'lib/sefaz/webservice/nfe/dataset.rb', line 9 def det @det end |
#detExport ⇒ Object
Returns the value of attribute detExport.
9 10 11 |
# File 'lib/sefaz/webservice/nfe/dataset.rb', line 9 def detExport @detExport end |
#detPag ⇒ Object
Returns the value of attribute detPag.
9 10 11 |
# File 'lib/sefaz/webservice/nfe/dataset.rb', line 9 def detPag @detPag end |
#DI ⇒ Object
Returns the value of attribute DI.
9 10 11 |
# File 'lib/sefaz/webservice/nfe/dataset.rb', line 9 def DI @DI end |
#dup ⇒ Object
Returns the value of attribute dup.
9 10 11 |
# File 'lib/sefaz/webservice/nfe/dataset.rb', line 9 def dup @dup end |
#emit ⇒ Object
Returns the value of attribute emit.
9 10 11 |
# File 'lib/sefaz/webservice/nfe/dataset.rb', line 9 def emit @emit end |
#entrega ⇒ Object
Returns the value of attribute entrega.
9 10 11 |
# File 'lib/sefaz/webservice/nfe/dataset.rb', line 9 def entrega @entrega end |
#exporta ⇒ Object
Returns the value of attribute exporta.
9 10 11 |
# File 'lib/sefaz/webservice/nfe/dataset.rb', line 9 def exporta @exporta end |
#forDia ⇒ Object
Returns the value of attribute forDia.
9 10 11 |
# File 'lib/sefaz/webservice/nfe/dataset.rb', line 9 def forDia @forDia end |
#ide ⇒ Object
Returns the value of attribute ide.
9 10 11 |
# File 'lib/sefaz/webservice/nfe/dataset.rb', line 9 def ide @ide end |
#infAdic ⇒ Object
Returns the value of attribute infAdic.
9 10 11 |
# File 'lib/sefaz/webservice/nfe/dataset.rb', line 9 def infAdic @infAdic end |
#infIntermed ⇒ Object
Returns the value of attribute infIntermed.
9 10 11 |
# File 'lib/sefaz/webservice/nfe/dataset.rb', line 9 def infIntermed @infIntermed end |
#infNFeSupl ⇒ Object
Returns the value of attribute infNFeSupl.
9 10 11 |
# File 'lib/sefaz/webservice/nfe/dataset.rb', line 9 def infNFeSupl @infNFeSupl end |
#infRespTec ⇒ Object
Returns the value of attribute infRespTec.
9 10 11 |
# File 'lib/sefaz/webservice/nfe/dataset.rb', line 9 def infRespTec @infRespTec end |
#lacres ⇒ Object
Returns the value of attribute lacres.
9 10 11 |
# File 'lib/sefaz/webservice/nfe/dataset.rb', line 9 def lacres @lacres end |
#NFref ⇒ Object
Returns the value of attribute NFref.
9 10 11 |
# File 'lib/sefaz/webservice/nfe/dataset.rb', line 9 def NFref @NFref end |
#obscont ⇒ Object
Returns the value of attribute obscont.
9 10 11 |
# File 'lib/sefaz/webservice/nfe/dataset.rb', line 9 def obscont @obscont end |
#obsfisco ⇒ Object
Returns the value of attribute obsfisco.
9 10 11 |
# File 'lib/sefaz/webservice/nfe/dataset.rb', line 9 def obsfisco @obsfisco end |
#procref ⇒ Object
Returns the value of attribute procref.
9 10 11 |
# File 'lib/sefaz/webservice/nfe/dataset.rb', line 9 def procref @procref end |
#rastro ⇒ Object
Returns the value of attribute rastro.
9 10 11 |
# File 'lib/sefaz/webservice/nfe/dataset.rb', line 9 def rastro @rastro end |
#reboque ⇒ Object
Returns the value of attribute reboque.
9 10 11 |
# File 'lib/sefaz/webservice/nfe/dataset.rb', line 9 def reboque @reboque end |
#retirada ⇒ Object
Returns the value of attribute retirada.
9 10 11 |
# File 'lib/sefaz/webservice/nfe/dataset.rb', line 9 def retirada @retirada end |
#total ⇒ Object
Returns the value of attribute total.
9 10 11 |
# File 'lib/sefaz/webservice/nfe/dataset.rb', line 9 def total @total end |
#transp ⇒ Object
Returns the value of attribute transp.
9 10 11 |
# File 'lib/sefaz/webservice/nfe/dataset.rb', line 9 def transp @transp end |
#vol ⇒ Object
Returns the value of attribute vol.
9 10 11 |
# File 'lib/sefaz/webservice/nfe/dataset.rb', line 9 def vol @vol end |
Instance Method Details
#add(part_name) ⇒ Object
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 |
# File 'lib/sefaz/webservice/nfe/dataset.rb', line 190 def add(part_name) part_object = case part_name when "NFREF" @NFref = NFREF.new @NFref when "AUTXML" @autXML = AUTXML.new @autXML when "DET" @det = DET.new @det.prod = PROD.new @det.prod.veicProd = VEICPROD.new @det.prod.med = MED.new @det.prod.comb = COMB.new @det.prod.comb.CIDE = CIDE.new @det.prod.comb.encerrante = ENCERRANTE.new @det.prod.DI = [] @det.prod.detExport = [] @det.prod.rastro = [] @det.prod.arma = [] @det.imposto = IMPOSTO.new @det.imposto.ICMS = ICMS.new @det.imposto.ICMS.ICMS00 = ICMS00.new @det.imposto.ICMS.ICMS10 = ICMS10.new @det.imposto.ICMS.ICMS20 = ICMS20.new @det.imposto.ICMS.ICMS30 = ICMS30.new @det.imposto.ICMS.ICMS40 = ICMS40.new @det.imposto.ICMS.ICMS51 = ICMS51.new @det.imposto.ICMS.ICMS60 = ICMS60.new @det.imposto.ICMS.ICMS70 = ICMS70.new @det.imposto.ICMS.ICMS90 = ICMS90.new @det.imposto.ICMS.ICMSPart = ICMSPart.new @det.imposto.ICMS.ICMSST = ICMSST.new @det.imposto.ICMS.ICMSSN101 = ICMSSN101.new @det.imposto.ICMS.ICMSSN102 = ICMSSN102.new @det.imposto.ICMS.ICMSSN201 = ICMSSN201.new @det.imposto.ICMS.ICMSSN202 = ICMSSN202.new @det.imposto.ICMS.ICMSSN500 = ICMSSN500.new @det.imposto.ICMS.ICMSSN900 = ICMSSN900.new @det.imposto.ICMSUFDest = ICMSUFDest.new @det.imposto.IPI = IPI.new @det.imposto.IPI.IPITrib = IPITrib.new @det.imposto.IPI.IPINT = IPINT.new @det.imposto.II = II.new @det.imposto.PIS = PIS.new @det.imposto.PIS.PISAliq = PISAliq.new @det.imposto.PIS.PISQtde = PISQtde.new @det.imposto.PIS.PISNT = PISNT.new @det.imposto.PIS.PISOutr = PISOutr.new @det.imposto.PISST = PISST.new @det.imposto.COFINS = COFINS.new @det.imposto.COFINS.COFINSAliq = COFINSAliq.new @det.imposto.COFINS.COFINSQtde = COFINSQtde.new @det.imposto.COFINS.COFINSNT = COFINSNT.new @det.imposto.COFINS.COFINSOutr = COFINSOutr.new @det.imposto.COFINSST = COFINSST.new @det.imposto.ISSQN = ISSQN.new @det.impostoDevol = IMPOSTODEVOL.new @det.impostoDevol.IPI = IPIDEVOL.new @det when "DI" @DI = DI.new @DI.adi = [] @DI when "ADI" @adi = ADI.new @adi when "DETEXPORT" @detExport = DETEXPORT.new @detExport.exportInd = EXPORTIND.new @detExport when "RASTRO" @rastro = RASTRO.new @rastro when "ARMA" @arma = ARMA.new @arma when "REBOQUE" @reboque = REBOQUE.new @reboque when "VOL" @vol = VOL.new @vol.lacres = [] @vol when "LACRES" @lacres = LACRES.new @lacres when "DUP" @dup = DUP.new @dup when "DETPAG" @detPag = DETPAG.new @detPag.card = CARD.new @detPag when "OBSCONT" @obscont = OBSCONT.new @obscont when "OBSFISCO" @obsfisco = OBSFISCO.new @obsfisco when "PROCREF" @procref = PROCREF.new @procref when "FORDIA" @forDia = FORDIA.new @forDia when "DEDUC" @deduc = DEDUC.new @deduc end if block_given? yield(part_object) save(part_name) end nil end |
#gerarNF ⇒ Object
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
# File 'lib/sefaz/webservice/nfe/dataset.rb', line 149 def gerarNF # Raiz = NFe # A01 = infNFe # H01 = det # I01 = prod # M01 = imposto # N01 = ICMS hash = { NFe: { :@xmlns => "http://www.portalfiscal.inf.br/nfe", infNFe: { :@Id => ("NFe" + @chaveNF.to_s), :@versao => @versao } } } hash[:NFe][:infNFe][:ide] = @ide.to_h hash[:NFe][:infNFe][:emit] = @emit.to_h hash[:NFe][:infNFe][:emit][:enderEmit] = @emit.enderEmit.to_h hash[:NFe][:infNFe][:avulsa] = @avulsa.to_h hash[:NFe][:infNFe][:dest] = @dest.to_h hash[:NFe][:infNFe][:dest][:enderDest] = @dest.enderDest.to_h hash[:NFe][:infNFe][:retirada] = @retirada.to_h hash[:NFe][:infNFe][:entrega] = @entrega.to_h hash[:NFe][:infNFe][:autXML] = @listas[:autXML] hash[:NFe][:infNFe][:det] = @listas[:det] hash[:NFe][:infNFe][:total] = @total.to_h hash[:NFe][:infNFe][:total][:ICMSTot] = @total.ICMSTot.to_h hash[:NFe][:infNFe][:total][:ISSQNtot] = @total.ISSQNtot.to_h hash[:NFe][:infNFe][:total][:retTrib] = @total.retTrib.to_h hash[:NFe][:infNFe][:transp] = @transp.to_h hash[:NFe][:infNFe][:transp][:transporta] = @transp.transporta.to_h hash[:NFe][:infNFe][:transp][:retTransp] = @transp.retTransp.to_h hash[:NFe][:infNFe][:transp][:veicTransp] = @transp.veicTransp.to_h hash[:NFe][:infNFe][:cobr] = @cobr.to_h hash[:NFe][:infNFe][:cobr][:fat] = @cobr.fat.to_h hash[:NFe][:infNFe][:pag] = @pag.to_h hash[:NFe][:infNFe][:infIntermed] = @infIntermed.to_h hash[:NFe][:infNFe][:infAdic] = @infAdic.to_h hash[:NFe][:infNFe][:exporta] = @exporta.to_h hash[:NFe][:infNFe][:compra] = @compra.to_h hash[:NFe][:infNFe][:cana] = @cana.to_h hash[:NFe][:infNFe][:infRespTec] = @infRespTec.to_h hash[:NFe][:infNFeSupl] = @infNFeSupl.to_h compressed = hash.compress! return [compressed.to_xml!, compressed] end |
#save(part_name) ⇒ Object
309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 |
# File 'lib/sefaz/webservice/nfe/dataset.rb', line 309 def save(part_name) case part_name when "NFREF" if @ide.is_a?(Struct::IDE) && @NFref.is_a?(Struct::NFREF) case @NFref.mod when "01", "02" @ide.NFref.push({ refNF: { cUF: @NFref.cUF, AAMM: @NFref.AAMM, CNPJ: @NFref.CNPJ, mod: @NFref.mod, serie: @NFref.serie, nNF: @NFref.nNF } }) when "04" @ide.NFref.push({ refNFP: { cUF: @NFref.cUF, AAMM: @NFref.AAMM, CNPJ: @NFref.CNPJ, CPF: @NFref.CPF, IE: @NFref.IE, mod: @NFref.mod, serie: @NFref.serie, nNF: @NFref.nNF, refCTe: @NFref.refCTe } }) when "2B", "2C", "2D" @ide.NFref.push({ refECF: { mod: @NFref.mod, nECF: @NFref.nECF, nCOO: @NFref.nCOO } }) else @ide.NFref.push({ refNFe: @NFref.refNFe }) end end when "AUTXML" if @autXML.is_a?(Struct::AUTXML) @listas[:autXML].push(@autXML.to_h) end when "DET" if @det.is_a?(Struct::DET) item = @det item.prod.veicProd = item.prod.veicProd.to_h item.prod.med = item.prod.med.to_h item.prod.comb.encerrante = item.prod.comb.encerrante.to_h item.prod.comb.CIDE = item.prod.comb.CIDE.to_h item.prod.comb = item.prod.comb.to_h item.prod = item.prod.to_h item.imposto.ICMS.ICMS00 = item.imposto.ICMS.ICMS00.to_h item.imposto.ICMS.ICMS10 = item.imposto.ICMS.ICMS10.to_h item.imposto.ICMS.ICMS20 = item.imposto.ICMS.ICMS20.to_h item.imposto.ICMS.ICMS30 = item.imposto.ICMS.ICMS30.to_h item.imposto.ICMS.ICMS40 = item.imposto.ICMS.ICMS40.to_h item.imposto.ICMS.ICMS51 = item.imposto.ICMS.ICMS51.to_h item.imposto.ICMS.ICMS60 = item.imposto.ICMS.ICMS60.to_h item.imposto.ICMS.ICMS70 = item.imposto.ICMS.ICMS70.to_h item.imposto.ICMS.ICMS90 = item.imposto.ICMS.ICMS90.to_h item.imposto.ICMS.ICMSPart = item.imposto.ICMS.ICMSPart.to_h item.imposto.ICMS.ICMSST = item.imposto.ICMS.ICMSST.to_h item.imposto.ICMS.ICMSSN101 = item.imposto.ICMS.ICMSSN101.to_h item.imposto.ICMS.ICMSSN102 = item.imposto.ICMS.ICMSSN102.to_h item.imposto.ICMS.ICMSSN201 = item.imposto.ICMS.ICMSSN201.to_h item.imposto.ICMS.ICMSSN202 = item.imposto.ICMS.ICMSSN202.to_h item.imposto.ICMS.ICMSSN500 = item.imposto.ICMS.ICMSSN500.to_h item.imposto.ICMS.ICMSSN900 = item.imposto.ICMS.ICMSSN900.to_h item.imposto.ICMS = item.imposto.ICMS.to_h item.imposto.ICMSUFDest = item.imposto.ICMSUFDest.to_h item.imposto.IPI.IPITrib = item.imposto.IPI.IPITrib.to_h item.imposto.IPI.IPINT = item.imposto.IPI.IPINT.to_h item.imposto.IPI = item.imposto.IPI.to_h item.imposto.II = item.imposto.II.to_h item.imposto.PIS.PISAliq = item.imposto.PIS.PISAliq.to_h item.imposto.PIS.PISQtde = item.imposto.PIS.PISQtde.to_h item.imposto.PIS.PISNT = item.imposto.PIS.PISNT.to_h item.imposto.PIS.PISOutr = item.imposto.PIS.PISOutr.to_h item.imposto.PIS = item.imposto.PIS.to_h item.imposto.PISST = item.imposto.PISST.to_h item.imposto.COFINS.COFINSAliq = item.imposto.COFINS.COFINSAliq.to_h item.imposto.COFINS.COFINSQtde = item.imposto.COFINS.COFINSQtde.to_h item.imposto.COFINS.COFINSNT = item.imposto.COFINS.COFINSNT.to_h item.imposto.COFINS.COFINSOutr = item.imposto.COFINS.COFINSOutr.to_h item.imposto.COFINS = item.imposto.COFINS.to_h item.imposto.COFINSST = item.imposto.COFINSST.to_h item.imposto.ISSQN = item.imposto.ISSQN.to_h item.imposto = item.imposto.to_h item.impostoDevol.IPI = item.impostoDevol.IPI.to_h item.impostoDevol = item.impostoDevol.to_h item[:@nItem] = (@listas[:det].length + 1) @listas[:det].push(item.to_h) end when "DI" if @det.is_a?(Struct::DET) && @DI.is_a?(Struct::DI) @det.prod.DI.push(@DI.to_h) end when "ADI" if @DI.is_a?(Struct::DI) && @adi.is_a?(Struct::ADI) @DI.adi.push(@adi.to_h) end when "DETEXPORT" if @det.is_a?(Struct::DET) && @detExport.is_a?(Struct::DETEXPORT) item = @detExport item.exportInd = item.exportInd.to_h @det.prod.detExport.push(item.to_h) end when "RASTRO" if @det.is_a?(Struct::DET) && @rastro.is_a?(Struct::RASTRO) @det.prod.rastro.push(@rastro.to_h) end when "ARMA" if @det.is_a?(Struct::DET) && @arma.is_a?(Struct::ARMA) @det.prod.arma.push(@arma.to_h) end when "REBOQUE" if @transp.is_a?(Struct::TRANSP) && @reboque.is_a?(Struct::REBOQUE) @transp.reboque.push(@reboque.to_h) end when "VOL" if @transp.is_a?(Struct::TRANSP) && @vol.is_a?(Struct::VOL) @transp.vol.push(@vol.to_h) end when "LACRES" if @vol.is_a?(Struct::VOL) && @lacres.is_a?(Struct::LACRES) @vol.lacres.push(@lacres.to_h) end when "DUP" if @cobr.is_a?(Struct::COBR) && @dup.is_a?(Struct::DUP) @cobr.dup.push(@dup.to_h) end when "DETPAG" if @pag.is_a?(Struct::PAG) && @detPag.is_a?(Struct::DETPAG) item = @detPag item.card = item.card.to_h @pag.detPag.push(item.to_h) end when "OBSCONT" if @infAdic.is_a?(Struct::INFADIC) && @obscont.is_a?(Struct::OBSCONT) @infAdic.obsCont.push(@obscont.to_h) end when "OBSFISCO" if @infAdic.is_a?(Struct::INFADIC) && @obsfisco.is_a?(Struct::OBSFISCO) @infAdic.obsFisco.push(@obsfisco.to_h) end when "PROCREF" if @infAdic.is_a?(Struct::INFADIC) && @procref.is_a?(Struct::PROCREF) @infAdic.procRef.push(@procref.to_h) end when "FORDIA" if @cana.is_a?(Struct::CANA) && @forDia.is_a?(Struct::FORDIA) @cana.forDia.push(@forDia.to_h) end when "DEDUC" if @cana.is_a?(Struct::CANA) && @deduc.is_a?(Struct::DEDUC) @cana.deduc.push(@deduc.to_h) end end nil end |