vyapari 0.1.5dev1 → 0.1.5dev2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/vyapari/admin/base_controller.rb +0 -1
- data/app/controllers/vyapari/terminal_staff/invoices_controller.rb +4 -3
- data/app/controllers/vyapari/terminal_staff/line_items_controller.rb +13 -6
- data/app/models/invoice.rb +16 -6
- data/app/models/product.rb +1 -1
- data/app/models/store.rb +2 -1
- data/app/views/vyapari/store_manager/stock_bundles/_form.html.erb +39 -39
- data/app/views/vyapari/terminal_staff/dashboard/_counts.html.erb +3 -3
- data/app/views/vyapari/terminal_staff/dashboard/_invoices.html.erb +11 -6
- data/app/views/vyapari/terminal_staff/dashboard/index.html.erb +1 -1
- data/app/views/vyapari/terminal_staff/invoices/_draft.html.erb +2 -2
- data/app/views/vyapari/terminal_staff/invoices/_form.html.erb +16 -2
- data/app/views/vyapari/terminal_staff/invoices/_index.html.erb +1 -1
- data/app/views/vyapari/terminal_staff/invoices/_row.html.erb +1 -1
- data/app/views/vyapari/terminal_staff/invoices/_show.html.erb +199 -166
- data/app/views/vyapari/terminal_staff/invoices/new.js.erb +3 -0
- data/app/views/vyapari/terminal_staff/invoices/show.js.erb +13 -0
- data/app/views/vyapari/terminal_staff/line_items/_index.html.erb +3 -1
- data/app/views/vyapari/terminal_staff/line_items/create.js.erb +3 -3
- data/app/views/vyapari/terminal_staff/line_items/destroy.js.erb +1 -1
- data/app/views/vyapari/user_dashboard/index.html.erb +1 -1
- data/db/migrate/20170000000213_create_invoices.rb +6 -3
- data/lib/vyapari/version.rb +1 -1
- metadata +2 -2
- data/app/views/vyapari/terminal_staff/stores/index.html.erb +0 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 26391418ff6989a5ef96182b0ff1dac526126b24
|
4
|
+
data.tar.gz: c8157ae3c52ec6f1cf588795b3bfa8e613ee6678
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c93cdca3ac288aa6d4ebf21f5fe9e2d3284ee974262398599f75636fadf452773f33eb044711499b7920bc3e1ab25c7639e9adf05b3ee071f530560951c057c
|
7
|
+
data.tar.gz: 2d4b0e96ddd78cb2dfefbfb6395f335bf7ca91aad861f3cdca6a2d73970112c0a334fb4ca656ad6709f0389cbd097849ce0a2ff82bcea3cac224080838432d28
|
@@ -2,7 +2,7 @@ module Vyapari
|
|
2
2
|
module TerminalStaff
|
3
3
|
class InvoicesController < Vyapari::TerminalStaff::ResourceController
|
4
4
|
|
5
|
-
|
5
|
+
layout :resolve_layout
|
6
6
|
|
7
7
|
def new
|
8
8
|
@invoice = @r_object = Invoice.new
|
@@ -18,11 +18,12 @@ module Vyapari
|
|
18
18
|
|
19
19
|
def edit
|
20
20
|
@invoice = @r_object = Invoice.find_by_id(params[:id])
|
21
|
-
|
21
|
+
render :new
|
22
22
|
end
|
23
23
|
|
24
24
|
def show
|
25
25
|
@invoice = @r_object = Invoice.find_by_id(params[:id])
|
26
|
+
render :show
|
26
27
|
end
|
27
28
|
|
28
29
|
def update
|
@@ -46,7 +47,7 @@ module Vyapari
|
|
46
47
|
private
|
47
48
|
|
48
49
|
def permitted_params
|
49
|
-
params.require(:invoice).permit(:discount, :adjustment, :money_taken, :notes, :payment_method, :customer_name, :customer_address, :credit_card_number)
|
50
|
+
params.require(:invoice).permit(:discount, :adjustment, :money_taken, :notes, :payment_method, :customer_name, :customer_address, :customer_phone, :customer_email, :credit_card_number)
|
50
51
|
end
|
51
52
|
|
52
53
|
def resolve_layout
|
@@ -6,8 +6,9 @@ module Vyapari
|
|
6
6
|
|
7
7
|
def create
|
8
8
|
|
9
|
-
ean_sku = permitted_params[:product_id]
|
10
|
-
|
9
|
+
ean_sku = permitted_params[:product_id].to_s
|
10
|
+
|
11
|
+
product = Product.where("ean_sku = ? ", ean_sku).first
|
11
12
|
|
12
13
|
product_in_stock = false
|
13
14
|
|
@@ -35,12 +36,13 @@ module Vyapari
|
|
35
36
|
|
36
37
|
@r_object = @line_item
|
37
38
|
|
38
|
-
binding.pry
|
39
|
-
|
40
39
|
if @line_item.errors.blank?
|
40
|
+
|
41
41
|
@line_item.save
|
42
|
-
|
43
|
-
|
42
|
+
|
43
|
+
# recalculate the gross total amount
|
44
|
+
@invoice.reload.save
|
45
|
+
|
44
46
|
set_notification(true, @line_item.product.ean_sku, "Line Item '#{@line_item.product.name}' ADDED")
|
45
47
|
else
|
46
48
|
if product
|
@@ -64,9 +66,14 @@ module Vyapari
|
|
64
66
|
if @r_object
|
65
67
|
if @r_object.can_be_deleted?
|
66
68
|
@r_object.destroy
|
69
|
+
|
70
|
+
# recalculate the gross total amount
|
71
|
+
@invoice.reload.save
|
72
|
+
|
67
73
|
get_collections
|
68
74
|
set_flash_message(I18n.t('success.deleted'), :success)
|
69
75
|
set_notification(false, I18n.t('status.success'), I18n.t('success.deleted', item: default_item_name.titleize))
|
76
|
+
|
70
77
|
@destroyed = true
|
71
78
|
else
|
72
79
|
message = I18n.t('errors.failed_to_delete', item: default_item_name.titleize)
|
data/app/models/invoice.rb
CHANGED
@@ -14,7 +14,7 @@ class Invoice < Vyapari::ApplicationRecord
|
|
14
14
|
STATUS_HASH_REVERSE = {DRAFT => "Draft", ACTIVE => "Active", CANCELLED => "Cancelled"}
|
15
15
|
|
16
16
|
# Call backs
|
17
|
-
before_save :
|
17
|
+
before_save :calculate_gross_total_amount
|
18
18
|
|
19
19
|
# Validations
|
20
20
|
validates :invoice_number, :presence=> true
|
@@ -49,6 +49,11 @@ class Invoice < Vyapari::ApplicationRecord
|
|
49
49
|
scope :active, -> { where(status: ACTIVE) }
|
50
50
|
scope :cancelled, -> { where(status: CANCELLED) }
|
51
51
|
|
52
|
+
scope :cash_invoices, -> { where(payment_method: CASH) }
|
53
|
+
scope :credit_invoices, -> { where(payment_method: CREDIT) }
|
54
|
+
scope :credit_card_invoices, -> { where(payment_method: CREDIT_CARD) }
|
55
|
+
scope :cheque_invoices, -> { where(payment_method: CHEQUE) }
|
56
|
+
|
52
57
|
scope :this_month, lambda { where("created_at >= ? AND created_at <= ?", Time.zone.now.beginning_of_month, Time.zone.now.end_of_month) }
|
53
58
|
|
54
59
|
# ------------------
|
@@ -58,9 +63,11 @@ class Invoice < Vyapari::ApplicationRecord
|
|
58
63
|
def initialize
|
59
64
|
super
|
60
65
|
self.discount = 0.00
|
66
|
+
self.tax = 0.00
|
61
67
|
self.adjustment = 0.00
|
62
68
|
self.money_taken = 0.00
|
63
|
-
self.
|
69
|
+
self.gross_total_amount = 0.00
|
70
|
+
self.net_total_amount = 0.00
|
64
71
|
end
|
65
72
|
|
66
73
|
def display_name
|
@@ -208,16 +215,19 @@ class Invoice < Vyapari::ApplicationRecord
|
|
208
215
|
self.save
|
209
216
|
end
|
210
217
|
|
211
|
-
def
|
212
|
-
self.
|
218
|
+
def discount_amount
|
219
|
+
self.gross_total_amount * (self.discount / 100.00)
|
213
220
|
end
|
214
221
|
|
215
222
|
def balance_to_give
|
216
223
|
self.money_taken - self.net_total_amount
|
217
224
|
end
|
218
225
|
|
219
|
-
def
|
220
|
-
self.
|
226
|
+
def calculate_gross_total_amount
|
227
|
+
self.gross_total_amount = self.line_items.sum("rate * quantity") || 0.0
|
228
|
+
total_after_discount_and_tax = self.gross_total_amount - ( self.discount / 100.00 * self.gross_total_amount) + ( self.tax / 100.00 * self.gross_total_amount)
|
229
|
+
self.net_total_amount = total_after_discount_and_tax.round(2)
|
230
|
+
self.adjustment = self.net_total_amount - total_after_discount_and_tax
|
221
231
|
end
|
222
232
|
|
223
233
|
end
|
data/app/models/product.rb
CHANGED
@@ -61,7 +61,7 @@ class Product < Vyapari::ApplicationRecord
|
|
61
61
|
product.name = row[:name]
|
62
62
|
product.one_liner = row[:one_liner]
|
63
63
|
product.description = row[:description]
|
64
|
-
product.ean_sku = row[:ean_sku]
|
64
|
+
product.ean_sku = row[:ean_sku].to_s
|
65
65
|
product.reference_number = row[:reference_number]
|
66
66
|
|
67
67
|
product.brand = Brand.find_by_name(row[:brand])
|
data/app/models/store.rb
CHANGED
@@ -95,7 +95,8 @@ class Store < Vyapari::ApplicationRecord
|
|
95
95
|
# ------------------
|
96
96
|
|
97
97
|
def display_name
|
98
|
-
self.country ? "#{self.code_was}-#{self.name_was}, #{self.country.name}" : "#{self.code_was}-#{self.name_was}"
|
98
|
+
#self.country ? "#{self.code_was}-#{self.name_was}, #{self.country.name}" : "#{self.code_was}-#{self.name_was}"
|
99
|
+
"#{self.code_was}-#{self.name_was}"
|
99
100
|
end
|
100
101
|
|
101
102
|
def display_store_type
|
@@ -3,42 +3,6 @@
|
|
3
3
|
|
4
4
|
<%= form_for([:store_manager, @stock_bundle], :html => {:id=>"form_stock_bundle", :class=>"mb-0 form-horizontal", :stock_bundle => "form", :method => (@stock_bundle.new_record? ? :post : :put), multipart: true, :target => "iframe_document"}) do |f| %>
|
5
5
|
|
6
|
-
<div class="dx-warning mt-20" role="alert">
|
7
|
-
<p>
|
8
|
-
A <strong>Stock bundle</strong> is a collection of stock items you receive from a particular Supplier. To make it work for different suppliers, you should convert the excel / csv file you have received from the supplier to a common format so that the system undersand it.
|
9
|
-
|
10
|
-
<br><br>
|
11
|
-
<strong>Click here to view the
|
12
|
-
<%= link_to "Exmaple File", sample_file_link, target: "_blank" %>
|
13
|
-
format the system is expecting </strong>
|
14
|
-
<br><br>
|
15
|
-
|
16
|
-
The status of the Job Bunde will be <span class="ml-5 mt-5 label label-white">Pending</span> by default. You can verify it once again after uploading and can change the status to <span class="ml-5 mt-5 label label-success">Approved</span>. However, the system will not allow you to approve if it has any error. The error will be populated in an error file which the system will generate after parsing the uploaded file. It will be available for you to download once it is ready.
|
17
|
-
|
18
|
-
<br></br>
|
19
|
-
|
20
|
-
<span class="ml-5 mt-5 label label-danger">Pending</span> Stocks are not included in the reports and not shown on invoice line items.</li>
|
21
|
-
<li>You click on edit button in the list view against each stock bundle and reupload the corrected CSV file after rectifying the errors the system has pointed out.
|
22
|
-
|
23
|
-
<br></br>
|
24
|
-
|
25
|
-
<b>POINTS TO NOTE:</b>
|
26
|
-
<ul>
|
27
|
-
<li>Convert your .xlsx or .xls files to CSV format. You can do this easily with <b>Save As</b> Option in Microsoft Excel.</li>
|
28
|
-
|
29
|
-
<li>Create one <b>FILE</b> for one <b>SUPPLIER</b>.</li>
|
30
|
-
|
31
|
-
<li>CSV files can be created with Excel. However, do not use sheets / tabs as CSV has only one sheet always.</li>
|
32
|
-
|
33
|
-
<li>Upload one CSV file at a time (one each for a Supplier / Store combination).</li>
|
34
|
-
|
35
|
-
</ul>
|
36
|
-
|
37
|
-
<%= link_to(raw("<i class='fa fa-download mr-10'></i> Download the Sample CSV File"), sample_file_link, class: "btn btn-primary btn-only-hover", target: "_blank") %>
|
38
|
-
|
39
|
-
</p>
|
40
|
-
</div>
|
41
|
-
|
42
6
|
<% unless @stock_bundle.new_record? %>
|
43
7
|
<div class="alert alert-danger alert-dismissible mt-20 hidden" role="alert">
|
44
8
|
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
|
@@ -63,6 +27,10 @@
|
|
63
27
|
|
64
28
|
<div class="form-inputs mb-30 mt-30">
|
65
29
|
|
30
|
+
<%= theme_form_field(@stock_bundle, :name) %>
|
31
|
+
|
32
|
+
<%= theme_form_field(@stock_bundle, :file, html_options: {type: 'file'}, label: "Upload the Stock file in CSV format", param_name: "stock_bundle[file]") %>
|
33
|
+
|
66
34
|
<% if @stock_bundle && @stock_bundle.persisted? %>
|
67
35
|
|
68
36
|
<%= theme_form_group("Supplier", required: false, error_class: "error") do %>
|
@@ -77,11 +45,43 @@
|
|
77
45
|
<%= theme_form_assoc_group(@stock_bundle, :supplier_id, **options) %>
|
78
46
|
|
79
47
|
<% end %>
|
48
|
+
|
49
|
+
</div>
|
80
50
|
|
81
|
-
|
51
|
+
<div class="dx-warning mt-20" role="alert">
|
52
|
+
<p>
|
53
|
+
A <strong>Stock bundle</strong> is a collection of stock items you receive from a particular Supplier. To make it work for different suppliers, you should convert the excel / csv file you have received from the supplier to a common format so that the system undersand it.
|
82
54
|
|
83
|
-
|
84
|
-
|
55
|
+
<br><br>
|
56
|
+
<strong>Click here to view the
|
57
|
+
<%= link_to "Exmaple File", sample_file_link, target: "_blank" %>
|
58
|
+
format the system is expecting </strong>
|
59
|
+
<br><br>
|
60
|
+
|
61
|
+
The status of the Job Bunde will be <span class="ml-5 mt-5 label label-white">Pending</span> by default. You can verify it once again after uploading and can change the status to <span class="ml-5 mt-5 label label-success">Approved</span>. However, the system will not allow you to approve if it has any error. The error will be populated in an error file which the system will generate after parsing the uploaded file. It will be available for you to download once it is ready.
|
62
|
+
|
63
|
+
<br></br>
|
64
|
+
|
65
|
+
<span class="ml-5 mt-5 label label-danger">Pending</span> Stocks are not included in the reports and not shown on invoice line items.</li>
|
66
|
+
<li>You click on edit button in the list view against each stock bundle and reupload the corrected CSV file after rectifying the errors the system has pointed out.
|
67
|
+
|
68
|
+
<br></br>
|
69
|
+
|
70
|
+
<b>POINTS TO NOTE:</b>
|
71
|
+
<ul>
|
72
|
+
<li>Convert your .xlsx or .xls files to CSV format. You can do this easily with <b>Save As</b> Option in Microsoft Excel.</li>
|
73
|
+
|
74
|
+
<li>Create one <b>FILE</b> for one <b>SUPPLIER</b>.</li>
|
75
|
+
|
76
|
+
<li>CSV files can be created with Excel. However, do not use sheets / tabs as CSV has only one sheet always.</li>
|
77
|
+
|
78
|
+
<li>Upload one CSV file at a time (one each for a Supplier / Store combination).</li>
|
79
|
+
|
80
|
+
</ul>
|
81
|
+
|
82
|
+
<%= link_to(raw("<i class='fa fa-download mr-10'></i> Download the Sample CSV File"), sample_file_link, class: "btn btn-primary btn-only-hover", target: "_blank") %>
|
83
|
+
|
84
|
+
</p>
|
85
85
|
</div>
|
86
86
|
|
87
87
|
<div>
|
@@ -1,10 +1,10 @@
|
|
1
1
|
<%
|
2
2
|
active_invoices = @terminal.invoices.active.count
|
3
3
|
draft_invoices = @terminal.invoices.draft.count
|
4
|
-
active_amount = @terminal.invoices.active.sum(:
|
5
|
-
draft_amount = @terminal.invoices.draft.sum(:
|
4
|
+
active_amount = @terminal.invoices.active.sum(:net_total_amount)
|
5
|
+
draft_amount = @terminal.invoices.draft.sum(:net_total_amount)
|
6
6
|
cash_invoices = @terminal.invoices.active.where(payment_method: :cash).count
|
7
|
-
cash_in_hand =
|
7
|
+
cash_in_hand = @terminal.invoices.active.cash_invoices.sum(:net_total_amount)
|
8
8
|
total_sales = 100
|
9
9
|
%>
|
10
10
|
|
@@ -4,7 +4,7 @@
|
|
4
4
|
<tr>
|
5
5
|
<th>Invoice Number</th>
|
6
6
|
<th>Customer</th>
|
7
|
-
<th>Date</th>
|
7
|
+
<!-- <th>Date</th> -->
|
8
8
|
<th style="text-align: right;">Total Amount</th>
|
9
9
|
</tr>
|
10
10
|
</thead>
|
@@ -14,14 +14,19 @@
|
|
14
14
|
|
15
15
|
<tr id="tr_invoice_<%= invoice.id %>">
|
16
16
|
|
17
|
-
|
17
|
+
<% customer_name = invoice.customer_name || "GUEST-#{invoice.id}-#{@store.code}-" %>
|
18
18
|
|
19
|
-
|
20
|
-
|
19
|
+
<% if invoice.draft? %>
|
20
|
+
<td class="invoice-name"><%= link_to invoice.invoice_number, edit_terminal_staff_invoice_path(@terminal, invoice), remote: true %></td>
|
21
|
+
<td class="invoice-name"><%= link_to customer_name, edit_terminal_staff_invoice_path(@terminal, invoice), remote: true %></td>
|
22
|
+
<% else %>
|
23
|
+
<td class="invoice-name"><%= link_to invoice.invoice_number, terminal_staff_invoice_path(@terminal, invoice), remote: true %></td>
|
24
|
+
<td class="invoice-name"><%= link_to customer_name, terminal_staff_invoice_path(@terminal, invoice), remote: true %></td>
|
25
|
+
<% end %>
|
21
26
|
|
22
|
-
<td class="invoice-name" style="text-align: center;"
|
27
|
+
<!-- <td class="invoice-name" style="text-align: center;"><%#= invoice.invoice_date.strftime("%m/%d/%Y") if invoice.invoice_date %></td> -->
|
23
28
|
|
24
|
-
<td class="invoice-name" style="text-align: center;"><%= number_to_currency invoice.
|
29
|
+
<td class="invoice-name" style="text-align: center;"><%= number_to_currency invoice.net_total_amount, unit: "" %></td>
|
25
30
|
|
26
31
|
</tr>
|
27
32
|
<% end %>
|
@@ -29,11 +29,11 @@
|
|
29
29
|
|
30
30
|
<div class="col-md-3 col-sm-12 col-xs-12">
|
31
31
|
|
32
|
-
<% print_link =
|
32
|
+
<% print_link = terminal_staff_invoice_path(@terminal, @invoice) %>
|
33
33
|
|
34
34
|
<% delete_link = terminal_staff_invoice_path(@terminal, @invoice) %>
|
35
35
|
|
36
|
-
<%= link_to raw("<i class=\"fa-print\"></i> Print Invoice"), print_link, :
|
36
|
+
<%= link_to raw("<i class=\"fa-print\"></i> Print Invoice"), print_link, target: "_blank", class: "btn btn-block btn-white" if @invoice.active? %>
|
37
37
|
|
38
38
|
<%= link_to raw("<i class=\"linecons-trash\"></i> Delete"), delete_link, method: :delete, invoice: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "btn btn-block btn-danger btn-only-hover" if @invoice.can_be_deleted? %>
|
39
39
|
|
@@ -29,6 +29,20 @@
|
|
29
29
|
</div>
|
30
30
|
</div>
|
31
31
|
|
32
|
+
<div class="row mt-10 mb-10">
|
33
|
+
<div class="col-md-4">Customer Phone:</div>
|
34
|
+
<div class="col-md-8">
|
35
|
+
<%= f.text_field(:customer_phone, style: "width:100%;") %>
|
36
|
+
</div>
|
37
|
+
</div>
|
38
|
+
|
39
|
+
<div class="row mt-10 mb-10">
|
40
|
+
<div class="col-md-4">Customer Email:</div>
|
41
|
+
<div class="col-md-8">
|
42
|
+
<%= f.text_field(:customer_email, style: "width:100%;") %>
|
43
|
+
</div>
|
44
|
+
</div>
|
45
|
+
|
32
46
|
<div class="row mt-10 mb-10">
|
33
47
|
<div class="col-md-4">Payment Method:</div>
|
34
48
|
<div class="col-md-8">
|
@@ -53,7 +67,7 @@
|
|
53
67
|
<div class="row mt-10 mb-10">
|
54
68
|
<div class="col-md-4">Credit Card Number:</div>
|
55
69
|
<div class="col-md-8">
|
56
|
-
<%= f.text_field(:
|
70
|
+
<%= f.text_field(:credit_card_number, style: ";width:100%;") %>
|
57
71
|
</div>
|
58
72
|
</div>
|
59
73
|
|
@@ -74,7 +88,7 @@
|
|
74
88
|
<div class="col-md-6">
|
75
89
|
|
76
90
|
<div class="row mt-10 mb-10">
|
77
|
-
<div class="col-md-4 col-md-offset-2">Discount:</div>
|
91
|
+
<div class="col-md-4 col-md-offset-2">Discount (%):</div>
|
78
92
|
<div class="col-md-4">
|
79
93
|
<%= f.text_field(:discount, style: "text-align: right;width:100%;") %>
|
80
94
|
</div>
|
@@ -38,7 +38,7 @@
|
|
38
38
|
|
39
39
|
<td class="invoice-name" style="text-align: center;"><%= invoice.display_payment_method %></td>
|
40
40
|
|
41
|
-
<td class="invoice-name" style="text-align: center;"><%= number_to_currency invoice.
|
41
|
+
<td class="invoice-name" style="text-align: center;"><%= number_to_currency invoice.net_total_amount, unit: "" %></td>
|
42
42
|
|
43
43
|
<td class="invoice-name" style="text-align: center;"><%= invoice.display_status %></td>
|
44
44
|
|
@@ -18,7 +18,7 @@
|
|
18
18
|
|
19
19
|
<td class="invoice-name" style="text-align: center;"><%= @invoice.user.display_payment_method %></td>
|
20
20
|
|
21
|
-
<td class="invoice-name" style="text-align: center;"><%= number_to_currency invoice.
|
21
|
+
<td class="invoice-name" style="text-align: center;"><%= number_to_currency invoice.net_total_amount, unit: "" %></td>
|
22
22
|
|
23
23
|
<td class="invoice-name"><%= invoice.display_status %></td>
|
24
24
|
|
@@ -1,171 +1,204 @@
|
|
1
|
-
<
|
2
|
-
|
3
|
-
|
1
|
+
<style type="text/css">
|
2
|
+
@media print {
|
3
|
+
.body { font-size: 16px; }
|
4
|
+
.invoice-header { font-size: 18px; }
|
5
|
+
|
6
|
+
}
|
7
|
+
</style>
|
8
|
+
|
9
|
+
<div class="panel panel-default" style="width:100%;">
|
10
|
+
<div class="panel-heading hidden-print">
|
11
|
+
<strong>#<%= @invoice.invoice_number %></strong>
|
12
|
+
</div>
|
13
|
+
<div class="panel-body">
|
14
|
+
|
15
|
+
<section class="invoice-env">
|
16
|
+
|
17
|
+
<!-- Invoice header -->
|
18
|
+
<div class="invoice-header" style="font-size:16px;">
|
19
|
+
|
20
|
+
<!-- Invoice Options Buttons -->
|
21
|
+
<div class="invoice-options hidden-print">
|
4
22
|
|
5
|
-
|
23
|
+
<% if request.xhr? %>
|
24
|
+
|
25
|
+
|
26
|
+
<%= link_to edit_terminal_staff_invoice_path(@terminal, @invoice), remote: true, class: "btn btn-block btn-secondary btn-icon btn-icon-standalone btn-icon-standalone-right text-left" do %>
|
27
|
+
<i class="fa-envelope-o"></i>
|
28
|
+
<span>Edit</span>
|
29
|
+
<% end %>
|
30
|
+
|
31
|
+
<%= link_to terminal_staff_invoice_path(@terminal, @invoice), class: "btn btn-block btn-gray btn-icon btn-icon-standalone btn-icon-standalone-right btn-single text-left", target: "_blank" do %>
|
32
|
+
<i class="fa-print"></i>
|
33
|
+
<span>Preview</span>
|
34
|
+
<% end %>
|
35
|
+
|
36
|
+
<% else %>
|
37
|
+
|
38
|
+
<%= link_to "#", class: "btn btn-block btn-secondary btn-icon btn-icon-standalone btn-icon-standalone-right btn-single text-left", onclick: "window.print();" do %>
|
39
|
+
<i class="fa-print"></i>
|
40
|
+
<span>Print</span>
|
41
|
+
<% end %>
|
42
|
+
|
43
|
+
<% end %>
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<!-- Invoice Data Header -->
|
47
|
+
<div class="invoice-logo">
|
48
|
+
|
49
|
+
<a href="#" class="logo">
|
50
|
+
<img src="/assets/kuppayam/logo.png" class="img-responsive" width="200" />
|
51
|
+
</a>
|
52
|
+
|
53
|
+
<ul class="list-unstyled mt-30">
|
54
|
+
<li class="upper fs-20">Invoice No: <strong>#<%= @invoice.invoice_number%></strong></li>
|
55
|
+
<li class="mt-10">Invoice No: <%= @invoice.invoice_date.strftime("%m/%d/%Y") %></li>
|
56
|
+
<!-- <li>Dubai</li> -->
|
57
|
+
</ul>
|
58
|
+
|
59
|
+
</div>
|
60
|
+
|
61
|
+
</div>
|
62
|
+
|
63
|
+
|
64
|
+
<!-- Client and Payment Details -->
|
65
|
+
<div class="invoice-details">
|
66
|
+
|
67
|
+
<div class="invoice-client-info">
|
6
68
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
<
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
<strong>Payment Details</strong>
|
62
|
-
|
63
|
-
<ul class="list-unstyled">
|
64
|
-
<li>V.A.T Reg #: <strong>542554(DEMO)78</strong></li>
|
65
|
-
<li>Account Name: <strong>FoodMaster Ltd</strong> </li>
|
66
|
-
<li>SWIFT code: <strong>45454DEMO545DEMO</strong></li>
|
67
|
-
</ul>
|
68
|
-
</div>
|
69
|
-
|
70
|
-
</div>
|
71
|
-
|
72
|
-
|
73
|
-
<!-- Invoice Entries -->
|
74
|
-
<table class="table table-bordered">
|
75
|
-
<thead>
|
76
|
-
<tr class="no-borders">
|
77
|
-
<th class="text-center hidden-xs">#</th>
|
78
|
-
<th width="60%" class="text-center">Product</th>
|
79
|
-
<th class="text-center hidden-xs">Quantity</th>
|
80
|
-
<th class="text-center">Price</th>
|
81
|
-
</tr>
|
82
|
-
</thead>
|
83
|
-
|
84
|
-
<tbody>
|
85
|
-
<tr>
|
86
|
-
<td class="text-center hidden-xs">1</td>
|
87
|
-
<td>On am we offices expense thought</td>
|
88
|
-
<td class="text-center hidden-xs">1</td>
|
89
|
-
<td class="text-right text-primary text-bold">$1,290</td>
|
90
|
-
</tr>
|
91
|
-
|
92
|
-
<tr>
|
93
|
-
<td class="text-center hidden-xs">2</td>
|
94
|
-
<td>Up do view time they shot</td>
|
95
|
-
<td class="text-center hidden-xs">1</td>
|
96
|
-
<td class="text-right text-primary text-bold">$400</td>
|
97
|
-
</tr>
|
98
|
-
|
99
|
-
<tr>
|
100
|
-
<td class="text-center hidden-xs">3</td>
|
101
|
-
<td>Way ham unwilling not breakfast</td>
|
102
|
-
<td class="text-center hidden-xs">1</td>
|
103
|
-
<td class="text-right text-primary text-bold">$550</td>
|
104
|
-
</tr>
|
105
|
-
|
106
|
-
<tr>
|
107
|
-
<td class="text-center hidden-xs">4</td>
|
108
|
-
<td>Songs to an blush woman be sorry</td>
|
109
|
-
<td class="text-center hidden-xs">1</td>
|
110
|
-
<td class="text-right text-primary text-bold">$4020</td>
|
111
|
-
</tr>
|
112
|
-
|
113
|
-
<tr>
|
114
|
-
<td class="text-center hidden-xs">5</td>
|
115
|
-
<td>Luckily offered article led lasting</td>
|
116
|
-
<td class="text-center hidden-xs">1</td>
|
117
|
-
<td class="text-right text-primary text-bold">$87</td>
|
118
|
-
</tr>
|
119
|
-
|
120
|
-
<tr>
|
121
|
-
<td class="text-center hidden-xs">6</td>
|
122
|
-
<td>Of as by belonging therefore suspicion</td>
|
123
|
-
<td class="text-center hidden-xs">1</td>
|
124
|
-
<td class="text-right text-primary text-bold">$140</td>
|
125
|
-
</tr>
|
126
|
-
</tbody>
|
127
|
-
</table>
|
128
|
-
|
129
|
-
<!-- Invoice Subtotals and Totals -->
|
130
|
-
<div class="invoice-totals">
|
131
|
-
|
132
|
-
<div class="invoice-subtotals-totals">
|
133
|
-
<span>
|
134
|
-
Sub - Total amount:
|
135
|
-
<strong>$6,487</strong>
|
136
|
-
</span>
|
137
|
-
|
138
|
-
<span>
|
139
|
-
VAT:
|
140
|
-
<strong>12.9%</strong>
|
141
|
-
</span>
|
142
|
-
|
143
|
-
<span>
|
144
|
-
Discount:
|
145
|
-
<strong>-----</strong>
|
146
|
-
</span>
|
147
|
-
|
148
|
-
<hr />
|
149
|
-
|
150
|
-
<span>
|
151
|
-
Grand Total:
|
152
|
-
<strong>$7,304</strong>
|
153
|
-
</span>
|
154
|
-
</div>
|
155
|
-
|
156
|
-
<div class="invoice-bill-info">
|
157
|
-
<address>
|
158
|
-
795 Park Ave, Suite 120<br />
|
159
|
-
San Francisco, CA 94107<br />
|
160
|
-
P: (234) 145-1810 <br />
|
161
|
-
Full Name <br />
|
162
|
-
<a href="#">first.last@email.com</a>
|
163
|
-
</address>
|
164
|
-
</div>
|
165
|
-
|
166
|
-
</div>
|
167
|
-
|
168
|
-
</section>
|
69
|
+
<% if @invoice.customer_name %>
|
70
|
+
|
71
|
+
<strong>Customer Info</strong>
|
72
|
+
<ul class="list-unstyled">
|
73
|
+
<li><%= @invoice.customer_name %></li>
|
74
|
+
<li><%= @invoice.customer_phone %></li>
|
75
|
+
</ul>
|
76
|
+
<% end %>
|
77
|
+
|
78
|
+
<ul class="list-unstyled">
|
79
|
+
<li><%= @invoice.customer_email %></li>
|
80
|
+
<li><%= @invoice.customer_address %></li>
|
81
|
+
</ul>
|
82
|
+
</div>
|
83
|
+
|
84
|
+
<div class="invoice-payment-info" style="text-align: left">
|
85
|
+
<strong>Payment Details</strong>
|
86
|
+
|
87
|
+
<ul class="list-unstyled">
|
88
|
+
<li>Payment Method: <strong><%= @invoice.display_payment_method %></strong></li>
|
89
|
+
<% if @invoice.credit_card? %>
|
90
|
+
<li>Credit Card Number: <strong><%= @invoice.credit_card_number %></strong> </li>
|
91
|
+
<% end %>
|
92
|
+
</ul>
|
93
|
+
</div>
|
94
|
+
|
95
|
+
</div>
|
96
|
+
|
97
|
+
|
98
|
+
<!-- Invoice Entries -->
|
99
|
+
<table class="table table-bordered mt-60">
|
100
|
+
<thead>
|
101
|
+
<tr style="background-color: #4b4b4b; color:red;">
|
102
|
+
<th width="10%" class="text-center">No</th>
|
103
|
+
<th width="40%" class="text-center">Item</th>
|
104
|
+
<th width="15%" class="text-center">Unit Price</th>
|
105
|
+
<th width="15%" class="text-center">Quantity</th>
|
106
|
+
<th width="20%" class="text-center">Price</th>
|
107
|
+
</tr>
|
108
|
+
</thead>
|
109
|
+
|
110
|
+
<tbody>
|
111
|
+
<% @invoice.line_items.each_with_index do |line_item, i| %>
|
112
|
+
<tr>
|
113
|
+
<td class="text-center">
|
114
|
+
<%= i + 1 + (@per_page.to_i * (@current_page.to_i - 1)) %>
|
115
|
+
</td>
|
116
|
+
<td><%= line_item.product.display_name %></td>
|
117
|
+
<td class="text-center">
|
118
|
+
<%= number_to_currency line_item.product.retail_price, unit: "AED " %>
|
119
|
+
<td class="text-center"><%= line_item.quantity %></td>
|
120
|
+
<td class="text-right text-primary text-bold"><%= number_to_currency line_item.total_amount, unit: "AED " %></td>
|
121
|
+
</tr>
|
122
|
+
<% end %>
|
169
123
|
|
124
|
+
</tbody>
|
125
|
+
</table>
|
126
|
+
|
127
|
+
<!-- Invoice Subtotals and Totals -->
|
128
|
+
<div class="invoice-totals mt-40">
|
129
|
+
|
130
|
+
<div class="invoice-subtotals-totals">
|
131
|
+
<span class="mt-10 fs-20">
|
132
|
+
Total Amount:
|
133
|
+
<strong><%= number_to_currency @invoice.gross_total_amount, unit: "AED " %></strong>
|
134
|
+
</span>
|
135
|
+
|
136
|
+
<% if @invoice.tax > 0.00 %>
|
137
|
+
<span class="mt-10 fs-20">
|
138
|
+
Tax:
|
139
|
+
<strong><%= number_to_currency @invoice.tax, unit: "" %></strong>
|
140
|
+
</span>
|
141
|
+
<% end %>
|
142
|
+
|
143
|
+
<% if @invoice.discount %>
|
144
|
+
<span class="mt-10 fs-20">
|
145
|
+
Discount (<%= number_to_currency @invoice.discount, unit: "%" %>):
|
146
|
+
<strong><%= number_to_currency @invoice.discount_amount, unit: "AED " %></strong>
|
147
|
+
</span>
|
148
|
+
<% end %>
|
149
|
+
|
150
|
+
<hr />
|
151
|
+
|
152
|
+
<span class="mt-10 fs-20">
|
153
|
+
Net Total:
|
154
|
+
<strong><%= number_to_currency @invoice.net_total_amount, unit: "AED " %></strong>
|
155
|
+
</span>
|
156
|
+
</div>
|
157
|
+
|
158
|
+
<div class="invoice-bill-info">
|
159
|
+
<address>
|
160
|
+
<strong>SELAYIA INVESTMENT</strong><br />
|
161
|
+
P O BOX: 63995, Dubai, U.A.E<br />
|
162
|
+
<!-- Office #505, Sama Tower<br />
|
163
|
+
Sheikh Zayed Road<br /> -->
|
164
|
+
P: +971 4 355 9333 <br />
|
165
|
+
F: +971 4 355 0365 <br />
|
166
|
+
<br />
|
167
|
+
</address>
|
168
|
+
</div>
|
169
|
+
|
170
|
+
</div>
|
171
|
+
|
172
|
+
<hr />
|
173
|
+
|
174
|
+
<!-- Invoice header -->
|
175
|
+
<div class="invoice-footer fs-12 lh-20 mt-40">
|
176
|
+
|
177
|
+
<!-- Invoice Data Header -->
|
178
|
+
<div class="terminal_info" style="float:left;width:40%">
|
179
|
+
|
180
|
+
<ul class="list-unstyled">
|
181
|
+
<li class="upper">Terminal: <%= @terminal.display_name %></li>
|
182
|
+
<li class="upper">Store: <%= @store.display_name %></li>
|
183
|
+
<li>Timestamp: <%= @invoice.invoice_date.strftime("%m/%d/%Y - %H:%M:%S") %></li>
|
184
|
+
<li>Sales Staff: <%= @invoice.user.display_name %></li>
|
185
|
+
</ul>
|
186
|
+
|
187
|
+
</div>
|
188
|
+
|
189
|
+
<div class="terms_and_conditions" style="float:right;width:60%">
|
190
|
+
|
191
|
+
<strong>Terms & Conditions</strong> <br>
|
192
|
+
|
193
|
+
There is no refund for items sold. <br>
|
194
|
+
The items sold may be exchanged until end of the event upon producing the original invoice.
|
195
|
+
|
170
196
|
</div>
|
197
|
+
|
198
|
+
<div class="clearfix"></div>
|
199
|
+
</div>
|
200
|
+
|
201
|
+
</section>
|
202
|
+
|
203
|
+
</div>
|
171
204
|
</div>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<% if @invoice %>
|
2
|
+
|
3
|
+
// Show the details in the large modal
|
4
|
+
var heading = "<%= raw @invoice.try(:invoice_number) %>";
|
5
|
+
var bodyContent = "<%= escape_javascript(render(:partial=>"#{@resource_options[:view_path]}/show")) %>";
|
6
|
+
showLargeModal(heading, bodyContent, false);
|
7
|
+
|
8
|
+
<% else %>
|
9
|
+
|
10
|
+
// Showing Growl Like Message
|
11
|
+
notifyError("<%= escape_javascript(@notification[:title]) %>", "<%= escape_javascript(raw(@notification[:message])) %>");
|
12
|
+
|
13
|
+
<% end %>
|
@@ -48,6 +48,8 @@
|
|
48
48
|
|
49
49
|
<% @invoice.line_items.each_with_index do |line_item, i| %>
|
50
50
|
|
51
|
+
<% next unless line_item.persisted? %>
|
52
|
+
|
51
53
|
<div class="row ili" id="div_line_item_<%= line_item.id %>">
|
52
54
|
|
53
55
|
<%# edit_link = edit_terminal_staff_invoice_line_item_path(@invoice, line_item, terminal_id: @terminal.id) %>
|
@@ -87,7 +89,7 @@
|
|
87
89
|
<div class="row mt-10 mb-10" style="font-weight: bold;">
|
88
90
|
<div class="col-md-2 col-md-offset-7">Gross Total:</div>
|
89
91
|
<div class="col-md-2" style="text-align: right">
|
90
|
-
<%= number_to_currency @invoice.
|
92
|
+
<%= number_to_currency @invoice.gross_total_amount, unit: "AED " %>
|
91
93
|
</div>
|
92
94
|
</div>
|
93
95
|
|
@@ -22,13 +22,13 @@
|
|
22
22
|
<% error_message = content_tag(:div, raw(@notification[:message]), class: "alert alert-danger mt-20") %>
|
23
23
|
$("#invoice_form_error").html("<%= escape_javascript(error_message) %>");
|
24
24
|
$("#invoice_form_error").show();
|
25
|
-
|
26
|
-
// Set the mouse focus on the EAN input field
|
27
|
-
$( "#div_line_item_form .li-item-name input").focus().select();
|
28
25
|
|
29
26
|
// Showing Growl Like Message
|
30
27
|
notifyError("<%= escape_javascript(@notification[:title]) %>", "<%= escape_javascript(raw(@notification[:message])) %>");
|
31
28
|
|
32
29
|
<% end %>
|
33
30
|
|
31
|
+
// Set the mouse focus on the EAN input field
|
32
|
+
$( "#div_line_item_form .li-item-name input").focus().select();
|
33
|
+
|
34
34
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<% if @destroyed %>
|
2
2
|
|
3
3
|
// Removing the item from the list
|
4
|
-
$(
|
4
|
+
$("#div_line_item_index").html("<%= escape_javascript(render(:partial=>"/vyapari/terminal_staff/line_items/index")) %>");
|
5
5
|
$("#div_invoice_form").html("<%= escape_javascript(render(:partial=>"/vyapari/terminal_staff/invoices/form")) %>");
|
6
6
|
|
7
7
|
// Hide errors
|
@@ -7,10 +7,14 @@ class CreateInvoices < ActiveRecord::Migration[5.0]
|
|
7
7
|
|
8
8
|
t.string :customer_name
|
9
9
|
t.string :customer_address
|
10
|
+
t.string :customer_phone
|
11
|
+
t.string :customer_email
|
10
12
|
|
11
|
-
t.
|
13
|
+
t.decimal :discount
|
12
14
|
t.decimal :tax
|
13
|
-
t.decimal :
|
15
|
+
t.decimal :gross_total_amount
|
16
|
+
t.decimal :net_total_amount
|
17
|
+
t.decimal :adjustment
|
14
18
|
|
15
19
|
t.text :notes
|
16
20
|
|
@@ -18,7 +22,6 @@ class CreateInvoices < ActiveRecord::Migration[5.0]
|
|
18
22
|
t.string :payment_method, :null => false, :default=>"cash", :limit=>16
|
19
23
|
|
20
24
|
# If Cash
|
21
|
-
t.decimal :adjustment
|
22
25
|
t.decimal :money_taken
|
23
26
|
|
24
27
|
# If Cheque
|
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.5dev2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kpvarma
|
@@ -461,11 +461,11 @@ files:
|
|
461
461
|
- app/views/vyapari/terminal_staff/invoices/index.html.erb
|
462
462
|
- app/views/vyapari/terminal_staff/invoices/new.js.erb
|
463
463
|
- app/views/vyapari/terminal_staff/invoices/show.html.erb
|
464
|
+
- app/views/vyapari/terminal_staff/invoices/show.js.erb
|
464
465
|
- app/views/vyapari/terminal_staff/line_items/_form.html.erb
|
465
466
|
- app/views/vyapari/terminal_staff/line_items/_index.html.erb
|
466
467
|
- app/views/vyapari/terminal_staff/line_items/create.js.erb
|
467
468
|
- app/views/vyapari/terminal_staff/line_items/destroy.js.erb
|
468
|
-
- app/views/vyapari/terminal_staff/stores/index.html.erb
|
469
469
|
- app/views/vyapari/user_dashboard/index.html.erb
|
470
470
|
- config/routes.rb
|
471
471
|
- db/import_data/brands.csv
|
@@ -1,24 +0,0 @@
|
|
1
|
-
<div class="row">
|
2
|
-
|
3
|
-
<% @stores.each do |store| %>
|
4
|
-
<div class="col-sm-4">
|
5
|
-
<div class="xe-widget xe-counter xe-counter-info" style="min-height:160px;max-height: 160px;overflow:hidden;">
|
6
|
-
<div class="xe-icon">
|
7
|
-
<i class="fa fa-building-o"></i>
|
8
|
-
</div>
|
9
|
-
<div class="xe-label">
|
10
|
-
<strong class="num"><%= store.code %></strong>
|
11
|
-
<span><%= store.name %></span>
|
12
|
-
<hr>
|
13
|
-
<div class="mt-10"></div>
|
14
|
-
<%= link_to "Dashboard", store_manager_dashboard_path(store) %>
|
15
|
-
<!-- <div class="mt-5"></div> -->
|
16
|
-
<%#= link_to "Manage Stock", store_manager_stock_entries_path(store) %>
|
17
|
-
<div class="mt-5"></div>
|
18
|
-
<%= link_to "Upload new Stock", store_manager_stock_bundles_path(store) %>
|
19
|
-
</div>
|
20
|
-
</div>
|
21
|
-
</div>
|
22
|
-
<% end %>
|
23
|
-
|
24
|
-
</div>
|