Sha256: 8ff7928675e4e54c2a6ee408bfe469c4368fcd43f4d62d30e500ef7e7bbe3e76

Contents?: true

Size: 937 Bytes

Versions: 3

Compression:

Stored size: 937 Bytes

Contents

module BrDanfe
  module DanfeLib
    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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
br_danfe-0.12.1 lib/br_danfe/danfe_lib/issqn.rb
br_danfe-0.12.0 lib/br_danfe/danfe_lib/issqn.rb
br_danfe-0.11.2 lib/br_danfe/danfe_lib/issqn.rb