pais_legacy 2.3.0 → 2.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pais_legacy/version.rb +1 -1
- data/lib/pais_legacy.rb +34 -15
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80d3bf298ea14b2a10e1c6836fe75114ca064483b4cc036d53e865de2ef2f6b7
|
4
|
+
data.tar.gz: 6c6e5b411054963d38f348dd3398ce46499dbe66ad3264d0c9404213829c89ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41d422b278734b5659d236993035d608256a7ff10b7a097304c9ce71cdde95cf764feace2755eed1d4cadc8a6c9a87b5ba1bc7343b8afba394380ec83a027146
|
7
|
+
data.tar.gz: 3b4a88414f785148322d1fae0436fb5319210c1f388e8b7256e262be96e3db4cc6d25481c174cea9572fa052e556650761b8a5cf204cfd85cf37c33e5966bd57
|
data/lib/pais_legacy/version.rb
CHANGED
data/lib/pais_legacy.rb
CHANGED
@@ -15,7 +15,8 @@ module PaisLegacy
|
|
15
15
|
SERVER="192.168.200.4"
|
16
16
|
SUSPENSE_ACCOUNT=1599
|
17
17
|
CLEARING_ACCOUNT=5199
|
18
|
-
|
18
|
+
TB_DIRECT_ACCOUNT=8999
|
19
|
+
|
19
20
|
# --------------------------------------------------------------------------------
|
20
21
|
# Client
|
21
22
|
# --------------------------------------------------------------------------------
|
@@ -184,20 +185,32 @@ module PaisLegacy
|
|
184
185
|
# --------------------------------------------------------------------------------
|
185
186
|
# General Journals
|
186
187
|
# --------------------------------------------------------------------------------
|
187
|
-
|
188
|
-
|
188
|
+
#
|
189
|
+
# data should be the whole params, which will include the pais_code, dr & cr amounts
|
190
|
+
#
|
191
|
+
def self.save_journals(ledger_code, data)
|
192
|
+
tranno=Pais.lasttrnno_read(ledger_code).to_i
|
193
|
+
|
194
|
+
File.open(journals_file(ledger_code), "w") do |f|
|
189
195
|
f.write "AutoPost,LastTrnNo,Date,DR,DR_SUB,CR,CR_SUB,Description,Amount\n"
|
190
196
|
|
191
|
-
data[:
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
197
|
+
data[:dr].each_with_index do |d,i|
|
198
|
+
if data[:pais][i]
|
199
|
+
|
200
|
+
# Determine if it's a credit/debit transaction
|
201
|
+
if (amount = data[:dr][i].to_f) > 0
|
202
|
+
dr_account,dr_sub,cr_account = accounts(data[:pais][i])
|
203
|
+
else
|
204
|
+
cr_account,cr_sub,dr_account = accounts(data[:pais][i])
|
205
|
+
amount = data[:cr][i]
|
206
|
+
end
|
207
|
+
|
208
|
+
tranno += 1
|
209
|
+
date = data[:date_to].nil? ? Time.now : Date.parse(data[:date_to])
|
210
|
+
date = date.strftime("%d/%m/%Y")
|
211
|
+
|
212
|
+
f.write "GJ,#{tranno},#{date},#{dr_account},#{dr_sub},#{cr_account},#{cr_sub},#{description(data,i)},#{amount}\n"
|
198
213
|
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
214
|
end
|
202
215
|
end
|
203
216
|
end
|
@@ -394,7 +407,7 @@ module PaisLegacy
|
|
394
407
|
private
|
395
408
|
def self.accounts(account)
|
396
409
|
account = account.split("/")
|
397
|
-
acc = account[0] ? account[0] :
|
410
|
+
acc = account[0] ? account[0] : TB_DIRECT_ACCOUNT
|
398
411
|
sub=account[1] if account.count > 1
|
399
412
|
return acc,sub,CLEARING_ACCOUNT
|
400
413
|
end
|
@@ -404,9 +417,15 @@ module PaisLegacy
|
|
404
417
|
end
|
405
418
|
|
406
419
|
def self.description(data,i)
|
407
|
-
xero_description=data[:xero_name][i].gsub(",","_")
|
408
420
|
pais_account = data[:pais][i]
|
409
|
-
|
421
|
+
|
422
|
+
if data[:xero_name]
|
423
|
+
desc=data[:xero_name][i].gsub(",","_")
|
424
|
+
return "Auto post (Xero #{desc} -> #{pais_account})"
|
425
|
+
else
|
426
|
+
desc=data[:qb_name][i].gsub(",","_")
|
427
|
+
return "Auto post (QB #{desc} -> #{pais_account})"
|
428
|
+
end
|
410
429
|
end
|
411
430
|
|
412
431
|
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.
|
4
|
+
version: 2.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Pope
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-03-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: byebug
|