pais_legacy 2.2.0 → 2.3.1
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 +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8322506aeab63d91f136772bd74a92d2f61812c5140b8d08d2579047f0752ae4
|
4
|
+
data.tar.gz: f946642a14eeaa7391479e27d7e4501bc461a498ad613e8ebadb7b78ceede8c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f60cb73e9370a79a644b5db148986fe75e47e2e9b9ab1d72f290981def78a6a89483b3f0343bef2d1264ade107a38f4a21976c03e0e2512c3f91fe3c1b7b3b6d
|
7
|
+
data.tar.gz: fb60b1f5decdfb688fc1ea01838c1dab60b2000fb161fd0af3571e79bbee9d6cc17b3f0d991ca23f3eedc30f0610afcb9741876c9b9d1772aca168437b9f1669
|
data/lib/pais_legacy/version.rb
CHANGED
data/lib/pais_legacy.rb
CHANGED
@@ -184,20 +184,32 @@ module PaisLegacy
|
|
184
184
|
# --------------------------------------------------------------------------------
|
185
185
|
# General Journals
|
186
186
|
# --------------------------------------------------------------------------------
|
187
|
-
|
188
|
-
|
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[:
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
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
|
@@ -285,15 +297,16 @@ module PaisLegacy
|
|
285
297
|
out
|
286
298
|
end
|
287
299
|
|
288
|
-
def legacy_import_invoice(ledger,date,inv_no)
|
300
|
+
def legacy_import_invoice(ledger,date,inv_no,client)
|
289
301
|
|
290
302
|
date = Date.parse(date).strftime("%d/%m/%Y")
|
291
303
|
|
292
|
-
cmd=PaisLegacy::Pais.ssh + ' "bash -c \"' + PaisLegacy::Pais.fglgo("invo_read") + ' {{ccode}} {{ledger}} {{date}} {{inv_no}}\""'
|
304
|
+
cmd=PaisLegacy::Pais.ssh + ' "bash -c \"' + PaisLegacy::Pais.fglgo("invo_read") + ' {{ccode}} {{ledger}} {{date}} {{inv_no}} {{client}}\""'
|
293
305
|
.gsub("{{ccode}}","T1")
|
294
306
|
.gsub("{{ledger}}",ledger.to_s)
|
295
307
|
.gsub("{{date}}",date)
|
296
308
|
.gsub("{{inv_no}}",inv_no)
|
309
|
+
.gsub("{{client}}",client)
|
297
310
|
|
298
311
|
puts cmd
|
299
312
|
out,_,_=Open3.capture2(cmd)
|
@@ -403,9 +416,15 @@ module PaisLegacy
|
|
403
416
|
end
|
404
417
|
|
405
418
|
def self.description(data,i)
|
406
|
-
xero_description=data[:xero_name][i].gsub(",","_")
|
407
419
|
pais_account = data[:pais][i]
|
408
|
-
|
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
|
409
428
|
end
|
410
429
|
|
411
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.
|
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:
|
11
|
+
date: 2024-03-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: byebug
|
@@ -118,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
118
118
|
- !ruby/object:Gem::Version
|
119
119
|
version: '0'
|
120
120
|
requirements: []
|
121
|
-
rubygems_version: 3.4.
|
121
|
+
rubygems_version: 3.4.22
|
122
122
|
signing_key:
|
123
123
|
specification_version: 4
|
124
124
|
summary: PAIS Legacy API Wrapper
|