toolhound-ruby 1.0.19 → 1.0.20
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.
- checksums.yaml +4 -4
- data/lib/toolhound-ruby.rb +2 -0
- data/lib/toolhound-ruby/base.rb +4 -0
- data/lib/toolhound-ruby/client.rb +4 -0
- data/lib/toolhound-ruby/inventory_receipt.rb +79 -0
- data/lib/toolhound-ruby/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 18469e7bdcf985b512fc1be48c80f389fc8e183e
|
4
|
+
data.tar.gz: 401b6152b06e96f3cd2573729d8927b7f724387a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 225473e8e08ce1c890871e6e78620a9e5a2dbd620f1a7fbe1801b7476b8e120c1c30e4c84cf36b627908e89eafd989996538dacdb42f0cc6a983806d36ea85b0
|
7
|
+
data.tar.gz: 7641e669e0e6aeba2ecd64da00996519485e79bf676fb238bc954246f81a6b6698d6648456c57435003a86d416e2167deee41e2158eccfafd5ea86487990fe74
|
data/lib/toolhound-ruby.rb
CHANGED
@@ -27,6 +27,8 @@ require "toolhound-ruby/rental_item"
|
|
27
27
|
require "toolhound-ruby/rental_charge"
|
28
28
|
require "toolhound-ruby/transaction"
|
29
29
|
|
30
|
+
require "toolhound-ruby/inventory_receipt"
|
31
|
+
|
30
32
|
require "toolhound-ruby/vendor"
|
31
33
|
require "toolhound-ruby/manufacturer"
|
32
34
|
require "toolhound-ruby/purchase_order"
|
data/lib/toolhound-ruby/base.rb
CHANGED
@@ -117,6 +117,10 @@ module Toolhound
|
|
117
117
|
@inventory_item ||= Toolhound::InventoryItem.new(self)
|
118
118
|
end
|
119
119
|
|
120
|
+
def inventory_receipt
|
121
|
+
@inventory_receipt ||= Toolhound::InventoryReceipt.new(self)
|
122
|
+
end
|
123
|
+
|
120
124
|
def project
|
121
125
|
@project ||= Toolhound::Project.new(self)
|
122
126
|
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
# EXECUTE HumanResources.uspGetEmployees @FirstName = N'Pilar', @LastName = N'Ackerman';
|
2
|
+
module Toolhound
|
3
|
+
|
4
|
+
# Class to parse GitHub repository owner and name from
|
5
|
+
# URLs and to generate URLs
|
6
|
+
class InventoryReceipt < Base
|
7
|
+
|
8
|
+
self.table_name = :inventory_receipt_detail
|
9
|
+
self.primary_key = :int_inventory_receipt_id
|
10
|
+
|
11
|
+
def default_selects
|
12
|
+
{
|
13
|
+
inventory: [:int_category_id, :int_sub_category_id],
|
14
|
+
inventory_type: [:bol_serialized, :bol_bulk, :bol_consumable],
|
15
|
+
inventory_text: [:var_part_no, :var_description, {varUserField1: "varGlRevenue"}, {varUserField2: "varGlCOGSCode"}, {varUserField3: "varPhaseCode"}],
|
16
|
+
inventory_receipt_detail: [
|
17
|
+
:int_inventory_receipt_detail_id, :int_received_qty, :var_serial_number, :dec_cost, 'intInventoryIDID',
|
18
|
+
{"(ISNULL(tblInventoryReceiptDetail.intReceivedQty, 0) * ISNULL(tblInventoryReceiptDetail.decCost, 0))" => {raw: true, as: :dec_total_cost}}
|
19
|
+
],
|
20
|
+
inventory_id: [{var_inventory_id: "varInventoryIdNo"}],
|
21
|
+
purchase_order: [{"varPONO" => :po_no}],
|
22
|
+
inventory_receipt_text: [:var_notes],
|
23
|
+
inventory_receipt: [
|
24
|
+
:int_inventory_receipt_id, {'intPOID' => :po_id}, :var_receipt_no, :var_invoice_number, :dte_created_date, :dte_modified_date,
|
25
|
+
:dte_received_date, :int_vendor_id
|
26
|
+
],
|
27
|
+
vendor: [{var_vendor_id: "varVendorNo"}],
|
28
|
+
vendor_text: [:var_organization]
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
def default_joins
|
33
|
+
arr = []
|
34
|
+
arr << "INNER JOIN tblInventoryReceipt ON tblInventoryReceipt.intInventoryReceiptID = tblInventoryReceiptDetail.intInventoryReceiptID"
|
35
|
+
arr << "INNER JOIN tblInventoryReceiptText ON tblInventoryReceiptText.intInventoryReceiptID = tblInventoryReceipt.intInventoryReceiptID AND tblInventoryReceiptText.varLocaleID = '#{locale}'"
|
36
|
+
arr << "INNER JOIN tblPurchaseOrder ON tblPurchaseOrder.intPOID = tblInventoryReceipt.intPOID"
|
37
|
+
arr << "LEFT OUTER JOIN tblVendor ON tblVendor.intVendorID = tblInventoryReceipt.intVendorID"
|
38
|
+
arr << "LEFT OUTER JOIN tblVendorText ON tblVendor.intVendorID = tblVendorText.intVendorID"
|
39
|
+
arr << "INNER JOIN tblInventoryID ON tblInventoryID.intInventoryIdID = tblInventoryReceiptDetail.intInventoryIDID"
|
40
|
+
arr << "INNER JOIN tblInventory ON tblInventoryID.intInventoryID = tblInventory.intInventoryID"
|
41
|
+
arr << "INNER JOIN tblInventoryText ON tblInventoryText.intInventoryID = tblInventory.intInventoryID AND tblInventoryText.varLocaleID = '#{locale}'"
|
42
|
+
arr << "INNER JOIN tblInventoryType ON tblInventoryType.intInventoryTypeID = tblInventory.intInventoryTypeID"
|
43
|
+
|
44
|
+
arr
|
45
|
+
end
|
46
|
+
|
47
|
+
def all(options = {})
|
48
|
+
options = (options || {}).dup
|
49
|
+
|
50
|
+
from = options.delete(:from)
|
51
|
+
to = options.delete(:to)
|
52
|
+
fixed = options.delete(:fixed_assets)
|
53
|
+
consumable = options.delete(:consumable)
|
54
|
+
wheres = []
|
55
|
+
|
56
|
+
selects = default_selects
|
57
|
+
joins = default_joins
|
58
|
+
|
59
|
+
# wheres << "tblInventoryReceipt.dteReceivedDate BETWEEN '#{parse_time(from)}' AND '#{parse_time(to)}'" if from && to
|
60
|
+
wheres << {"inventory_receipt.dte_received_date" => {value: [parse_time(from), parse_time(to)], op: :between} } if from && to
|
61
|
+
wheres << "(
|
62
|
+
(tblInventoryType.bolSerialized = 1 AND tblInventoryReceiptDetail.decCost > 1499.00) OR
|
63
|
+
(tblInventoryType.bolBulk = 1 AND (tblInventoryReceiptDetail.decCost * tblInventoryReceiptDetail.intReceivedQty) > 20000.00)
|
64
|
+
)" if fixed
|
65
|
+
|
66
|
+
wheres << {"inventory_type.bol_consumable" => {value: 1}} if consumable
|
67
|
+
|
68
|
+
build_and_query(
|
69
|
+
joins: joins,
|
70
|
+
selects: selects,
|
71
|
+
where: wheres,
|
72
|
+
from: 'tblInventoryReceiptDetail'
|
73
|
+
)
|
74
|
+
|
75
|
+
end
|
76
|
+
|
77
|
+
|
78
|
+
end
|
79
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.20
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Markus Klooth
|
@@ -73,6 +73,7 @@ files:
|
|
73
73
|
- lib/toolhound-ruby/incident.rb
|
74
74
|
- lib/toolhound-ruby/inventory.rb
|
75
75
|
- lib/toolhound-ruby/inventory_item.rb
|
76
|
+
- lib/toolhound-ruby/inventory_receipt.rb
|
76
77
|
- lib/toolhound-ruby/job.rb
|
77
78
|
- lib/toolhound-ruby/manufacturer.rb
|
78
79
|
- lib/toolhound-ruby/project.rb
|