Sha256: 3a98720441cb8ffbca1a9935b087250d541ce9b34deea5abf71c1e06c432c10c
Contents?: true
Size: 927 Bytes
Versions: 4
Compression:
Stored size: 927 Bytes
Contents
module BrDanfe class Xprod def initialize(det) @det = det end def render xprod = "#{@det.css('prod/xProd').text}" xprod += infAdProd if has_infAdProd? xprod += fci if has_fci? xprod += st if has_st? xprod end private def has_infAdProd? !@det.css("infAdProd").text.empty? end def has_fci? !@det.css("prod/nFCI").text.empty? end def has_st? @det.css("ICMS/*/vBCST").text.to_i > 0 end def infAdProd "\n" + @det.css("infAdProd").text end def fci "\n" + I18n.t("danfe.det.prod.xProdFCI", nFCI: @det.css('prod/nFCI').text) end def st "\n" + I18n.t("danfe.det.prod.xProdST", pMVAST: @det.css('ICMS/*/pMVAST').text, pICMSST: @det.css('ICMS/*/pICMSST').text, vBCST: @det.css('ICMS/*/vBCST').text, vICMSST: @det.css('ICMS/*/vICMSST').text) end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
br_danfe-0.0.5 | lib/br_danfe/xprod.rb |
br_danfe-0.0.4 | lib/br_danfe/xprod.rb |
br_danfe-0.0.3 | lib/br_danfe/xprod.rb |
br_danfe-0.0.2 | lib/br_danfe/xprod.rb |