From e727b8b22ebeab06ee228e958f5ef6a3cdee2e6d Mon Sep 17 00:00:00 2001 From: phyusin Date: Mon, 11 Dec 2017 17:39:19 +0630 Subject: [PATCH 01/10] check table status for late data and check pending showing when there is no item in origami --- app/models/sale_payment.rb | 4 ++++ app/views/origami/home/show.html.erb | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/models/sale_payment.rb b/app/models/sale_payment.rb index 9fb4e9ae..1ef4f665 100755 --- a/app/models/sale_payment.rb +++ b/app/models/sale_payment.rb @@ -369,6 +369,7 @@ class SalePayment < ApplicationRecord def table_update_status(sale_obj) status = true booking = Booking.find_by_sale_id(sale_obj.id) + if booking table = DiningFacility.find(booking.dining_facility_id) bookings = table.bookings @@ -377,12 +378,15 @@ class SalePayment < ApplicationRecord if tablebooking.sale_id if tablebooking.sale.sale_status != 'completed' && tablebooking.sale.sale_status != 'void' status = false + else + status = true end else status = false end end end + if status table.status = "available" table.save diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb index 6d83f852..0b98ac76 100755 --- a/app/views/origami/home/show.html.erb +++ b/app/views/origami/home/show.html.erb @@ -237,7 +237,7 @@ end if @status_order == 'order' && @status_sale != 'sale' - unless @order_items.nil? + unless @order_items.nil? || @order_items.empty? count = 0 @order_items.each do |order_item| count += 1 @@ -306,7 +306,7 @@ <% if @status_sale == 'sale' - unless @order_items.nil? + unless @order_items.nil? || @order_items.empty? %> Pending New Order From f11145cbd127aeaa35e6f72d6c41a09a473a8221 Mon Sep 17 00:00:00 2001 From: Yan Date: Tue, 12 Dec 2017 10:35:26 +0630 Subject: [PATCH 02/10] disable no rebate if credit note --- app/models/sale_payment.rb | 149 +++++++++++++++++++------------------ 1 file changed, 76 insertions(+), 73 deletions(-) diff --git a/app/models/sale_payment.rb b/app/models/sale_payment.rb index 9fb4e9ae..6e48e716 100755 --- a/app/models/sale_payment.rb +++ b/app/models/sale_payment.rb @@ -323,7 +323,7 @@ class SalePayment < ApplicationRecord self.sale.sale_status = "completed" - if MembershipSetting.find_by_rebate(1) && is_foc == 0 + if MembershipSetting.find_by_rebate(1) && is_foc == 0 && is_credit == 0 response = rebat(sObj) #record an payment in sale-audit @@ -410,6 +410,7 @@ class SalePayment < ApplicationRecord # overall_dis = SaleItem.get_overall_discount(sObj.id) overall_dis = sObj.total_discount + if credit != 1 membership = MembershipSetting.find_by_membership_type("paypar_url") memberaction = MembershipAction.find_by_membership_type("get_member_campaign") merchant_uid = memberaction.merchant_account_id.to_s @@ -438,87 +439,89 @@ class SalePayment < ApplicationRecord rescue SocketError response = { "status": false, "message": "Can't connect server"} end - redeem_amount = payparcost + overall_dis - total_percentage = 0 + redeem_amount = payparcost + overall_dis - type_arr = [] - Rails.logger.debug "Get Member Campaign" - Rails.logger.debug response.to_json - # Check for present response fields - if response["membership_campaign_data"].present? - response["membership_campaign_data"].each do |a| - data = {:type => a["rules_type"], :percentage => a["change_unit"].to_i * a["base_unit"].to_i} - total_percentage = total_percentage + a["change_unit"].to_i * a["base_unit"].to_i - - type_arr.push(data) - end - end + total_percentage = 0 - rebate_arr =[] - campaign_method.each do |a| - data = {:type => a[:type], :amount => a[:amount]} - type_arr.each do |si| - if si[:type] == a[:type] - if credit == 1 - data[:amount] = 0 - else - amount = (redeem_amount / total_percentage)*si[:percentage] - actual = a[:amount] - amount - data[:amount] = actual - end - + type_arr = [] + Rails.logger.debug "Get Member Campaign" + Rails.logger.debug response.to_json + # Check for present response fields + if response["membership_campaign_data"].present? + response["membership_campaign_data"].each do |a| + data = {:type => a["rules_type"], :percentage => a["change_unit"].to_i * a["base_unit"].to_i} + total_percentage = total_percentage + a["change_unit"].to_i * a["base_unit"].to_i + + type_arr.push(data) end end - rebate_arr.push(data) - end - total_amount = rebate_prices - payparcost - overall_dis - - if credit == 1 - total_amount = 0 - end - if total_amount >= 0 - receipt_no = sObj.receipt_no - membership = MembershipSetting.find_by_membership_type("paypar_url") - memberaction = MembershipAction.find_by_membership_type("rebate") - merchant_uid = memberaction.merchant_account_id.to_s - campaign_type_id = memberaction.additional_parameter["campaign_type_id"] - auth_token = memberaction.auth_token.to_s - url = membership.gateway_url.to_s + memberaction.gateway_url.to_s - - # Control for Paypar Cloud - begin - response = HTTParty.post(url, - :body => { - generic_customer_id:generic_customer_id , - total_sale_transaction_amount: sObj.grand_total, - merchant_uid:merchant_uid, - total_amount: total_amount, - campaign_type_id: campaign_type_id, - receipt_no: receipt_no, - campaign_method: rebate_arr.to_json, - auth_token:auth_token - }.to_json, - :headers => { - 'Content-Type' => 'application/json', - 'Accept' => 'application/json; version=2' - }, :timeout => 10) - rescue Net::OpenTimeout - response = { "status": false , "message": "Connect To" } - rescue OpenURI::HTTPError - response = { "status": false, "message": "Can't connect server"} - - rescue SocketError - response = { "status": false, "message": "Can't connect server"} + rebate_arr =[] + campaign_method.each do |a| + data = {:type => a[:type], :amount => a[:amount]} + type_arr.each do |si| + if si[:type] == a[:type] + if credit == 1 + data[:amount] = 0 + else + amount = (redeem_amount / total_percentage)*si[:percentage] + actual = a[:amount] - amount + data[:amount] = actual + end + + end + end + rebate_arr.push(data) + end + + total_amount = rebate_prices - payparcost - overall_dis + + if credit == 1 + total_amount = 0 + end + + if total_amount >= 0 + receipt_no = sObj.receipt_no + membership = MembershipSetting.find_by_membership_type("paypar_url") + memberaction = MembershipAction.find_by_membership_type("rebate") + merchant_uid = memberaction.merchant_account_id.to_s + campaign_type_id = memberaction.additional_parameter["campaign_type_id"] + auth_token = memberaction.auth_token.to_s + url = membership.gateway_url.to_s + memberaction.gateway_url.to_s + + # Control for Paypar Cloud + begin + response = HTTParty.post(url, + :body => { + generic_customer_id:generic_customer_id , + total_sale_transaction_amount: sObj.grand_total, + merchant_uid:merchant_uid, + total_amount: total_amount, + campaign_type_id: campaign_type_id, + receipt_no: receipt_no, + campaign_method: rebate_arr.to_json, + auth_token:auth_token + }.to_json, + :headers => { + 'Content-Type' => 'application/json', + 'Accept' => 'application/json; version=2' + }, :timeout => 10) + rescue Net::OpenTimeout + response = { "status": false , "message": "Connect To" } + rescue OpenURI::HTTPError + response = { "status": false, "message": "Can't connect server"} + + rescue SocketError + response = { "status": false, "message": "Can't connect server"} + end + Rails.logger.debug "Rebage Response" + Rails.logger.debug response.to_json + return response end - Rails.logger.debug "Rebage Response" - Rails.logger.debug response.to_json - return response end else - response = { "status": "no_member", "message": "Not membership"} - + response = { "status": "no_member", "message": "Not membership"} end end From 59fbe1ed1736b149ec8bed38bfe1fccf566397a5 Mon Sep 17 00:00:00 2001 From: phyusin Date: Tue, 12 Dec 2017 10:51:58 +0630 Subject: [PATCH 03/10] change customer UI --- app/views/crm/customers/index.html.erb | 139 ++++++++++---------- app/views/origami/customers/index.html.erb | 140 ++++++++++----------- app/views/origami/rooms/show.html.erb | 4 +- 3 files changed, 146 insertions(+), 137 deletions(-) diff --git a/app/views/crm/customers/index.html.erb b/app/views/crm/customers/index.html.erb index 89900056..2682f203 100755 --- a/app/views/crm/customers/index.html.erb +++ b/app/views/crm/customers/index.html.erb @@ -13,74 +13,85 @@
-
-
- - - - - - - - - - - - - - - - - - <% if @crm_customers.count > 0 %> - <% @i = 0 %> - <% @crm_customers.each do |crm_customer| %> - - - - - - - - - <% end %> - <% else %> - - <% end %> - -
- -
- <%= form_tag crm_customers_path, :id => "filter_form", :method => :get do %> -
-
- - -
- - - - - +
+
+
+ <%= form_tag crm_customers_path, :id => "filter_form", :method => :get do %> +
+
+ +
- <% end %> + + + + +
-
<%= t("views.right_panel.detail.sr_no") %><%= t("views.right_panel.detail.name") %><%= t("views.right_panel.detail.card_no") %><%= t("views.right_panel.detail.contact_no") %><%= t("views.right_panel.detail.email") %><%= t("views.right_panel.detail.action") %>
- - <% if crm_customer.customer_id != "CUS-000000000001" && crm_customer.customer_id != "CUS-000000000002" %> - <%= @i += 1 %> - <%else%> - - - <% end %> - <%= crm_customer.name %><%= crm_customer.card_no rescue '-' %><%= crm_customer.contact_no %><%= crm_customer.email %><%= link_to t("views.btn.show"), crm_customer_path(crm_customer) %>

