Sha256: 4b070af8bd763fe6b235cc08f69598f215a34211e44080794b6e41928ce05549

Contents?: true

Size: 1013 Bytes

Versions: 7

Compression:

Stored size: 1013 Bytes

Contents

module BrDanfe
  module DanfeLib
    module NfeLib
      class Issqn
        Y_POSITION = 25.72 + SPACE_BETWEEN_GROUPS

        def initialize(pdf, xml)
          @pdf = pdf
          @xml = xml

          @title = Y_POSITION - 0.42
          @y_position = Y_POSITION

          @serv = 'total/ISSQNtot/vServ'
          @bc = 'total/ISSQNtot/vBC'
          @iss = 'total/ISSQNtot/vISS'
        end

        def render
          if can_render?
            @pdf.ititle 0.42, 10.00, 0.75, @title, 'issqn.title'
            @pdf.lbox LINE_HEIGHT, 4.64, 0.75, @y_position, @xml, 'emit/IM'
            @pdf.lnumeric LINE_HEIGHT, 5.14, 5.39, @y_position, @xml, @serv
            @pdf.lnumeric LINE_HEIGHT, 5.14, 10.53, @y_position, @xml, @bc
            @pdf.lnumeric LINE_HEIGHT, 4.64, 15.67, @y_position, @xml, @iss
          end
        end

        private

        def can_render?
          @xml[@serv].to_i.positive? || @xml[@bc].to_i.positive? || @xml[@iss].to_i.positive?
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
br_danfe-0.14.3 lib/br_danfe/danfe_lib/nfe_lib/issqn.rb
br_danfe-0.14.2 lib/br_danfe/danfe_lib/nfe_lib/issqn.rb
br_danfe-0.14.0 lib/br_danfe/danfe_lib/nfe_lib/issqn.rb
br_danfe-0.13.3 lib/br_danfe/danfe_lib/nfe_lib/issqn.rb
br_danfe-0.13.2 lib/br_danfe/danfe_lib/nfe_lib/issqn.rb
br_danfe-0.13.1 lib/br_danfe/danfe_lib/nfe_lib/issqn.rb
br_danfe-0.13.0 lib/br_danfe/danfe_lib/nfe_lib/issqn.rb