pais_legacy 0.7.3 → 0.8.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5b496387ce9501c23013c41290109066221001c3552ab3dd0a62c44d9a945525
4
- data.tar.gz: e2e21539c7880bff7dd7ebf65ba8d6f54887a9964e709f268069ece43cf6ae24
3
+ metadata.gz: d7f71fbd3eceb5dd043930b54a7ff888a2fd84f155f05fc390e97858e0795996
4
+ data.tar.gz: 4ce98be313a4ff502b883b514b28dbd99b9685c6c32af9fa0afce1a5e1350dd6
5
5
  SHA512:
6
- metadata.gz: 3816b70e9ec64b3850fe97a114f4764a6dcaeda784128cdf21fc0aa7514a0e505f40111ee27c2d5c02e5635422d05b5277155f155faa6551bbd1e65faeaa58fc
7
- data.tar.gz: e79d5face0e97c1cf1a3de8c2897b64c8ef1893968af61286c6b6e78fe3bc2534183a7906522e7c596fdc2918c7c5e847e70a0654bc11cce2ffa5c856bcb5860
6
+ metadata.gz: 15983c44b7da82bd1adcd46bab38e242b82e8c9809b4bd7a86bde4e924c7d4b541fb6ccad582f2dfc9d7e05aab31a207c179448b8cccd6fbb30e7632eaae9407
7
+ data.tar.gz: 97aba9598c0fde93f305f41b15eccd8f67cffa71c6f2063aaeddebbd13e32e1eea53edff7e1311630172a0856f3ac5ef5a73e86dc5c93932125449f46d4cd945
data/Gemfile.lock CHANGED
@@ -13,11 +13,11 @@ GEM
13
13
  specs:
14
14
  ast (2.4.2)
15
15
  byebug (11.1.3)
16
- json (2.6.2)
17
- minitest (5.16.3)
16
+ json (2.6.3)
17
+ minitest (5.17.0)
18
18
  mocha (1.16.1)
19
19
  parallel (1.22.1)
20
- parser (3.1.2.1)
20
+ parser (3.2.0.0)
21
21
  ast (~> 2.4.1)
22
22
  pastel (0.8.0)
23
23
  tty-color (~> 0.5)
@@ -25,22 +25,22 @@ GEM
25
25
  rake (13.0.6)
26
26
  regexp_parser (2.6.1)
27
27
  rexml (3.2.5)
28
- rubocop (1.39.0)
28
+ rubocop (1.43.0)
29
29
  json (~> 2.3)
30
30
  parallel (~> 1.10)
31
- parser (>= 3.1.2.1)
31
+ parser (>= 3.2.0.0)
32
32
  rainbow (>= 2.2.2, < 4.0)
33
33
  regexp_parser (>= 1.8, < 3.0)
34
34
  rexml (>= 3.2.5, < 4.0)
35
- rubocop-ast (>= 1.23.0, < 2.0)
35
+ rubocop-ast (>= 1.24.1, < 2.0)
36
36
  ruby-progressbar (~> 1.7)
37
- unicode-display_width (>= 1.4.0, < 3.0)
38
- rubocop-ast (1.23.0)
37
+ unicode-display_width (>= 2.4.0, < 3.0)
38
+ rubocop-ast (1.24.1)
39
39
  parser (>= 3.1.1.0)
40
40
  ruby-progressbar (1.11.0)
41
- timecop (0.9.5)
41
+ timecop (0.9.6)
42
42
  tty-color (0.6.0)
43
- unicode-display_width (2.3.0)
43
+ unicode-display_width (2.4.2)
44
44
 
45
45
  PLATFORMS
46
46
  x86_64-linux
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PaisLegacy
4
- VERSION = "0.7.3"
4
+ VERSION = "0.8.0"
5
5
  end
data/lib/pais_legacy.rb CHANGED
@@ -51,8 +51,12 @@ module PaisLegacy
51
51
  # --------------------------------------------------------------------------------
52
52
  # Trial Balance
53
53
  # --------------------------------------------------------------------------------
54
- def self.get_trial_balance(ledger = "1", date_to = "30/06/2021", from=1,to=9999)
55
- cmd=rptrun(ledger,date_to,from,to)
54
+ def self.get_trial_balance(ledger = "1", date_to = "30/06/2021",prior=false,from=1,to=9999)
55
+ if prior
56
+ cmd=rptrun(ledger,date_to,from,to,"rglch01p")
57
+ else
58
+ cmd=rptrun(ledger,date_to,from,to)
59
+ end
56
60
  out,_,_=Open3.capture2(cmd)
57
61
 
58
62
  if from and to
@@ -67,10 +71,36 @@ module PaisLegacy
67
71
  end
68
72
 
69
73
  # Get the accounts using the trial balance
70
- def self.get_trial_balance_accounts(ledger = "1", date_to = "30/06/2021", from=1,to=9999)
71
- report = get_trial_balance(ledger,date_to,from,to)
72
- tb = PaisLegacy::TrialBalance.new(report)
73
- tb.accounts_from_trial_balance
74
+ def self.get_trial_balance_accounts(ledger = "1", date_to = "30/06/2021", periods=1,from=1,to=9999)
75
+
76
+ results = []
77
+
78
+ periods.times do |period|
79
+
80
+ date_to = Date.parse(date_to)
81
+ date_to = date_to.strftime("%d/%m/") + (date_to.year.to_i - period).to_s
82
+
83
+ report = get_trial_balance(ledger,date_to,period>0,from,to)
84
+ tb = PaisLegacy::TrialBalance.new(report)
85
+ results << tb.accounts_from_trial_balance
86
+ end
87
+
88
+ results_merged = []
89
+ results.each_with_index do |result,i|
90
+ if i == 0
91
+ results_merged = result
92
+ else
93
+ result.each do |account|
94
+ hash=results_merged.find {|r| r[:code] == account[:code]}
95
+
96
+ hash = {code: account[:code], name: account[:name]} unless hash
97
+ hash["dr#{i}".to_sym] = account[:dr]
98
+ hash["cr#{i}".to_sym] = account[:cr]
99
+ end
100
+ end
101
+ end
102
+
103
+ results_merged
74
104
  end
75
105
 
76
106
  # --------------------------------------------------------------------------------
data/readme.org CHANGED
@@ -99,6 +99,14 @@ After checking out the repo, run `bin/setup` to install dependencies. You can al
99
99
 
100
100
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
101
101
 
102
+ *** Publish version
103
+ 1. Adjust lib/pais_legacy/version.rb
104
+ 2. Commit changes 'Bump <version number>'
105
+ 3. Gem build
106
+ : gem build pais_legacy.gemspec
107
+ 4. Push
108
+ : gem push pais_legacy-0.7.3.gem
109
+
102
110
  ** Contributing
103
111
 
104
112
  Bug reports and pull requests are welcome on GitHub at https://github.com/map7/pais_legacy.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pais_legacy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.3
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Pope
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-11-22 00:00:00.000000000 Z
11
+ date: 2023-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: byebug