pais_legacy 2.3.0 → 2.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9b355300b6891c6c5ccdfbe802192224ba7171a1314696429bef0ec1b4723e94
4
- data.tar.gz: 35d5798564db5fd79fee8e17ef8e3670a2e20eaf6bbe9cbb516d42f0d680d45e
3
+ metadata.gz: 8322506aeab63d91f136772bd74a92d2f61812c5140b8d08d2579047f0752ae4
4
+ data.tar.gz: f946642a14eeaa7391479e27d7e4501bc461a498ad613e8ebadb7b78ceede8c4
5
5
  SHA512:
6
- metadata.gz: 1a188ed4744bdfbc2e757fa066bd46fccba0febc74ff673362d248ecd9c5fe0269f58de36af44afde7857a698fb31fb5e07caebfd30088a0ea95f056b8342b32
7
- data.tar.gz: b6b1347dffee8ec977261c52fe19dfbbde73e9c3beed2462950e5951b44b46f8ee3d04d304cf71b7b37fb01b00b6205976deb493e3eb2dfecffab7579d40f7b1
6
+ metadata.gz: f60cb73e9370a79a644b5db148986fe75e47e2e9b9ab1d72f290981def78a6a89483b3f0343bef2d1264ade107a38f4a21976c03e0e2512c3f91fe3c1b7b3b6d
7
+ data.tar.gz: fb60b1f5decdfb688fc1ea01838c1dab60b2000fb161fd0af3571e79bbee9d6cc17b3f0d991ca23f3eedc30f0610afcb9741876c9b9d1772aca168437b9f1669
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PaisLegacy
4
- VERSION = "2.3.0"
4
+ VERSION = "2.3.1"
5
5
  end
data/lib/pais_legacy.rb CHANGED
@@ -184,20 +184,32 @@ module PaisLegacy
184
184
  # --------------------------------------------------------------------------------
185
185
  # General Journals
186
186
  # --------------------------------------------------------------------------------
187
- def self.save_journals(ledger, data)
188
- File.open(journals_file(ledger), "w") do |f|
187
+ #
188
+ # data should be the whole params, which will include the pais_code, dr & cr amounts
189
+ #
190
+ def self.save_journals(ledger_code, data)
191
+ tranno=Pais.lasttrnno_read(ledger_code).to_i
192
+
193
+ File.open(journals_file(ledger_code), "w") do |f|
189
194
  f.write "AutoPost,LastTrnNo,Date,DR,DR_SUB,CR,CR_SUB,Description,Amount\n"
190
195
 
191
- data[:xero].each_with_index do |xero,i|
192
- # Determine if it's a credit/debit transaction
193
- if (amount = data[:dr][i].to_f) > 0
194
- dr_account,dr_sub,cr_account = accounts(data[:pais][i])
195
- else
196
- cr_account,cr_sub,dr_account = accounts(data[:pais][i])
197
- amount = data[:cr][i]
196
+ data[:dr].each_with_index do |d,i|
197
+ if data[:pais][i]
198
+
199
+ # Determine if it's a credit/debit transaction
200
+ if (amount = data[:dr][i].to_f) > 0
201
+ dr_account,dr_sub,cr_account = accounts(data[:pais][i])
202
+ else
203
+ cr_account,cr_sub,dr_account = accounts(data[:pais][i])
204
+ amount = data[:cr][i]
205
+ end
206
+
207
+ tranno += 1
208
+ date = data[:date_to].nil? ? Time.now : Date.parse(data[:date_to])
209
+ date = date.strftime("%d/%m/%Y")
210
+
211
+ f.write "GJ,#{tranno},#{date},#{dr_account},#{dr_sub},#{cr_account},#{cr_sub},#{description(data,i)},#{amount}\n"
198
212
  end
199
-
200
- f.write "GJ,#{Pais.lasttrnno_read(ledger).to_i + 1 + i},#{Time.now.strftime("%d/%m/%Y")},#{dr_account},#{dr_sub},#{cr_account},#{cr_sub},#{description(data,i)},#{amount}\n"
201
213
  end
202
214
  end
203
215
  end
@@ -404,9 +416,15 @@ module PaisLegacy
404
416
  end
405
417
 
406
418
  def self.description(data,i)
407
- xero_description=data[:xero_name][i].gsub(",","_")
408
419
  pais_account = data[:pais][i]
409
- "Auto post (Xero #{xero_description} -> #{pais_account})"
420
+
421
+ if data[:xero_name]
422
+ desc=data[:xero_name][i].gsub(",","_")
423
+ return "Auto post (Xero #{desc} -> #{pais_account})"
424
+ else
425
+ desc=data[:qb_name][i].gsub(",","_")
426
+ return "Auto post (QB #{desc} -> #{pais_account})"
427
+ end
410
428
  end
411
429
 
412
430
  def self.journals_file(ledger)
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: 2.3.0
4
+ version: 2.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Pope
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-12-05 00:00:00.000000000 Z
11
+ date: 2024-03-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: byebug