toolhound-ruby 1.0.16 → 1.0.17

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
  SHA1:
3
- metadata.gz: 10b0a155efcae695fcc9306c753f85d6b25c0cf4
4
- data.tar.gz: c508cd06bd9564ebb87efb7b5e0489f617500b94
3
+ metadata.gz: 53126038ede3803fb0ae8de7c4ad8a0f8664bba8
4
+ data.tar.gz: 2e9847e4abe3aa0986cfd4253e52a098feca87ee
5
5
  SHA512:
6
- metadata.gz: 881c8e61a0b30456ecaae20e141353ccdf789d395b01d766e11b082595d08479e8121801ac0c36509d2674c00dfcd6533865be23bbfc079e3b24591b17173e4d
7
- data.tar.gz: 62bf45e81b5f5161169d6da040bfa3b4feb7e08f9bc1bdf15fcda82e38e7f067617ea84e09d1a8f524ee614645839e7f749f3f3be4c59a59cd736fedad091821
6
+ metadata.gz: a9b9406b193741830c11e7d68d11975eda1958b4a9d4a8f74c4987dcb0fdd4e60150e781db3c5ec65a1c27beb2e27da4289696107d65e4d852b0a4df4e90df24
7
+ data.tar.gz: bfe4e05305086edc36c6ae96c48fd4140e11ac53635e3748cd3542e4b606389b5addeea619093615c7764743e45e44bf32c702a2173467aeb35b96b5c58df642
@@ -360,6 +360,10 @@ module Toolhound
360
360
  end
361
361
 
362
362
  def parse_time(date)
363
+ if date.is_a?(String)
364
+ date = Time.parse(date)
365
+ end
366
+
363
367
  date = date.utc if date.respond_to?(:utc)
364
368
 
365
369
  date.strftime(DATE_TIME_FORMAT)
@@ -46,7 +46,11 @@ module Toolhound
46
46
  all(where: [{"rental_detail.int_rental_id" => id}])
47
47
  end
48
48
 
49
- def for_entity_over_period(entity_id, from, to)
49
+ def for_entity_over_period(options)
50
+ entity_id = options.delete :entity_id
51
+ from = options.delete :from
52
+ to = options.delete :to
53
+
50
54
  joins = []
51
55
  joins << "LEFT OUTER JOIN tblRentalItem ON tblRentalItem.intRentalItemID = tblRentalCharge.intRentalItemID"
52
56
  joins << "LEFT OUTER JOIN tblRentalDetail ON tblRentalDetail.intRentalDetailID = tblRentalItem.intRentalDetailID"
@@ -56,12 +60,15 @@ module Toolhound
56
60
  joins << "INNER JOIN tblInventoryText ON tblInventory.intInventoryID = tblInventoryText.intInventoryID"
57
61
 
58
62
  wheres = [
59
- {"rental_charge.int_entity_id" => entity_id},
60
63
  {"inventory.bol_deleted" => 0},
61
64
  {"inventory.bol_is_active" => 1},
62
65
  {"inventory_text.var_locale_id" => locale},
63
- {dte_end_date: {value: [from, to], op: :between} }
64
66
  ]
67
+
68
+ wheres << {"rental_charge.int_entity_id" => entity_id} if entity_id.present?
69
+ wheres << {dte_end_date: {value: [parse_time(from), parse_time(to)], op: :between} } if from.present? && to.present?
70
+
71
+
65
72
  selects = {
66
73
  rental_charge: [
67
74
  :int_rental_charge_id, :int_entity_id, :int_qty, :dec_total, :var_type, :int_inventory_id_id,
@@ -93,7 +93,7 @@ module Toolhound
93
93
  wheres = []
94
94
  wheres << {"transaction_type.bol_return" => 'true'}
95
95
 
96
- wheres << {"transaction.int_entity_id" => entity_id} if entity_id
96
+ wheres << {"transaction.int_entity_id" => entity_id} if entity_id.present?
97
97
  wheres << "tblTransaction.dteTransactionDate BETWEEN '#{parse_time(from_date)}' AND '#{parse_time(to_date)}'" if from_date && to_date
98
98
  wheres << "(tblReturnStatus.bolCreateWO = 1 OR tblReturnStatus.bolRetire = 1)" if damaged_only == true
99
99
 
@@ -1,3 +1,3 @@
1
1
  module Toolhound
2
- VERSION = "1.0.16"
2
+ VERSION = "1.0.17"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: toolhound-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.16
4
+ version: 1.0.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Markus Klooth
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-12 00:00:00.000000000 Z
11
+ date: 2016-02-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tiny_tds