alego_functions 0.0.6
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.
- data/lib/alego_functions.rb +85 -0
- metadata +66 -0
@@ -0,0 +1,85 @@
|
|
1
|
+
module Funcoes
|
2
|
+
|
3
|
+
def self.trata_status(status)
|
4
|
+
|
5
|
+
case status
|
6
|
+
when 1
|
7
|
+
return "FINALIZADO"
|
8
|
+
when 2
|
9
|
+
return "NÃO ENTREGUE"
|
10
|
+
else
|
11
|
+
return "INCOMPLETO"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
def self.trata_valor_check_box(valor_campo)
|
17
|
+
|
18
|
+
if valor_campo == "1"
|
19
|
+
return true
|
20
|
+
else
|
21
|
+
return false
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.build_rghost_doc(modo_layout, margem)
|
27
|
+
|
28
|
+
if modo_layout == "retrato"
|
29
|
+
eixo_x = 0.5
|
30
|
+
eixo_y = 18.8
|
31
|
+
doc = RGhost::Document.new :paper => :A4, :landscape => false, :margin =>[margem,margem,margem,margem]
|
32
|
+
else
|
33
|
+
eixo_x = 0.5
|
34
|
+
eixo_y = 19
|
35
|
+
doc = RGhost::Document.new :paper => :A4, :landscape => true, :margin =>[margem,margem,margem,margem]
|
36
|
+
end
|
37
|
+
|
38
|
+
doc.before_page_create do |chunk|
|
39
|
+
chunk.text_in :x => 28, :y => 19.9, :write => "%current_page%"
|
40
|
+
chunk.image "public/template.eps", :x => 0.8, :y => 0.65 if modo_layout == "retrato"
|
41
|
+
end
|
42
|
+
|
43
|
+
doc.define_tags do
|
44
|
+
tag :hel_normal, :name => 'Helvetica', :size => 10, :color => '#000000'
|
45
|
+
tag :hel_negrito, :name => 'Helvetica-Bold', :size => 10, :color => '#000000'
|
46
|
+
|
47
|
+
tag :hel_normal_destaque, :name => 'Helvetica', :size => 10, :color => '#000000'
|
48
|
+
tag :hel_negrito_destaque, :name => 'Helvetica-Bold', :size => 14, :color => '#000000'
|
49
|
+
tag :hel_negrito_destaque_reduzido, :name => 'Helvetica-Bold', :size => 12, :color => '#000000'
|
50
|
+
|
51
|
+
tag :hel_normal_tit, :name => 'Helvetica', :size => 18, :color => '#000000'
|
52
|
+
tag :hel_negrito_tit, :name => 'Helvetica-Bold', :size => 16, :color => '#000000'
|
53
|
+
|
54
|
+
tag :cour_normal, :name => 'Courier', :size => 10, :color => '#000000'
|
55
|
+
tag :cour_normal_reduzido, :name => 'Courier', :size => 8, :color => '#000000'
|
56
|
+
tag :cour_negrito, :name => 'Courier-Bold', :size => 10, :color => '#000000'
|
57
|
+
tag :cour_negrito_destaque, :name => 'Courier-Bold', :size => 12, :color => '#000000'
|
58
|
+
end
|
59
|
+
|
60
|
+
doc
|
61
|
+
end
|
62
|
+
|
63
|
+
module Data
|
64
|
+
def self.imprimi_data(data)
|
65
|
+
return data.strftime("%d/%m/%Y") unless data.blank?
|
66
|
+
return nil
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
module Moeda
|
71
|
+
|
72
|
+
# include ActionView::Helpers::NumberHelper
|
73
|
+
|
74
|
+
def self.formatar_moeda(valor)
|
75
|
+
return valor if valor == nil
|
76
|
+
|
77
|
+
ActionController::Base.helpers.number_to_currency(valor, :unit => "R$ ", :separator => ",", :delimiter => ".")
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
81
|
+
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
end
|
metadata
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: alego_functions
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 19
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 6
|
10
|
+
version: 0.0.6
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- "Gustavo Gomes da F\xC3\xA9"
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2012-11-22 00:00:00 Z
|
19
|
+
dependencies: []
|
20
|
+
|
21
|
+
description: "Tem a funcionalidade de prover m\xC3\xA9todos prontos de manipula\xC3\xA7\xC3\xA3o de data, moeda e outros"
|
22
|
+
email:
|
23
|
+
- ggomes.fe@gmail.com
|
24
|
+
executables: []
|
25
|
+
|
26
|
+
extensions: []
|
27
|
+
|
28
|
+
extra_rdoc_files: []
|
29
|
+
|
30
|
+
files:
|
31
|
+
- lib/alego_functions.rb
|
32
|
+
homepage: ""
|
33
|
+
licenses: []
|
34
|
+
|
35
|
+
post_install_message:
|
36
|
+
rdoc_options: []
|
37
|
+
|
38
|
+
require_paths:
|
39
|
+
- lib
|
40
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 3
|
46
|
+
segments:
|
47
|
+
- 0
|
48
|
+
version: "0"
|
49
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
hash: 3
|
55
|
+
segments:
|
56
|
+
- 0
|
57
|
+
version: "0"
|
58
|
+
requirements: []
|
59
|
+
|
60
|
+
rubyforge_project: alego_functions
|
61
|
+
rubygems_version: 1.8.23
|
62
|
+
signing_key:
|
63
|
+
specification_version: 3
|
64
|
+
summary: Alego Functions
|
65
|
+
test_files: []
|
66
|
+
|