There is no data for search <%=@filter%>....

-
- <%= paginate @crm_customers %> + +
+
+
+ + + + + + + + + + + + + + + + + <% if @crm_customers.count > 0 %> + <% @i = 0 %> + <% @crm_customers.each do |crm_customer| %> + + + + + + + + + + <% end %> + <% else %> + + <% end %> + +
<%= t("views.right_panel.detail.sr_no") %><%= t("views.right_panel.detail.name") %><%= t("views.right_panel.detail.card_no") %><%= t("views.right_panel.detail.contact_no") %><%= t("views.right_panel.detail.email") %><%= t("views.right_panel.detail.action") %>
+ + + <% if crm_customer.customer_id != "CUS-000000000001" && crm_customer.customer_id != "CUS-000000000002" %> + <%= @i += 1 %> + <%else%> + - + <% end %> + <%= crm_customer.name %><%= crm_customer.card_no rescue '-' %><%= crm_customer.contact_no %><%= crm_customer.email %><%= link_to t("views.btn.show"), crm_customer_path(crm_customer) %>

There is no data for search <%=@filter%>....

+
+ <%= paginate @crm_customers %> +
+
+
+ +
diff --git a/app/views/origami/customers/index.html.erb b/app/views/origami/customers/index.html.erb index 18512b93..e788a08f 100755 --- a/app/views/origami/customers/index.html.erb +++ b/app/views/origami/customers/index.html.erb @@ -14,86 +14,84 @@
-
-
- +
+
+
+ + <% path ="/origami/#{@sale_id}/customers" %> + <%= form_tag path, :id => "filter_form", :method => :get do %> +
+
-
+ + - - + <% end %> + <%else%> + + <% end %> + +
- -
- <% path ="/origami/#{@sale_id}/customers" %> - <%= form_tag path, :id => "filter_form", :method => :get do %> -
-
+
+
+ +
- - + -
-
- -
+
+ <% end %> + + +
+
+ + + + + + + + + + + + - + + <% if @crm_customers.count > 0 %> + <% @i = 0 %> + <% @crm_customers.each do |crm_customer| %> - - <% end %> - - - - - - - - - - - - - - - - <% if @crm_customers.count > 0 %> - <% @i = 0 %> - <% @crm_customers.each do |crm_customer| %> - - - + - - - - - + + + + + + + - - <% end %> - <%else%> - - <% end %> - -
<%= t("views.right_panel.detail.sr_no") %><%= t("views.right_panel.detail.name") %><%= t("views.right_panel.detail.card_no") %><%= t("views.right_panel.detail.contact_no") %><%= t("views.right_panel.detail.email") %>
<%= t("views.right_panel.detail.sr_no") %><%= t("views.right_panel.detail.name") %><%= t("views.right_panel.detail.card_no") %><%= t("views.right_panel.detail.contact_no") %><%= t("views.right_panel.detail.email") %>
-
- <% if crm_customer.customer_id != "CUS-000000000001" && crm_customer.customer_id != "CUS-000000000002" %> - <%= @i += 1 %> - <%else%> - - - <% end %> - <%= crm_customer.name %><%= crm_customer.company rescue '-' %><%= crm_customer.contact_no %><%= crm_customer.email %> + <% if crm_customer.customer_id != "CUS-000000000001" && crm_customer.customer_id != "CUS-000000000002" %> + <%= @i += 1 %> + <%else%> + - + <% end %> + <%= crm_customer.name %><%= crm_customer.company rescue '-' %><%= crm_customer.contact_no %><%= crm_customer.email %>

