toolhound-ruby 1.0.22 → 1.0.23
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/toolhound-ruby/inventory_item.rb +28 -21
- data/lib/toolhound-ruby/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e3355cab98a26569ba55d4bdf0fa290707f3a2aa
|
4
|
+
data.tar.gz: 93e124b2bca52e00418d0b3d4e961629c0a014c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a28e80e89a5e5bea9b54afe1ef51d745c177a2625853eba2f329eba6a9c725184a09873a88c76a9f1de7f6ec4973b2eea49e8e5badc07232869a4651c3fdb128
|
7
|
+
data.tar.gz: c494e807cf7ceb4bac23188ad14be9aa63b2bb48ce67047f49bb4e3d4543603c1660bdb0d5bbafc0ee8f70cce4898f2bb18d9f21289f917438dd020ef5e249ca
|
@@ -66,34 +66,52 @@ module Toolhound
|
|
66
66
|
|
67
67
|
end
|
68
68
|
|
69
|
-
def
|
70
|
-
|
69
|
+
def charges(options = {})
|
70
|
+
options = (options || {}).dup
|
71
|
+
|
72
|
+
job_id = options[:job_id]
|
73
|
+
entity_id = options[:entity_id]
|
74
|
+
order = options[:order] || "tblInventoryText.varPartNo"
|
75
|
+
|
76
|
+
|
77
|
+
joins = default_joins
|
78
|
+
entity_query = ""
|
79
|
+
charge_entity_query = ""
|
80
|
+
charge_entity_query1 = ""
|
81
|
+
if entity_id
|
82
|
+
entity_query = "AND tblRental.intEntityID = '#{entity_id}'"
|
83
|
+
charge_entity_query = "WHERE rc.intEntityID = '#{entity_id}'"
|
84
|
+
charge_entity_query1 = "WHERE intEntityID = '#{entity_id}'"
|
85
|
+
end
|
86
|
+
|
71
87
|
joins << "INNER JOIN tblInventoryType ON tblInventoryType.intInventoryTypeID = tblInventoryItem.intInventoryTypeID AND tblInventoryType.bolSerialized = 1"
|
72
88
|
joins << "INNER JOIN(
|
73
89
|
SELECT tblRentalItem.intInventoryIDID, SUM(tblRentalItem.decTotalRent) AS decTotalRent
|
74
90
|
FROM tblRentalItem
|
75
91
|
INNER JOIN tblRentalDetail ON tblRentalDetail.intRentalDetailID = tblRentalItem.intRentalDetailID
|
76
|
-
INNER JOIN tblRental ON tblRental.intRentalID = tblRentalDetail.intRentalID
|
92
|
+
INNER JOIN tblRental ON tblRental.intRentalID = tblRentalDetail.intRentalID #{entity_query}
|
77
93
|
GROUP BY tblRentalItem.intInventoryIDID
|
78
94
|
) AS tblRentalQuery ON tblRentalQuery.intInventoryIDID = tblInventoryID.intInventoryIdID"
|
95
|
+
|
79
96
|
joins << "LEFT OUTER JOIN (
|
80
97
|
SELECT rc.intInventoryIDID, MAX(rc.intRentalChargeID) AS latest_id
|
81
98
|
FROM tblRentalCharge as rc
|
82
|
-
|
99
|
+
#{charge_entity_query}
|
83
100
|
GROUP BY rc.intInventoryIDID
|
84
101
|
) AS tblLatestCharge ON tblLatestCharge.intInventoryIDID = tblInventoryID.intInventoryIdID"
|
102
|
+
|
85
103
|
joins << "LEFT OUTER JOIN (
|
86
104
|
SELECT tblRentalCharge.intJobID, tblRentalCharge.intRentalChargeID
|
87
105
|
FROM tblRentalCharge
|
88
|
-
|
106
|
+
#{charge_entity_query1}
|
89
107
|
) AS tblJobCharge ON tblJobCharge.intRentalChargeID = tblLatestCharge.latest_id"
|
108
|
+
|
90
109
|
joins << "LEFT OUTER JOIN tblJobText on tblJobText.intJobID = tblJobCharge.intJobID AND tblJobText.varLocaleID = '#{locale}'"
|
91
110
|
|
92
|
-
selects
|
111
|
+
selects = default_selects
|
93
112
|
selects[:job_text] = [:int_job_id, :int_job_text_id, :var_job_number, :var_job]
|
94
113
|
selects[:rental_query] = [:dec_total_rent]
|
95
114
|
|
96
|
-
# (tblInventoryItem.intQOH=@p_QOH OR @p_QOH IS NULL)
|
97
115
|
wheres = []
|
98
116
|
if job_id
|
99
117
|
if job_id == :null
|
@@ -102,20 +120,9 @@ module Toolhound
|
|
102
120
|
wheres << "(tblJobText.intJobID = #{job_id})"
|
103
121
|
end
|
104
122
|
end
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
# INNER JOIN tblInventoryID ON tblInventoryItem.intInventoryItemID = tblInventoryID.intInventoryItemID
|
109
|
-
# INNER JOIN tblInventoryItemText ON tblInventoryItemText.intInventoryItemID = tblInventoryItem.intInventoryItemID
|
110
|
-
# INNER JOIN tblInventoryType ON tblInventoryType.intInventoryTypeID = tblInventoryItem.intInventoryTypeID AND tblInventoryType.bolSerialized = 1
|
111
|
-
# INNER JOIN(
|
112
|
-
# SELECT tblRentalItem.intInventoryIDID, SUM(tblRentalItem.decTotalRent) AS total_rent
|
113
|
-
# FROM tblRentalItem
|
114
|
-
# INNER JOIN tblRentalDetail ON tblRentalDetail.intRentalDetailID = tblRentalItem.intRentalDetailID
|
115
|
-
# INNER JOIN tblRental ON tblRental.intRentalID = tblRentalDetail.intRentalID AND tblRental.intEntityID = 100002
|
116
|
-
#
|
117
|
-
# GROUP BY tblRentalItem.intInventoryIDID
|
118
|
-
# ) AS subquery1 ON subquery1.intInventoryIDID = tblInventoryID.intInventoryIdID
|
123
|
+
|
124
|
+
build_and_query(selects: selects, where: wheres, joins: joins, order: order)
|
125
|
+
|
119
126
|
end
|
120
127
|
|
121
128
|
|
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.
|
4
|
+
version: 1.0.23
|
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-03-
|
11
|
+
date: 2016-03-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tiny_tds
|