diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 9cca8f1c..9a967300 100755 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -76,10 +76,10 @@ class HomeController < ApplicationController @total_sale = Sale.total_sale(today) @total_count = Sale.total_count(today) - - puts @grand_total.to_json - puts @total_count - puts "ssssssssssss" + @total_card = Sale.total_card_sale(today) + @total_credit = Sale.credit_payment(today) +puts "ssss" +puts @total_card.to_json end def destroy diff --git a/app/models/sale.rb b/app/models/sale.rb index 306592c2..37e284cb 100755 --- a/app/models/sale.rb +++ b/app/models/sale.rb @@ -876,6 +876,25 @@ end total = Sale.where('sale_status = "completed" and DATE_FORMAT(receipt_date,"%Y-%m-%d") = ?',today).count end + def self.total_card_sale(today) + payment_type = " and payment_method = 'mpu' or payment_method = 'visa' or payment_method = 'master' or payment_method = 'jcb' " + # query = Sale.select("SUM(tax_payable_amount) AS st_amount,tax_name") + # .where('sale_status = "completed" #{payment_type} and DATE_FORMAT(receipt_date,"%Y-%m-%d") = ?',today) + # .joins("join sale_payments on sale_id = sales.sale_id") + # .group("sales.sale_id") + + query = SalePayment.where('s.sale_status = "completed" and payment_method = "mpu" or payment_method = "visa" or payment_method = "master" or payment_method = "jcb" and DATE_FORMAT(s.receipt_date,"%Y-%m-%d") = ?',today) + .joins("INNER JOIN sales s ON s.sale_id = sale_payments.sale_id") + .sum("payment_amount") + + end + + def self.credit_payment(today) + query = SalePayment.where('s.sale_status = "completed" and payment_method="creditnote" and DATE_FORMAT(s.receipt_date,"%Y-%m-%d") = ?',today) + .joins("INNER JOIN sales s ON s.sale_id = sale_payments.sale_id") + .sum("payment_amount") + end + private def generate_custom_id diff --git a/app/views/home/dashboard.html.erb b/app/views/home/dashboard.html.erb index 7dda39a4..6aaa0624 100755 --- a/app/views/home/dashboard.html.erb +++ b/app/views/home/dashboard.html.erb @@ -5,47 +5,48 @@
-
-
-
- attach_money -
-
-
TODAY TOTAL SALE
-
-
-
-
help
-
TODAY SALE COUNT
+
SALE COUNT
-
+
- forum + attach_money
-
NEW COMMENTS
-
+
TOTAL SALE
+
+
+
+
+ +
+
+
+ person_add +
+
+
TOTAL CREDIT
+
- person_add + credit_card
-
NEW VISITORS
-
+
TOTAL CARD
+
diff --git a/app/views/settings/accounts/_form.html.erb b/app/views/settings/accounts/_form.html.erb index 7b85dad6..ea80dcd6 100755 --- a/app/views/settings/accounts/_form.html.erb +++ b/app/views/settings/accounts/_form.html.erb @@ -1,7 +1,8 @@ -<%= simple_form_for([:settings,@settings_account]) do |f| %> - <%= f.error_notification %> - -
+
+
+ <%= simple_form_for([:settings,@settings_account]) do |f| %> + <%= f.error_notification %> +
<%= f.input :title %> <%= f.input :account_type, :collection => Lookup.collection_of("account_type") %> <%= f.input :discount %> @@ -9,9 +10,19 @@ <%= f.input :bonus %> <%= f.input :rebate %>
-
- <%= f.submit "Create Account",:class => 'btn btn-primary btn-lg waves-effect' %> + <%= f.submit "Submit",:class => 'btn btn-primary btn-lg waves-effect' %>
- -<% end %> + <% end %> +
+
+
+
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod + tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, + quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo + consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse +
+
+
+
diff --git a/app/views/settings/accounts/edit.html.erb b/app/views/settings/accounts/edit.html.erb index 9c116ea9..d97b8659 100755 --- a/app/views/settings/accounts/edit.html.erb +++ b/app/views/settings/accounts/edit.html.erb @@ -1,20 +1,10 @@ - diff --git a/app/views/settings/accounts/new.html.erb b/app/views/settings/accounts/new.html.erb index bbdab153..68fc6501 100755 --- a/app/views/settings/accounts/new.html.erb +++ b/app/views/settings/accounts/new.html.erb @@ -4,7 +4,7 @@ - <%= link_to t('.new', :default => t("views.btn.new")), settings_accounts_path %> + <%= link_to t('.back', :default => t("views.btn.back")), settings_accounts_path %>
diff --git a/app/views/settings/accounts/show.html.erb b/app/views/settings/accounts/show.html.erb index 8321c487..1f3853d4 100755 --- a/app/views/settings/accounts/show.html.erb +++ b/app/views/settings/accounts/show.html.erb @@ -36,7 +36,7 @@ <%= @settings_account.rebate %> - <%= link_to t("views.btn.edit"), edit_settings_account_path(@settings_account, @settings_account),:class => 'btn btn-primary btn-lg waves-effect' %> + <%= link_to t("views.btn.edit"), edit_settings_account_path(@settings_account),:class => 'btn btn-primary btn-sm waves-effect' %> diff --git a/app/views/settings/cashier_terminals/_form.html.erb b/app/views/settings/cashier_terminals/_form.html.erb index 1ba525e6..513934d4 100755 --- a/app/views/settings/cashier_terminals/_form.html.erb +++ b/app/views/settings/cashier_terminals/_form.html.erb @@ -3,7 +3,7 @@ <%= simple_form_for([:settings, @settings_cashier_terminal]) do |f| %> <%= f.error_notification %> -
+
<%= f.input :name %> <%= f.input :is_active %> <%= f.input :is_currently_login %> @@ -19,7 +19,7 @@
- <%= f.submit "Create Cashier Terminal",:class => 'btn btn-primary btn-lg waves-effect' %> + <%= f.submit "Submit",:class => 'btn btn-primary btn-lg waves-effect' %>
<% end %>
diff --git a/app/views/settings/cashier_terminals/show.html.erb b/app/views/settings/cashier_terminals/show.html.erb index a9232d35..62e02b43 100755 --- a/app/views/settings/cashier_terminals/show.html.erb +++ b/app/views/settings/cashier_terminals/show.html.erb @@ -1,7 +1,7 @@