There are no record for your search

-
+

There are no record for your search

+
- <%= paginate @crm_customers %> + <%= paginate @crm_customers %> +
diff --git a/app/views/origami/rooms/show.html.erb b/app/views/origami/rooms/show.html.erb index aee41b77..05f14c04 100755 --- a/app/views/origami/rooms/show.html.erb +++ b/app/views/origami/rooms/show.html.erb @@ -232,7 +232,7 @@ end if @status_order == 'order' && @status_sale != 'sale' - unless @order_items.nil? + unless @order_items.nil? || @order_items.empty? count = 0 @order_items.each do |order_item | count += 1 @@ -291,7 +291,7 @@
<% if @status_sale == 'sale' - unless @order_items.nil? + unless @order_items.nil? || @order_items.empty? %> Pending New Order From f8b2cd90ba5326d4ad59877246cd9a12e13471aa Mon Sep 17 00:00:00 2001 From: phyusin Date: Tue, 12 Dec 2017 11:31:58 +0630 Subject: [PATCH 04/10] add localization for MM --- config/locales/mm.yml | 111 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 108 insertions(+), 3 deletions(-) diff --git a/config/locales/mm.yml b/config/locales/mm.yml index 82573242..29121da8 100755 --- a/config/locales/mm.yml +++ b/config/locales/mm.yml @@ -26,7 +26,7 @@ mm: top: "အရောင်းရဆုံး" orders: "အော်ဒါများ" credit: "အကြွေး" - + bookings: "ကြိုတင်စာရင်းသွင်းခြင်း" home: "မူလစာမျက်နှာ" simple_menu_item: "ဟင်းလျာများ" set_menu_item: "တွဲဖက်ဟင်းလျာများ" @@ -88,6 +88,7 @@ mm: filter: "ဇကာစစ်ရှာဖွေရန်" del: "ဖျက်ပါ" clr: "ရှင်းပါ" + assign: "ချမှတ်သည်" print_order_summary: "အော်ဒါအကျဉ်းချုပ်များ စာရွက်ထုတ်ရန်" memeber_card: "အသင်းဝင်ကတ်ပြား" @@ -109,6 +110,9 @@ mm: foc: "မေတ္တာဖြင့်ကျွေးမွေးသည်" nett: "အသားတင်" cash: "ငွေသား" + mpu: "MPU" + jcb: "JCB" + visa: "VISA" credit: "အကြွေး" other_payment: "အခြားငွေပေးဆောင်မှုများ" percentage: "ရာခိုင်နှုန်း" @@ -145,6 +149,11 @@ mm: order_queue_stations: "အော်ဒါများတန်းစီသည့်စက်" cashier_terminal: "ငွေရှင်းကောင်တာ" print_settings: "ပရင်တာပြင်ဆင်ရန်" + transaction_sales: "အရောင်းစာရင်းများ" + setting_membership_actions: "အဖွဲ့၀င်မှုဆိုင်ရာချိတ်ဆက်မှုပြင်ဆင်ချက်များ" + membership_actions: "အဖွဲ့၀င်မှုဆိုင်ရာချိတ်ဆက်မှု" + membership_setting: "အဖွဲ့၀င်မှုဆိုင်ရာပြင်ဆင်ချက်များ" + button: new: "အသစ်" create: "တည်ဆောက်" @@ -171,6 +180,8 @@ mm: queue: "တန်းစီ" save: "သိမ်းဆည်း" finish: "ပြီးဆုံး" + save_to_journal: "မှတ်တမ်းတင်မည်" + search_keyboard: "စကားလုံးရှာဖွေမှုများ" detail: name: "နာမည်" type: "အမျိုးအစား" @@ -183,6 +194,7 @@ mm: created_at: "ပြုလုပ်ခဲ့ချိန်" updated_at: "ပြောင်းလဲခဲ့ချိန်" action: "လုပ်ဆောင်မှု" + action_at: "လုပ်ဆောင်ခဲ့ချိန်" actions: "လုပ်ဆောင်မှုများ" item_code: "ဟင်းပွဲ၏နံပါတ်" unit_price: "တပွဲစာစျေးနှုန်း" @@ -266,6 +278,7 @@ mm: additional_parameters: "ထပ်ဆောင်းသတ်မှတ်မှုများ" title: "ခေါင်းစဥ်" discount: "လျှော့စျေး" + item_discount: "ဟင်းပွဲအလိုက်လျှော့စျေးများ" point: "ပွိုင့်" bonus: "အပိုဆောင်း" rebate: "ဆုကြေး" @@ -284,6 +297,7 @@ mm: net_price: "စျေးအသစ်" percentage: "ရာခိုင်နှုန်း" product: "ကုန်ပစ္စည်း" + commission: "ကော်မရှင်" commission_type: "ကော်မရှင်အမျိုးအစား" amount: "သင့်ငွေ" active: "လက်ရှိသုံးစွဲနေ" @@ -340,6 +354,91 @@ mm: tax_amount: "အခွန်ပမာဏ" sales_status: "အရောင်းအနေအထား" receipt_date: "ငွေလက်ခံဖြတ်ပိုင်းနေ့စွဲ" + check_by: "စစ်ဆေးသူ" + check_at: "စစ်ဆေးချိန်" + reason: "အကြောင်းပြချက်" + stock_count: "ပစ္စည်းရေတွက်မှု" + stock_balance: "ပစ္စည်းလက်ကျန်" + different: "ကွာခြားချက်" + order: "အော်ဒါ" + from: "မှ" + to: "ဆီသို့" + order_status: "အော်ဒါမှာကြားမှုအခြေအနေ" + order_items: "အော်ဒါမှာထားသောဟင်းလျာများ" + total_price: "စုစုပေါင်းကျသင့်ငွေ" + enter_keyboards: "စကားလုံးများရိုက်ထည့်ပါ" + receipt_generated_at: "ငွေလက်ခံဖြတ်ပိုင်းထွက်သည့်အချိန်" + total: "စုစုပေါင်း" + total_pay_amount: "စုစုပေါင်းပေးငွေပမာဏ" + change: "ပြန်အမ်းငွေ" + option: "ရွေးချယ်ရန်" + waiter: "ဆိုင်၀န်ထမ်း" + membership_transactions: "အဖွဲ့၀င်အရောင်းစာရင်းများ" + redeem: "ဆုကြေးပြန်သုံးငွေ" + approved_at: "ခွင့်ပြုချိန်" + credit_note: "အကြွေး" + requested_by: "တောင်းယူသူ" + requested_at: "တောင်းယူချိန်" + payment_status: "ငွေပေးချေမှုအခြေအနေ" + sale_status: "အရောင်းအခြေအနေ" + total_amount: "စုစုပေါင်းကျသင့်ငွေပမာဏ" + total_discount: "စုစုပေါင်းလျှော့စျေးပမာဏ" + total_tax: "အခွန်စုစုပေါင်း" + tax_type: "အခွန်အမျိုးအစား" + rnd_adj: "ငွေအတိုးအလျှော့ချိန်ညှိမှု" + amt_received: "လက်ခံရရှိငွေ" + amt_changed: "ပြန်အမ်းငွေ" + select_customer: "စားသုံးသူရွေးချယ်ပါ" + credit_amount: "အကြွေးငွေပမာဏ" + daily_sale_report: "နေ့စဥ်ရောင်းရငွေအစီရင်ခံစာ" + from_date: "မှ​ရက်စွဲ" + to_date: "ထိရက်စွဲ" + sr: "အမှတ်စဥ်" + void_amount: "ပြန်ဖျက်သည့်ပမာဏ" + mpu_sales: "MPU ရောင်းရငွေ" + master_sales: "Master ရောင်းရငွေ" + visa_sales: "Visa ရောင်းရငွေ" + jcb_sales: "JCB ရောင်းရငွေ" + redeem_sales: "ဆုကြေးပြန်သုံးငွေနှင့် ရောင်းရငွေ" + cash_sales: "ငွေသား ရောင်းရငွေ" + credit_sales: "အကြွေး ရောင်းရငွေ" + foc_sales: "အခမဲ့ ရောင်းရငွေ" + foc_item: "အခမဲ့ ဟင်းလျာများ" + net_amount: "အသတင်စျေးနှုန်း" + sale_item_report: "ရောင်းရဟင်းလျာအစီရင်ခံစာ" + select_period: "အချိန်ကာလသတ်မှတ်ပါ" + shift_name: "တာ၀န်ချိန်" + code: "ကုတ်နံပါတ်" + item: "ဟင်းလျာ" + revenue: "ရောင်းရ၀င်ငွေ" + total_price_by: "စုစုပေါင်းငွေပမာဏ" + sub_total: "စုစုပေါင်း" + cash_received: "လက်ခံရရှိငွေ" + card_sales: "ကတ်ဖြင့်ရောင်းရငွေများ" + select_payments: "ငွေပေးချေမှုအမျိုးအစားရွေးချယ်ပါ" + all_shift: "တာ၀န်ချိန်များအားလုံး" + receipt_no_report: "ငွေလက်ခံဖြတ်ပိုင်းနံပါတ် အစီရင်ခံစာ" + payment_method_report: "ငွေပေးချေမှုနည်းလမ်းအလိုက် အစီရင်ခံစာ" + rnd_adj_sh: "ငွေအတိုးအလျှော့ချိန်ညှိမှု" + shift_sale_report: "တာ၀န်ချိန်အလိုက်ရောင်းရငွေ အစီရင်ခံစာ" + cashier_station: "ငွေရှင်းကောင်တာ" + cash_payment: "ငွေသားပေးချေမှု" + credit_payment: "အကြွေးပေးချေမှု" + credit_payment_report: "အကြွေးပေးချေမှုဆိုင်ရာ အစီရင်ခံစာ" + void_sale_report: "ဖျက်သိမ်းအရောင်းစာရင်းများဆိုင်ရာ အစီရင်ခံစာ" + sale_date: "ရောင်းချသည့်ရက်စွဲ" + commission_report: "ကော်မရှင်စား အစီရင်ခံစာ" + commission_price: "ကော်မရှင်စား စျေးနှုန်း" + commission_amount: "ကော်မရှင်စား ငွေပမာဏ" + receipt: "ငွေလက်ခံဖြတ်ပိုင်း" + tax: "အခွန်" + card_sale: "ကတ်ဖြင့်ရောင်းရငွေ" + dine_in: "ဆိုင်တွင်စားသောက်ခြင်း" + takeaway: "ပါဆယ်၀ယ်ယူခြင်း" + membership: "အသင်း၀င်ခြင်း" + gateway_communication_type: "အဓိကလမ်းကြောင်းဆက်သွယ်မှုအမျိုးအစား" + gateway_url: "အဓိကလမ်းကြောင်းဆက်သွယ်မှုလိပ်စာ" + additional_parameter: "ထပ်ဖြည့်အကြောင်းအရာ" survey: "ခြုံငုံလေ့လာခြင်း" code_txt: "ကုတ်ဒ် " @@ -497,10 +596,16 @@ mm: stock_check_reason_txt: "စတော့စစ်ဆေးမှုအကြောင်းပြချက်" stock_check_txt: "စတော့စစ်ဆေးသည်" detail_txt: "အသေးစိတ်" - + no_data_txt: "ရှာဖွေခြင်း မတွေ့ရှိပါ" assign_txt: "ချမှတ်သည်" remove_txt: "ဖြုတ်ပစ်သည်" - + membership_type_txt: "အသင်း၀င်မှုအမျိုးအစား" + merchant_account_txt: "စားသောက်ဆိုင်ဘက်ဆိုင်ရာအကောင့်" + membership_actions_txt: "အဖွဲ့၀င်မှုဆိုင်ရာချိတ်ဆက်မှု" + gateway_communication_type_txt: "အဓိကလမ်းကြောင်းဆက်သွယ်မှုအမျိုးအစား" + gateway_url_txt: "အဓိကလမ်းကြောင်းဆက်သွယ်မှုလိပ်စာ" + membership_setting_txt: "အဖွဲ့၀င်မှုဆိုင်ရာပြင်ဆင်ချက်များ" + cancel_btn_txt: "ပြန်ဖျက်ရန်" image_btn_txt: "တင်သွင်းရန်" create_btn_txt: "တည်ဆောက်ရန်" From 8611489ecb08ac38164652fef5965aa1234275b4 Mon Sep 17 00:00:00 2001 From: phyusin Date: Tue, 12 Dec 2017 15:43:56 +0630 Subject: [PATCH 05/10] change dashboard data --- app/controllers/home_controller.rb | 4 ++-- app/models/sale.rb | 2 +- app/views/home/dashboard.html.erb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 8c3d7cc4..35308c5f 100755 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -86,10 +86,10 @@ class HomeController < ApplicationController @total_payment_methods.each do |payment| if payment.payment_method == "mpu" || payment.payment_method == "visa" || payment.payment_method == "master" || payment.payment_method == "jcb" pay = Sale.payment_sale('card', today) - @sale_data.push({'card' => pay}) + @sale_data.push({'card' => pay.payment_amount}) else pay = Sale.payment_sale(payment.payment_method, today) - @sale_data.push({payment.payment_method => pay}) + @sale_data.push({payment.payment_method => pay.payment_amount}) end end @summ_sale = Sale.summary_sale_receipt(today) diff --git a/app/models/sale.rb b/app/models/sale.rb index fbd22da2..fbd63076 100755 --- a/app/models/sale.rb +++ b/app/models/sale.rb @@ -1038,7 +1038,7 @@ end else query = query.where("sales.sale_status = 'completed' and sp.payment_method = '#{payment_method}' and DATE_FORMAT(sales.receipt_date,'%Y-%m-%d') = ?",today) end - query.sum("sp.payment_amount") + query.select("(CASE WHEN sp.payment_method='cash' THEN (SUM(sp.payment_amount) - SUM(sales.amount_changed)) ELSE SUM(sp.payment_amount) END) as payment_amount").first() end def self.total_customer(today) diff --git a/app/views/home/dashboard.html.erb b/app/views/home/dashboard.html.erb index 90221290..d78789a5 100755 --- a/app/views/home/dashboard.html.erb +++ b/app/views/home/dashboard.html.erb @@ -163,7 +163,7 @@ <% total_card = 0.0 %> <% @sale_data.each do |data| %> <% total_card = data["card"] %> - <% break end %> + <% end %> <%= total_card.to_f %> From 450a27b4f032954e7d7a546a48821dafa9055714 Mon Sep 17 00:00:00 2001 From: phyusin Date: Tue, 12 Dec 2017 15:46:53 +0630 Subject: [PATCH 06/10] change redeem amt for nett --- app/views/origami/redeem_payments/index.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/origami/redeem_payments/index.html.erb b/app/views/origami/redeem_payments/index.html.erb index 6daacbb2..d250e0b7 100755 --- a/app/views/origami/redeem_payments/index.html.erb +++ b/app/views/origami/redeem_payments/index.html.erb @@ -147,7 +147,7 @@ $('#used_amount').text(cash.substr(0,cash.length-1)); break; case 'nett': - var remain_amount = $('#valid_amount').val(); + var remain_amount = $('#redeemamt').val(); $('#used_amount').text(remain_amount); break; From 0ade612b970e891b27fe0f7559b4c9308ef752cc Mon Sep 17 00:00:00 2001 From: phyusin Date: Tue, 12 Dec 2017 16:06:04 +0630 Subject: [PATCH 07/10] change dashboard data --- app/views/home/dashboard.html.erb | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/app/views/home/dashboard.html.erb b/app/views/home/dashboard.html.erb index d78789a5..b6f597ce 100755 --- a/app/views/home/dashboard.html.erb +++ b/app/views/home/dashboard.html.erb @@ -160,11 +160,8 @@ <% end %> From 3ef122b8f3c89008a56f81ae19ee3160f76ed76b Mon Sep 17 00:00:00 2001 From: phyusin Date: Tue, 12 Dec 2017 16:11:32 +0630 Subject: [PATCH 08/10] check card in dashboard --- app/views/home/dashboard.html.erb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/views/home/dashboard.html.erb b/app/views/home/dashboard.html.erb index b6f597ce..d48c0b9f 100755 --- a/app/views/home/dashboard.html.erb +++ b/app/views/home/dashboard.html.erb @@ -161,7 +161,9 @@ <% end %> From 112c4d922895808fed17db4982a1264dc202a812 Mon Sep 17 00:00:00 2001 From: phyusin Date: Tue, 12 Dec 2017 16:24:31 +0630 Subject: [PATCH 09/10] change dashboard data --- app/views/home/dashboard.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/home/dashboard.html.erb b/app/views/home/dashboard.html.erb index d48c0b9f..ff47f394 100755 --- a/app/views/home/dashboard.html.erb +++ b/app/views/home/dashboard.html.erb @@ -161,7 +161,7 @@ From 5ba010c1e63985b8a486642a7b67f93e8a500980 Mon Sep 17 00:00:00 2001 From: phyusin Date: Tue, 12 Dec 2017 16:46:14 +0630 Subject: [PATCH 10/10] change card sale data --- app/views/home/dashboard.html.erb | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/app/views/home/dashboard.html.erb b/app/views/home/dashboard.html.erb index ff47f394..7511d1c4 100755 --- a/app/views/home/dashboard.html.erb +++ b/app/views/home/dashboard.html.erb @@ -157,15 +157,17 @@ <% end %> <% end %> <% end %> - - - - + + + + + <% end %> + <% end %>
<%= t("views.right_panel.detail.card_sale") %> : - <% total_card = 0.0 %> - <% @sale_data.each do |data| %> - <% total_card = data["card"] %> - <% end %> - <%= total_card.to_f %> + <% total_card = @sale_data.select { |hash| hash["card"]!=nil }.first %> + <%= total_card["card"].to_f %>
<%= t("views.right_panel.detail.card_sale") %> : <% total_card = @sale_data.select { |hash| hash["card"]!=nil }.first %> - <%= total_card["card"].to_f %> + <% if total_card["card"] !=nil %> + <%= total_card["card"].to_f %> + <% end %>
<%= t("views.right_panel.detail.card_sale") %> : <% total_card = @sale_data.select { |hash| hash["card"]!=nil }.first %> - <% if total_card["card"] !=nil %> + <% if !total_card.nil? %> <%= total_card["card"].to_f %> <% end %>
<%= t("views.right_panel.detail.card_sale") %> : - <% total_card = @sale_data.select { |hash| hash["card"]!=nil }.first %> + + <% total_card = @sale_data.select { |hash| hash["card"]!=nil }.first %> <% if !total_card.nil? %> - <%= total_card["card"].to_f %> - <% end %> -
<%= t("views.right_panel.detail.card_sale") %> : + <%= total_card["card"].to_f %> +