rs.ge 0.0.15 → 0.0.16
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/.gitignore +2 -1
- data/lib/rs/version.rb +1 -1
- data/lib/rs/waybill.rb +12 -1
- data/problems.md +1 -0
- data/spec/rs/dict_spec.rb +10 -10
- data/spec/rs/sys_spec.rb +8 -1
- data/spec/rs/waybill_delete_spec.rb +2 -2
- data/spec/rs/waybill_invoice_spec.rb +2 -0
- data/spec/rs/waybill_spec.rb +10 -0
- data/spec/rs/waybill_validation_spec.rb +3 -0
- data/spec/spec_helper.rb +4 -2
- data/tmp/waybill.pdf +27 -27
- metadata +3 -5
- data/spec/rs/invoice2_spec.rb +0 -27
- data/test.rb +0 -185
data/.gitignore
CHANGED
data/lib/rs/version.rb
CHANGED
data/lib/rs/waybill.rb
CHANGED
@@ -26,7 +26,7 @@ module RS
|
|
26
26
|
|
27
27
|
# ეს არის ზედნადების ხაზი საქონლისთვის.
|
28
28
|
class WaybillItem
|
29
|
-
attr_accessor :id, :prod_name, :unit_id, :unit_name, :quantity, :price, :bar_code, :excise_id
|
29
|
+
attr_accessor :id, :prod_name, :unit_id, :unit_name, :quantity, :price, :bar_code, :excise_id, :vat_type
|
30
30
|
|
31
31
|
# აბრუნებს ამ ხაზის XML წარმოდგენას.
|
32
32
|
# @param xml XML builder-ის კლასი
|
@@ -41,6 +41,7 @@ module RS
|
|
41
41
|
b.AMOUNT self.quantity * self.price
|
42
42
|
b.BAR_CODE self.bar_code
|
43
43
|
b.A_ID (self.excise_id ? self.excise_id : 0)
|
44
|
+
b.VAT_TYPE (self.vat_type || Waybill::VAT_COMMON)
|
44
45
|
end
|
45
46
|
end
|
46
47
|
|
@@ -106,6 +107,12 @@ module RS
|
|
106
107
|
STATUS_SAVED = 0
|
107
108
|
STATUS_ACTIVE = 1
|
108
109
|
STATUS_CLOSED = 2
|
110
|
+
# ჩვეულებრივი
|
111
|
+
VAT_COMMON = 0
|
112
|
+
# ნულოვანი
|
113
|
+
VAT_ZERO = 1
|
114
|
+
# დაუბეგრავი
|
115
|
+
VAT_NONE = 2
|
109
116
|
attr_accessor :id, :type, :status, :parent_id, :number
|
110
117
|
attr_accessor :seller_id # გამყიდველის უნიკალური კოდი
|
111
118
|
attr_accessor :seller_tin, :seller_name
|
@@ -289,6 +296,10 @@ module RS
|
|
289
296
|
if self.end_address.nil? or self.end_address.strip.empty?
|
290
297
|
RS.append_validation_error(@validation_errors, :end_address, 'საბოლოო მისამართი განუსაზღვრელია')
|
291
298
|
end
|
299
|
+
if not self.start_address.nil? and not self.end_address.nil? and
|
300
|
+
self.start_address.strip != self.end_address.strip and self.type == RS::WaybillType::WITHOUT_TRANSPORTATION
|
301
|
+
RS.append_validation_error(@validation_errors, :type, '"ტრანსპორტირების გარეშე" დაუშვებელია, როდესაც საწყისი მისამართი არ ემთხვევა საბოლოოს.')
|
302
|
+
end
|
292
303
|
end
|
293
304
|
|
294
305
|
# საქონლის პოზიციების შემოწმება
|
data/problems.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# არსებობს სისტემაში მომხმარებელი, რომელსაც IP არ აქვს მითითებული. ეს რას ნიშნავს?
|
data/spec/rs/dict_spec.rb
CHANGED
@@ -132,21 +132,21 @@ end
|
|
132
132
|
|
133
133
|
describe 'get bar codes' do
|
134
134
|
before(:all) do
|
135
|
-
RS.save_bar_code(RS.su_params.merge({'bar_code' => '
|
136
|
-
RS.save_bar_code(RS.su_params.merge({'bar_code' => '
|
135
|
+
RS.save_bar_code(RS.su_params.merge({'bar_code' => 'rs_TV1', 'prod_name' => 'tv set 1', 'unit_id' => RS::WaybillUnit::OTHERS, 'unit_name' => 'box'}))
|
136
|
+
RS.save_bar_code(RS.su_params.merge({'bar_code' => 'rs_TV2', 'prod_name' => 'tv set 2', 'unit_id' => RS::WaybillUnit::OTHERS, 'unit_name' => 'box'}))
|
137
137
|
end
|
138
138
|
context "look up first code" do
|
139
139
|
before(:all) do
|
140
|
-
@codes = RS.get_bar_codes(RS.su_params.merge({'bar_code' => '
|
140
|
+
@codes = RS.get_bar_codes(RS.su_params.merge({'bar_code' => 'rs_TV1'}))
|
141
141
|
end
|
142
142
|
subject { @codes }
|
143
143
|
it { should_not be_nil }
|
144
144
|
it { should_not be_empty }
|
145
145
|
its(:size) { should == 1 }
|
146
|
-
context '
|
146
|
+
context 'rs_TV1 bar code' do
|
147
147
|
subject { @codes.first }
|
148
148
|
it { should be_instance_of RS::BarCode }
|
149
|
-
its(:code) { should == '
|
149
|
+
its(:code) { should == 'rs_TV1' }
|
150
150
|
its(:name) { should == 'tv set 1' }
|
151
151
|
its(:unit_id) { should == RS::WaybillUnit::OTHERS }
|
152
152
|
its(:excise_id) { should be_nil }
|
@@ -154,24 +154,24 @@ describe 'get bar codes' do
|
|
154
154
|
end
|
155
155
|
context "lookup both codes" do
|
156
156
|
before(:all) do
|
157
|
-
@codes = RS.get_bar_codes(RS.su_params.merge({'bar_code' => '
|
157
|
+
@codes = RS.get_bar_codes(RS.su_params.merge({'bar_code' => 'rs_TV'}))
|
158
158
|
end
|
159
159
|
subject { @codes }
|
160
160
|
it { should_not be_nil }
|
161
161
|
it { should_not be_empty }
|
162
162
|
its(:size) { should == 2 }
|
163
|
-
context '
|
163
|
+
context 'rs_TV1 bar code' do
|
164
164
|
subject { @codes.first }
|
165
165
|
it { should be_instance_of RS::BarCode }
|
166
|
-
its(:code) { should == '
|
166
|
+
its(:code) { should == 'rs_TV1' }
|
167
167
|
its(:name) { should == 'tv set 1' }
|
168
168
|
its(:unit_id) { should == RS::WaybillUnit::OTHERS }
|
169
169
|
its(:excise_id) { should be_nil }
|
170
170
|
end
|
171
|
-
context '
|
171
|
+
context 'rs_TV2 bar code' do
|
172
172
|
subject { @codes[1] }
|
173
173
|
it { should be_instance_of RS::BarCode }
|
174
|
-
its(:code) { should == '
|
174
|
+
its(:code) { should == 'rs_TV2' }
|
175
175
|
its(:name) { should == 'tv set 2' }
|
176
176
|
its(:unit_id) { should == RS::WaybillUnit::OTHERS }
|
177
177
|
its(:excise_id) { should be_nil }
|
data/spec/rs/sys_spec.rb
CHANGED
@@ -16,11 +16,18 @@ describe 'get service users' do
|
|
16
16
|
before(:all) do
|
17
17
|
@org = RS::TEST_ORG1
|
18
18
|
@users = RS.get_service_users(RS.auth_params)
|
19
|
+
@user = nil
|
20
|
+
@users.each do |user|
|
21
|
+
if user.ip
|
22
|
+
@user = user
|
23
|
+
break
|
24
|
+
end
|
25
|
+
end
|
19
26
|
end
|
20
27
|
subject { @users }
|
21
28
|
it { should_not be_empty }
|
22
29
|
context 'one of the users' do
|
23
|
-
subject { @
|
30
|
+
subject { @user }
|
24
31
|
it('should not have empty ID') { subject.id.should_not be_nil }
|
25
32
|
it('should not have empty USER_NAME') { subject.user_name.should_not be_nil }
|
26
33
|
it('should not have empty PAYER_ID') { subject.payer_id.should_not be_nil }
|
@@ -51,13 +51,13 @@ describe 'create waybill, activate and close it, then try to deactivate' do
|
|
51
51
|
subject { @waybill }
|
52
52
|
its(:status) { should == RS::Waybill::STATUS_CLOSED }
|
53
53
|
end
|
54
|
-
context '
|
54
|
+
context 'closed waybill is diactivable too' do
|
55
55
|
before(:all) do
|
56
56
|
params = RS.su_params.merge('waybill_id' => @waybill.id)
|
57
57
|
RS.deactivate_waybill(params)
|
58
58
|
@waybill = RS.get_waybill(params)
|
59
59
|
end
|
60
60
|
subject { @waybill }
|
61
|
-
its(:status) { should == RS::Waybill::
|
61
|
+
its(:status) { should == RS::Waybill::STATUS_DEACTIVATED }
|
62
62
|
end
|
63
63
|
end
|
data/spec/rs/waybill_spec.rb
CHANGED
@@ -193,3 +193,13 @@ describe 'delete saved waybill' do
|
|
193
193
|
its(:status) { should == RS::Waybill::STATUS_DELETED }
|
194
194
|
end
|
195
195
|
end
|
196
|
+
|
197
|
+
describe '"ტრანსპორტირების გარეშე" ზედნადები განსხვავებული მისამართებით' do
|
198
|
+
before(:all) do
|
199
|
+
@waybill = waybill_skeleton(:type => RS::WaybillType::WITHOUT_TRANSPORTATION, :start_address => 'აბაშა', :end_address => ' თბილისი')
|
200
|
+
RS.save_waybill(@waybill, RS.su_params)
|
201
|
+
@resp = @waybill.error_code
|
202
|
+
end
|
203
|
+
subject { @resp }
|
204
|
+
it { should == -1036 }
|
205
|
+
end
|
@@ -81,6 +81,9 @@ describe 'waybill validation' do
|
|
81
81
|
validable_test('fixing end address', @waybill, :end_address, false) do |waybill|
|
82
82
|
waybill.end_address = 'Sokhumi'
|
83
83
|
end
|
84
|
+
validable_test('waybill_type == WITHOUT_TRANSPORTATION', @waybill, :type, true) do |waybill|
|
85
|
+
waybill.type = RS::WaybillType::WITHOUT_TRANSPORTATION
|
86
|
+
end
|
84
87
|
# items
|
85
88
|
validable_test('items are missing', @waybill, :items, true)
|
86
89
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -56,7 +56,7 @@ def waybill_skeleton(params = {})
|
|
56
56
|
waybill.buyer_name = params[:buyer_name] || 'სატესტო სატესტო'
|
57
57
|
waybill.start_address = params[:start_address] || 'თბილისი'
|
58
58
|
waybill.end_address = params[:end_address] || 'სოხუმი'
|
59
|
-
waybill.transport_type_id = params[:
|
59
|
+
waybill.transport_type_id = params[:transport_type_id] || RS::TransportType::VEHICLE
|
60
60
|
waybill.start_date = params[:start_date] || Time.now
|
61
61
|
waybill.comment = params[:comment] #|| 'comment'
|
62
62
|
if waybill.transport_type_id == RS::TransportType::VEHICLE
|
@@ -83,6 +83,7 @@ def waybill_skeleton(params = {})
|
|
83
83
|
item.quantity = it[:quantity]
|
84
84
|
item.price = it[:price]
|
85
85
|
item.bar_code = it[:code]
|
86
|
+
item.vat_type = it[:vat_type]
|
86
87
|
items << item
|
87
88
|
end
|
88
89
|
else
|
@@ -91,8 +92,9 @@ def waybill_skeleton(params = {})
|
|
91
92
|
item.unit_id = 99
|
92
93
|
item.unit_name = 'კილოგრამი'
|
93
94
|
item.quantity = 10
|
94
|
-
item.price =
|
95
|
+
item.price = 3
|
95
96
|
item.bar_code = '001'
|
97
|
+
item.vat_type = RS::Waybill::VAT_COMMON
|
96
98
|
items = [item]
|
97
99
|
end
|
98
100
|
waybill.items = items
|
data/tmp/waybill.pdf
CHANGED
@@ -173,7 +173,7 @@ S
|
|
173
173
|
BT
|
174
174
|
216.128 787.246 Td
|
175
175
|
/F1.0 7 Tf
|
176
|
-
<
|
176
|
+
<333120> Tj
|
177
177
|
/F1.1 7 Tf
|
178
178
|
<2d222e2f2b20> Tj
|
179
179
|
/F1.0 7 Tf
|
@@ -243,7 +243,7 @@ S
|
|
243
243
|
BT
|
244
244
|
367.06 787.246 Td
|
245
245
|
/F1.0 7 Tf
|
246
|
-
<
|
246
|
+
<31363a3535> Tj
|
247
247
|
ET
|
248
248
|
|
249
249
|
0.000 0.000 0.000 scn
|
@@ -2748,7 +2748,7 @@ S
|
|
2748
2748
|
BT
|
2749
2749
|
507.92999999999995 493.5179999999999 Td
|
2750
2750
|
/F1.0 6 Tf
|
2751
|
-
<
|
2751
|
+
<332c3030> Tj
|
2752
2752
|
ET
|
2753
2753
|
|
2754
2754
|
0.000 0.000 0.000 scn
|
@@ -2778,7 +2778,7 @@ S
|
|
2778
2778
|
BT
|
2779
2779
|
559.1139999999999 493.5179999999999 Td
|
2780
2780
|
/F1.0 6 Tf
|
2781
|
-
<
|
2781
|
+
<33302c3030> Tj
|
2782
2782
|
ET
|
2783
2783
|
|
2784
2784
|
0.000 0.000 0.000 scn
|
@@ -2958,7 +2958,7 @@ S
|
|
2958
2958
|
BT
|
2959
2959
|
507.92999999999995 476.3239999999999 Td
|
2960
2960
|
/F1.0 6 Tf
|
2961
|
-
<
|
2961
|
+
<332c3030> Tj
|
2962
2962
|
ET
|
2963
2963
|
|
2964
2964
|
0.000 0.000 0.000 scn
|
@@ -2988,7 +2988,7 @@ S
|
|
2988
2988
|
BT
|
2989
2989
|
559.1139999999999 476.3239999999999 Td
|
2990
2990
|
/F1.0 6 Tf
|
2991
|
-
<
|
2991
|
+
<33302c3030> Tj
|
2992
2992
|
ET
|
2993
2993
|
|
2994
2994
|
0.000 0.000 0.000 scn
|
@@ -3168,7 +3168,7 @@ S
|
|
3168
3168
|
BT
|
3169
3169
|
507.92999999999995 459.1299999999999 Td
|
3170
3170
|
/F1.0 6 Tf
|
3171
|
-
<
|
3171
|
+
<332c3030> Tj
|
3172
3172
|
ET
|
3173
3173
|
|
3174
3174
|
0.000 0.000 0.000 scn
|
@@ -3198,7 +3198,7 @@ S
|
|
3198
3198
|
BT
|
3199
3199
|
559.1139999999999 459.1299999999999 Td
|
3200
3200
|
/F1.0 6 Tf
|
3201
|
-
<
|
3201
|
+
<33302c3030> Tj
|
3202
3202
|
ET
|
3203
3203
|
|
3204
3204
|
0.000 0.000 0.000 scn
|
@@ -3378,7 +3378,7 @@ S
|
|
3378
3378
|
BT
|
3379
3379
|
507.92999999999995 441.93599999999986 Td
|
3380
3380
|
/F1.0 6 Tf
|
3381
|
-
<
|
3381
|
+
<332c3030> Tj
|
3382
3382
|
ET
|
3383
3383
|
|
3384
3384
|
0.000 0.000 0.000 scn
|
@@ -3408,7 +3408,7 @@ S
|
|
3408
3408
|
BT
|
3409
3409
|
559.1139999999999 441.93599999999986 Td
|
3410
3410
|
/F1.0 6 Tf
|
3411
|
-
<
|
3411
|
+
<33302c3030> Tj
|
3412
3412
|
ET
|
3413
3413
|
|
3414
3414
|
0.000 0.000 0.000 scn
|
@@ -3588,7 +3588,7 @@ S
|
|
3588
3588
|
BT
|
3589
3589
|
507.92999999999995 424.74199999999985 Td
|
3590
3590
|
/F1.0 6 Tf
|
3591
|
-
<
|
3591
|
+
<332c3030> Tj
|
3592
3592
|
ET
|
3593
3593
|
|
3594
3594
|
0.000 0.000 0.000 scn
|
@@ -3618,7 +3618,7 @@ S
|
|
3618
3618
|
BT
|
3619
3619
|
559.1139999999999 424.74199999999985 Td
|
3620
3620
|
/F1.0 6 Tf
|
3621
|
-
<
|
3621
|
+
<33302c3030> Tj
|
3622
3622
|
ET
|
3623
3623
|
|
3624
3624
|
0.000 0.000 0.000 scn
|
@@ -3798,7 +3798,7 @@ S
|
|
3798
3798
|
BT
|
3799
3799
|
507.92999999999995 407.54799999999983 Td
|
3800
3800
|
/F1.0 6 Tf
|
3801
|
-
<
|
3801
|
+
<332c3030> Tj
|
3802
3802
|
ET
|
3803
3803
|
|
3804
3804
|
0.000 0.000 0.000 scn
|
@@ -3828,7 +3828,7 @@ S
|
|
3828
3828
|
BT
|
3829
3829
|
559.1139999999999 407.54799999999983 Td
|
3830
3830
|
/F1.0 6 Tf
|
3831
|
-
<
|
3831
|
+
<33302c3030> Tj
|
3832
3832
|
ET
|
3833
3833
|
|
3834
3834
|
0.000 0.000 0.000 scn
|
@@ -4008,7 +4008,7 @@ S
|
|
4008
4008
|
BT
|
4009
4009
|
507.92999999999995 390.3539999999998 Td
|
4010
4010
|
/F1.0 6 Tf
|
4011
|
-
<
|
4011
|
+
<332c3030> Tj
|
4012
4012
|
ET
|
4013
4013
|
|
4014
4014
|
0.000 0.000 0.000 scn
|
@@ -4038,7 +4038,7 @@ S
|
|
4038
4038
|
BT
|
4039
4039
|
559.1139999999999 390.3539999999998 Td
|
4040
4040
|
/F1.0 6 Tf
|
4041
|
-
<
|
4041
|
+
<33302c3030> Tj
|
4042
4042
|
ET
|
4043
4043
|
|
4044
4044
|
0.000 0.000 0.000 scn
|
@@ -4218,7 +4218,7 @@ S
|
|
4218
4218
|
BT
|
4219
4219
|
507.92999999999995 373.1599999999998 Td
|
4220
4220
|
/F1.0 6 Tf
|
4221
|
-
<
|
4221
|
+
<332c3030> Tj
|
4222
4222
|
ET
|
4223
4223
|
|
4224
4224
|
0.000 0.000 0.000 scn
|
@@ -4248,7 +4248,7 @@ S
|
|
4248
4248
|
BT
|
4249
4249
|
559.1139999999999 373.1599999999998 Td
|
4250
4250
|
/F1.0 6 Tf
|
4251
|
-
<
|
4251
|
+
<33302c3030> Tj
|
4252
4252
|
ET
|
4253
4253
|
|
4254
4254
|
0.000 0.000 0.000 scn
|
@@ -4428,7 +4428,7 @@ S
|
|
4428
4428
|
BT
|
4429
4429
|
507.92999999999995 355.9659999999998 Td
|
4430
4430
|
/F1.0 6 Tf
|
4431
|
-
<
|
4431
|
+
<332c3030> Tj
|
4432
4432
|
ET
|
4433
4433
|
|
4434
4434
|
0.000 0.000 0.000 scn
|
@@ -4458,7 +4458,7 @@ S
|
|
4458
4458
|
BT
|
4459
4459
|
559.1139999999999 355.9659999999998 Td
|
4460
4460
|
/F1.0 6 Tf
|
4461
|
-
<
|
4461
|
+
<33302c3030> Tj
|
4462
4462
|
ET
|
4463
4463
|
|
4464
4464
|
0.000 0.000 0.000 scn
|
@@ -4638,7 +4638,7 @@ S
|
|
4638
4638
|
BT
|
4639
4639
|
507.92999999999995 338.77199999999976 Td
|
4640
4640
|
/F1.0 6 Tf
|
4641
|
-
<
|
4641
|
+
<332c3030> Tj
|
4642
4642
|
ET
|
4643
4643
|
|
4644
4644
|
0.000 0.000 0.000 scn
|
@@ -4668,7 +4668,7 @@ S
|
|
4668
4668
|
BT
|
4669
4669
|
559.1139999999999 338.77199999999976 Td
|
4670
4670
|
/F1.0 6 Tf
|
4671
|
-
<
|
4671
|
+
<33302c3030> Tj
|
4672
4672
|
ET
|
4673
4673
|
|
4674
4674
|
0.000 0.000 0.000 scn
|
@@ -5533,7 +5533,7 @@ S
|
|
5533
5533
|
BT
|
5534
5534
|
75.1305 247.0429999999997 Td
|
5535
5535
|
/F1.0 7 Tf
|
5536
|
-
<
|
5536
|
+
<3330302c303020> Tj
|
5537
5537
|
/F1.1 7 Tf
|
5538
5538
|
<26222e2b> Tj
|
5539
5539
|
ET
|
@@ -5566,9 +5566,9 @@ S
|
|
5566
5566
|
0.000 0.000 0.000 SCN
|
5567
5567
|
|
5568
5568
|
BT
|
5569
|
-
|
5569
|
+
333.8115 247.0429999999997 Td
|
5570
5570
|
/F1.1 7 Tf
|
5571
|
-
<
|
5571
|
+
<21222d22212b2026222e2b20> Tj
|
5572
5572
|
/F1.0 7 Tf
|
5573
5573
|
<3020> Tj
|
5574
5574
|
/F1.1 7 Tf
|
@@ -6027,7 +6027,7 @@ S
|
|
6027
6027
|
BT
|
6028
6028
|
328.628 112.88399999999965 Td
|
6029
6029
|
/F1.0 7 Tf
|
6030
|
-
<
|
6030
|
+
<333120> Tj
|
6031
6031
|
/F1.1 7 Tf
|
6032
6032
|
<2d222e2f2b20> Tj
|
6033
6033
|
/F1.0 7 Tf
|
@@ -6064,7 +6064,7 @@ S
|
|
6064
6064
|
BT
|
6065
6065
|
439.56 112.88399999999965 Td
|
6066
6066
|
/F1.0 7 Tf
|
6067
|
-
<
|
6067
|
+
<31363a3535> Tj
|
6068
6068
|
ET
|
6069
6069
|
|
6070
6070
|
0.000 0.000 0.000 scn
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rs.ge
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.16
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-03-
|
12
|
+
date: 2012-03-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -128,10 +128,10 @@ files:
|
|
128
128
|
- lib/rs/sys.rb
|
129
129
|
- lib/rs/version.rb
|
130
130
|
- lib/rs/waybill.rb
|
131
|
+
- problems.md
|
131
132
|
- rs.gemspec
|
132
133
|
- spec/rs/car_spec.rb
|
133
134
|
- spec/rs/dict_spec.rb
|
134
|
-
- spec/rs/invoice2_spec.rb
|
135
135
|
- spec/rs/open_user.rb
|
136
136
|
- spec/rs/pdf_spec.rb
|
137
137
|
- spec/rs/sys_spec.rb
|
@@ -140,7 +140,6 @@ files:
|
|
140
140
|
- spec/rs/waybill_spec.rb
|
141
141
|
- spec/rs/waybill_validation_spec.rb
|
142
142
|
- spec/spec_helper.rb
|
143
|
-
- test.rb
|
144
143
|
- tmp/waybill.pdf
|
145
144
|
homepage: http://c12.ge
|
146
145
|
licenses: []
|
@@ -169,7 +168,6 @@ summary: rs.ge web services
|
|
169
168
|
test_files:
|
170
169
|
- spec/rs/car_spec.rb
|
171
170
|
- spec/rs/dict_spec.rb
|
172
|
-
- spec/rs/invoice2_spec.rb
|
173
171
|
- spec/rs/open_user.rb
|
174
172
|
- spec/rs/pdf_spec.rb
|
175
173
|
- spec/rs/sys_spec.rb
|
data/spec/rs/invoice2_spec.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
require 'rs'
|
5
|
-
|
6
|
-
describe 'save waybill' do
|
7
|
-
before(:all) do
|
8
|
-
@waybill = waybill_skeleton(:transport_type => nil, :items => [
|
9
|
-
{ :name => 'კონდოლი საფერავი 0.75 ლ.', :unit_id => 99, :unit_name => 'ცალი', :quantity => 6, :price => 30.40, :code => '4867616100014' },
|
10
|
-
{ :name => 'კონდოლი მწვანე ქისი 0.75 ლ.', :unit_id => 99, :unit_name => 'ცალი', :quantity => 6, :price => 15.70, :code => '4867616100045' },
|
11
|
-
{ :name => 'ყუთი 2ბოთლიანი', :unit_id => 99, :unit_name => 'ცალი', :quantity => 8, :price => 25.60, :code => 'TMYUTI2B' },
|
12
|
-
{ :name => 'მუკუზანი 0.75ლ.', :unit_id => 99, :unit_name => 'ცალი', :quantity => 8, :price => 19.80, :code => '4860065010026' },
|
13
|
-
{ :name => 'ქინძმარაული 0.75ლ.', :unit_id => 99, :unit_name => 'ცალი', :quantity => 4, :price => 19.40, :code => '4860065010071' },
|
14
|
-
{ :name => 'ხვანჭკარა 0.75ლ.', :unit_id => 99, :unit_name => 'ცალი', :quantity => 1, :price => 29.70, :code => '4860065010057' },
|
15
|
-
{ :name => 'წინანდალი დაძველე ბული 0.75ლ.', :unit_id => 99, :unit_name => 'ცალი', :quantity => 1, :price => 11.50, :code => '4860065010170' },
|
16
|
-
{ :name => 'ტვიში 0.75ლ.', :unit_id => 99, :unit_name => 'ცალი', :quantity => 1, :price => 15.90, :code => '4860065010293' },
|
17
|
-
{ :name => 'ჭაჭა დავარგებული 0.5ლ.', :unit_id => 99, :unit_name => 'ცალი', :quantity => 6, :price => 24.80, :code => '4860065013775' },
|
18
|
-
{ :name => '"საფერავი" 0.75ლ.', :unit_id => 99, :unit_name => 'ცალი', :quantity => 4, :price => 15.50, :code => 'MUKUZ1' },
|
19
|
-
]
|
20
|
-
)
|
21
|
-
@waybill.buyer_tin = '204383176'
|
22
|
-
@waybill.buyer_name = 'შსს საკადრო და ორგანიზაციული უზრუნველყოფის დეპარტ. საფინანსო-სამეურნეო უზრუნველყოფის მთავარი სამმ-ლო'
|
23
|
-
@resp = RS.save_waybill(@waybill, RS.su_params)
|
24
|
-
end
|
25
|
-
subject { @resp }
|
26
|
-
it { should == 0 }
|
27
|
-
end
|
data/test.rb
DELETED
@@ -1,185 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
require 'savon'
|
3
|
-
|
4
|
-
client = Savon::Client.new 'http://services.rs.ge/WayBillService/WayBillService.asmx?WSDL'
|
5
|
-
|
6
|
-
wb = %Q{
|
7
|
-
<WAYBILL>
|
8
|
-
<SUB_WAYBILLS/>
|
9
|
-
<GOODS_LIST>
|
10
|
-
<GOODS>
|
11
|
-
<ID>0</ID>
|
12
|
-
<W_NAME>მწვანე ბარდა მარნეული 520გრ</W_NAME>
|
13
|
-
<UNIT_ID>2</UNIT_ID>
|
14
|
-
<UNIT_TXT>ცალი</UNIT_TXT>
|
15
|
-
<QUANTITY>1</QUANTITY>
|
16
|
-
<PRICE>2.09</PRICE>
|
17
|
-
<AMOUNT>2.09</AMOUNT>
|
18
|
-
<BAR_CODE>11</BAR_CODE>
|
19
|
-
<A_ID>0</A_ID>
|
20
|
-
</GOODS>
|
21
|
-
</GOODS_LIST>
|
22
|
-
<ID>0</ID>
|
23
|
-
<TYPE>5</TYPE>
|
24
|
-
<CREATE_DATE>2012-02-12T22:56:48</CREATE_DATE>
|
25
|
-
<BUYER_TIN>211336240</BUYER_TIN>
|
26
|
-
<CHEK_BUYER_TIN>0</CHEK_BUYER_TIN>
|
27
|
-
<BUYER_NAME>ნიკორა</BUYER_NAME>
|
28
|
-
<START_ADDRESS>ყანთელის 9</START_ADDRESS>
|
29
|
-
<END_ADDRESS>ჭავჭავაძის 24</END_ADDRESS>
|
30
|
-
<DRIVER_TIN>12345678910</DRIVER_TIN>
|
31
|
-
<CHEK_DRIVER_TIN>0</CHEK_DRIVER_TIN>
|
32
|
-
<DRIVER_NAME>დიმიტრი ობოლაშვილი</DRIVER_NAME>
|
33
|
-
<TRANSPORT_COAST>0</TRANSPORT_COAST>
|
34
|
-
<RECEPTION_INFO/>
|
35
|
-
<RECEIVER_INFO/>
|
36
|
-
<DELIVERY_DATE/>
|
37
|
-
<STATUS>1</STATUS>
|
38
|
-
<SELER_UN_ID>731937</SELER_UN_ID>
|
39
|
-
<ACTIVATE_DATE/>
|
40
|
-
<PAR_ID/>
|
41
|
-
<CAR_NUMBER>ABK852</CAR_NUMBER>
|
42
|
-
<BEGIN_DATE>2012-01-25T20:54:36</BEGIN_DATE>
|
43
|
-
<TRAN_COST_PAYER>0</TRAN_COST_PAYER>
|
44
|
-
<TRANS_ID>3</TRANS_ID>
|
45
|
-
<TRANS_TXT/>
|
46
|
-
<COMMENT/>
|
47
|
-
</WAYBILL>
|
48
|
-
}
|
49
|
-
|
50
|
-
#resp = client.request 'get_waybill' do
|
51
|
-
# soap.body = {'su'=>'dimitri1979','sp'=>'123456','waybill_id'=>'0000003171'}
|
52
|
-
#end
|
53
|
-
|
54
|
-
# resp = client.request 'SAVE_WAYBILL'.downcase do
|
55
|
-
# soap.body = {
|
56
|
-
# 'su' => 'dimitri1979',
|
57
|
-
# 'sp' => '123456',
|
58
|
-
# 'waybill!' => wb
|
59
|
-
# }
|
60
|
-
# end
|
61
|
-
|
62
|
-
#, :body => { 'waybill!' => '<a>Some XML</a>' }
|
63
|
-
|
64
|
-
# puts '-------------------'
|
65
|
-
# puts resp.to_hash
|
66
|
-
# puts '-------------------'
|
67
|
-
# puts resp.to_xml
|
68
|
-
|
69
|
-
body = { 'rs:save_waybill' => {'rs:su' => 'dimitri1979', 'rs:sp' => '123456', 'rs:waybill!' => wb }}
|
70
|
-
namespaces = { 'xmlns:soapenv' => 'http://schemas.xmlsoap.org/soap/envelope/', 'xmlns:rs' => 'http://tempuri.org/' }
|
71
|
-
wb_xml = Gyoku.xml( {'saopenv:Envelope' => { 'saopenv:Header' => {}, 'saopenv:Body' => body }, :attributes! => {'saopenv:Envelope' => namespaces}} )
|
72
|
-
#puts wb_xml
|
73
|
-
#resp = client.request 'save_waybill' do
|
74
|
-
# soap.xml = %Q{<?xml version="1.0" encoding="utf-8"?>#{wb_xml}}
|
75
|
-
#end
|
76
|
-
|
77
|
-
# ეს არის ზედნადების ხაზი საქონლისთვის.
|
78
|
-
class WaybillItem
|
79
|
-
attr_accessor :id, :prod_name, :unit_id, :unit_name, :quantity, :price, :bar_code, :excise_id
|
80
|
-
attr_accessor :error_code, :status_code
|
81
|
-
|
82
|
-
# აბრუნებს ამ ხაზის XML წარმოდგენას.
|
83
|
-
# @param xml XML builder-ის კლასი
|
84
|
-
def to_xml(xml)
|
85
|
-
xml.GOODS do |b|
|
86
|
-
b.ID (self.id ? self.id : 0)
|
87
|
-
b.W_NAME self.prod_name
|
88
|
-
b.UNIT_ID self.unit_id
|
89
|
-
b.UNIT_TXT self.unit_name
|
90
|
-
b.QUANTITY self.quantity
|
91
|
-
b.PRICE self.price
|
92
|
-
b.AMOUNT self.quantity * self.price
|
93
|
-
b.BAR_CODE self.bar_code
|
94
|
-
b.A_ID (self.excise_id ? self.excise_id : 0)
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
# ეს არის ზედნადების კლასი.
|
100
|
-
class Waybill
|
101
|
-
TRANSPORTATION_PAID_BY_BUYER = 1
|
102
|
-
TRANSPORTATION_PAID_BY_SELLER = 2
|
103
|
-
STATUS_SAVED = 0
|
104
|
-
STATUS_ACTIVE = 1
|
105
|
-
attr_accessor :id, :type, :status, :parent_id
|
106
|
-
attr_accessor :seller_id # გამყიდველის უნიკალური კოდი
|
107
|
-
attr_accessor :buyer_tin, :check_buyer_tin, :buyer_name
|
108
|
-
attr_accessor :seller_info, :buyer_info # გამყიდველის/მყიდველის თანამდებობა, სახელი და გვარი
|
109
|
-
attr_accessor :driver_tin, :check_driver_tin, :driver_name
|
110
|
-
attr_accessor :start_address, :end_address
|
111
|
-
attr_accessor :transportation_cost, :transportation_cost_payer, :transport_type_id, :transport_type_name, :car_number
|
112
|
-
attr_accessor :comment
|
113
|
-
attr_accessor :start_date, :delivery_date
|
114
|
-
attr_accessor :items
|
115
|
-
|
116
|
-
def to_xml(xml)
|
117
|
-
xml.WAYBILL do |b|
|
118
|
-
b.GOODS_LIST do |g|
|
119
|
-
(self.items || []).each do |item|
|
120
|
-
item.to_xml g
|
121
|
-
end
|
122
|
-
end
|
123
|
-
b.ID (self.id ? self.id : 0)
|
124
|
-
b.TYPE self.type
|
125
|
-
b.BUYER_TIN self.buyer_tin
|
126
|
-
b.CHEK_BUYER_TIN (self.check_buyer_tin ? 1 : 0)
|
127
|
-
b.BUYER_NAME self.buyer_name
|
128
|
-
b.START_ADDRESS self.start_address
|
129
|
-
b.END_ADDRESS self.end_address
|
130
|
-
b.DRIVER_TIN self.driver_tin
|
131
|
-
b.CHEK_DRIVER_TIN (self.check_driver_tin ? 1 : 0)
|
132
|
-
b.DRIVER_NAME self.driver_name
|
133
|
-
b.TRANSPORT_COAST (self.transportation_cost ? self.transportation_cost : 0)
|
134
|
-
b.RECEPTION_INFO self.seller_info
|
135
|
-
b.RECEIVER_INFO self.buyer_info
|
136
|
-
b.DELIVERY_DATE (self.delivery_date ? self.delivery_date.strftime('%Y-%m-%dT%H:%M:%S') : '')
|
137
|
-
b.STATUS self.status
|
138
|
-
b.SELER_UN_ID self.seller_id
|
139
|
-
b.PAR_ID (self.parent_id ? self.parent_id : '')
|
140
|
-
b.CAR_NUMBER self.car_number
|
141
|
-
b.BEGIN_DATE (self.start_date ? self.start_date.strftime('%Y-%m-%dT%H:%M:%S') : '')
|
142
|
-
b.TRANS_COST_PAYER (self.transportation_cost_payer ? self.transportation_cost_payer : Waybill::TRANSPORTATION_PAID_BY_BUYER)
|
143
|
-
b.TRANS_ID self.transport_type_id
|
144
|
-
b.TRANS_TXT self.transport_type_name
|
145
|
-
b.COMMENT self.comment
|
146
|
-
end
|
147
|
-
end
|
148
|
-
end
|
149
|
-
|
150
|
-
waybill = Waybill.new
|
151
|
-
waybill.type = 2
|
152
|
-
waybill.status = Waybill::STATUS_SAVED
|
153
|
-
waybill.seller_id = 731937
|
154
|
-
waybill.buyer_tin = '12345678910'
|
155
|
-
waybill.check_buyer_tin = true
|
156
|
-
waybill.buyer_name = 'სატესტო ორგანიზაცია - 2'
|
157
|
-
waybill.start_address = 'Tbilisi'
|
158
|
-
waybill.end_address = 'Sokhumi'
|
159
|
-
waybill.transport_type_id = 1
|
160
|
-
waybill.driver_name = 'დიმიტრი ყურაშვილი'
|
161
|
-
waybill.car_number = 'WDW842'
|
162
|
-
waybill.driver_tin = '02001000490'
|
163
|
-
waybill.start_date = Time.now
|
164
|
-
|
165
|
-
item = WaybillItem.new
|
166
|
-
item.prod_name = 'კიტრი'
|
167
|
-
item.unit_id = 99
|
168
|
-
item.unit_name = 'კგ'
|
169
|
-
item.quantity = 10
|
170
|
-
item.price = 10
|
171
|
-
item.bar_code = '1234'
|
172
|
-
|
173
|
-
waybill.items = []
|
174
|
-
waybill.items << item
|
175
|
-
|
176
|
-
resp = client.request 'save_waybill' do |soap|
|
177
|
-
#xml = Builder::XmlMarkup.new
|
178
|
-
soap.body do |xml|
|
179
|
-
xml.ins0 :su, 'dimitri1979'
|
180
|
-
xml.ins0 :sp, '123456'
|
181
|
-
xml.ins0 :waybill do |b|
|
182
|
-
waybill.to_xml b
|
183
|
-
end
|
184
|
-
end
|
185
|
-
end
|