vyapari 0.1.5dev7 → 0.1.5dev8
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e3f2f3a46d81aa05666be22078453d313b07f690
|
4
|
+
data.tar.gz: 18f1f8438cd8a37174c5c9b6472f0995971eb080
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2cf6df83b781ff72492a6eab935ef8e339526228bd7a90f9c61ec94cd324dd51f23ef8ac56356ce8978d5235c21d3f68ce08b86ca54fe4a3ce56a2ce41073c36
|
7
|
+
data.tar.gz: 315b00a715c43a87a070cf5427e89ccce08f3725116660a1498f2defdbe2e2d46c23f4a5bf5bf9ea431e2c8e151813a95624dfbbcf0003cebdfe8cde161443fe
|
@@ -0,0 +1,144 @@
|
|
1
|
+
module Vyapari
|
2
|
+
module StoreManager
|
3
|
+
module Reports
|
4
|
+
class InvoicesController < Vyapari::StoreManager::BaseController
|
5
|
+
|
6
|
+
def index
|
7
|
+
@relation = Product.select("MAX(products.id) as id,
|
8
|
+
MAX(products.name) as name,
|
9
|
+
MAX(products.ean_sku) as ean_sku,
|
10
|
+
MAX(products.purchased_price) as purchased_price,
|
11
|
+
MAX(products.landed_price) as landed_price,
|
12
|
+
MAX(products.selling_price) as selling_price,
|
13
|
+
MAX(products.retail_price) as retail_price,
|
14
|
+
MAX(se.status) as se_status,
|
15
|
+
SUM(se.quantity) as se_quantity").
|
16
|
+
joins("LEFT JOIN stock_entries se ON se.product_id = products.id")
|
17
|
+
|
18
|
+
parse_filters
|
19
|
+
apply_filters
|
20
|
+
|
21
|
+
@results = @relation.group("products.id")
|
22
|
+
@total = @relation.except(:select).
|
23
|
+
select("SUM(products.id) as id,
|
24
|
+
SUM(products.purchased_price) as purchased_price,
|
25
|
+
SUM(products.landed_price) as landed_price,
|
26
|
+
SUM(products.selling_price) as selling_price,
|
27
|
+
SUM(products.retail_price) as retail_price")
|
28
|
+
|
29
|
+
render_report
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def permitted_params
|
35
|
+
params.require(:invoice).permit(:discount, :adjustment, :money_taken, :notes, :payment_method, :customer_name, :customer_address, :customer_phone, :customer_email, :credit_card_number)
|
36
|
+
end
|
37
|
+
|
38
|
+
def resolve_layout
|
39
|
+
case action_name
|
40
|
+
when "show"
|
41
|
+
'kuppayam/print_a4'
|
42
|
+
else
|
43
|
+
'vyapari/terminal_staff'
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def resource_controller_configuration
|
48
|
+
{
|
49
|
+
collection_name: :invoices,
|
50
|
+
item_name: :invoice,
|
51
|
+
class: Invoice,
|
52
|
+
page_title: "#{@terminal.name} - Invoices",
|
53
|
+
js_view_path: "/kuppayam/workflows/peacock",
|
54
|
+
view_path: "/vyapari/terminal_staff/invoices"
|
55
|
+
}
|
56
|
+
end
|
57
|
+
|
58
|
+
def breadcrumbs_configuration
|
59
|
+
{
|
60
|
+
heading: "Invoices - #{@terminal.name}",
|
61
|
+
description: "Listing the invoices - #{@terminal.name}",
|
62
|
+
links: [
|
63
|
+
{name: "Change Terminal", link: store_manager_dashboard_path(@store), icon: 'fa-cog'},
|
64
|
+
{name: @terminal.name, link: terminal_staff_dashboard_path(@terminal), icon: 'fa-desktop'},
|
65
|
+
{name: "Invoices", link: nil, icon: 'fa-file', active: true}
|
66
|
+
]
|
67
|
+
}
|
68
|
+
end
|
69
|
+
|
70
|
+
def get_collections
|
71
|
+
@relation = @terminal.invoices.includes(:user).where("")
|
72
|
+
|
73
|
+
parse_filters
|
74
|
+
apply_filters
|
75
|
+
|
76
|
+
@invoices = @r_objects = @relation.page(@current_page).per(@per_page)
|
77
|
+
|
78
|
+
return true
|
79
|
+
end
|
80
|
+
|
81
|
+
def apply_filters
|
82
|
+
@relation = @relation.search(@query) if @query
|
83
|
+
@relation = @relation.status(@status) if @status
|
84
|
+
@relation = @relation.payment_method(@payment_method) if @payment_method
|
85
|
+
|
86
|
+
# if @fterminal == "null"
|
87
|
+
# @relation = @relation.where("invoices.terminal_id IS NULL")
|
88
|
+
# elsif @fterminal
|
89
|
+
# @relation = @relation.where("invoices.terminal_id = ?", @fterminal.id)
|
90
|
+
# end
|
91
|
+
|
92
|
+
# if @fstore == "null"
|
93
|
+
# @relation = @relation.where("invoices.store_id IS NULL")
|
94
|
+
# elsif @fstore
|
95
|
+
# @relation = @relation.where("invoices.store_id = ?", @fstore.id)
|
96
|
+
# end
|
97
|
+
|
98
|
+
# if @user == "null"
|
99
|
+
# @relation = @relation.where("invoices.user_id IS NULL")
|
100
|
+
# elsif @user
|
101
|
+
# @relation = @relation.where("invoices.user_id = ?", @terminal.id)
|
102
|
+
# end
|
103
|
+
|
104
|
+
@order_by = "created_at desc" unless @order_by
|
105
|
+
@relation = @relation.order(@order_by)
|
106
|
+
end
|
107
|
+
|
108
|
+
def configure_filter_settings
|
109
|
+
@filter_settings = {
|
110
|
+
string_filters: [
|
111
|
+
{ filter_name: :query },
|
112
|
+
{ filter_name: :status },
|
113
|
+
{ filter_name: :payment_method }
|
114
|
+
],
|
115
|
+
boolean_filters: [],
|
116
|
+
reference_filters: [
|
117
|
+
{ filter_name: :user, filter_class: User },
|
118
|
+
{ filter_name: :fstore, filter_class: Store },
|
119
|
+
{ filter_name: :fterminal, filter_class: Terminal }
|
120
|
+
],
|
121
|
+
variable_filters: [
|
122
|
+
#{ variable_name: :store, filter_name: :store },
|
123
|
+
#{ variable_name: :terminal, filter_name: :terminal }
|
124
|
+
]
|
125
|
+
}
|
126
|
+
end
|
127
|
+
|
128
|
+
def configure_filter_ui_settings
|
129
|
+
@filter_ui_settings = {}
|
130
|
+
end
|
131
|
+
|
132
|
+
def resource_url(obj)
|
133
|
+
url_for([:terminal_staff, @terminal, obj])
|
134
|
+
end
|
135
|
+
|
136
|
+
def set_navs
|
137
|
+
set_nav("terminal_staff/invoices")
|
138
|
+
end
|
139
|
+
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
@@ -93,7 +93,7 @@ module Vyapari
|
|
93
93
|
end
|
94
94
|
|
95
95
|
def get_collections
|
96
|
-
@relation = @terminal.invoices.where("")
|
96
|
+
@relation = @terminal.invoices.includes(:user).where("")
|
97
97
|
|
98
98
|
parse_filters
|
99
99
|
apply_filters
|
@@ -108,18 +108,6 @@ module Vyapari
|
|
108
108
|
@relation = @relation.status(@status) if @status
|
109
109
|
@relation = @relation.payment_method(@payment_method) if @payment_method
|
110
110
|
|
111
|
-
if @terminal == "null"
|
112
|
-
@relation = @relation.where("invoices.terminal_id IS NULL")
|
113
|
-
elsif @terminal
|
114
|
-
@relation = @relation.where("invoices.terminal_id = ?", @terminal.id)
|
115
|
-
end
|
116
|
-
|
117
|
-
if @store == "null"
|
118
|
-
@relation = @relation.where("invoices.store_id IS NULL")
|
119
|
-
elsif @store
|
120
|
-
@relation = @relation.where("invoices.store_id = ?", @terminal.id)
|
121
|
-
end
|
122
|
-
|
123
111
|
if @user == "null"
|
124
112
|
@relation = @relation.where("invoices.user_id IS NULL")
|
125
113
|
elsif @user
|
@@ -139,14 +127,9 @@ module Vyapari
|
|
139
127
|
],
|
140
128
|
boolean_filters: [],
|
141
129
|
reference_filters: [
|
142
|
-
{ filter_name: :user, filter_class: User }
|
143
|
-
{ filter_name: :fstore, filter_class: Store },
|
144
|
-
{ filter_name: :fterminal, filter_class: Terminal }
|
130
|
+
{ filter_name: :user, filter_class: User }
|
145
131
|
],
|
146
|
-
variable_filters: [
|
147
|
-
#{ variable_name: :store, filter_name: :store },
|
148
|
-
#{ variable_name: :terminal, filter_name: :terminal }
|
149
|
-
]
|
132
|
+
variable_filters: []
|
150
133
|
}
|
151
134
|
end
|
152
135
|
|
@@ -154,12 +137,8 @@ module Vyapari
|
|
154
137
|
@filter_ui_settings = {}
|
155
138
|
end
|
156
139
|
|
157
|
-
def
|
158
|
-
|
159
|
-
end
|
160
|
-
|
161
|
-
def set_navs
|
162
|
-
set_nav("terminal_staff/invoices")
|
140
|
+
def set_navs
|
141
|
+
set_nav("staff_manager/invoices")
|
163
142
|
end
|
164
143
|
|
165
144
|
end
|
data/lib/vyapari/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vyapari
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5dev8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kpvarma
|
@@ -350,6 +350,7 @@ files:
|
|
350
350
|
- app/controllers/vyapari/application_controller.rb
|
351
351
|
- app/controllers/vyapari/store_manager/base_controller.rb
|
352
352
|
- app/controllers/vyapari/store_manager/dashboard_controller.rb
|
353
|
+
- app/controllers/vyapari/store_manager/reports/invoices_controller.rb
|
353
354
|
- app/controllers/vyapari/store_manager/reports/stock_controller.rb
|
354
355
|
- app/controllers/vyapari/store_manager/resource_controller.rb
|
355
356
|
- app/controllers/vyapari/store_manager/stock_bundles_controller.rb
|